mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-02 05:20:59 +02:00
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:
256
tools/sdk/include/bluedroid/stack/a2d_api.h
Normal file
256
tools/sdk/include/bluedroid/stack/a2d_api.h
Normal file
@ -0,0 +1,256 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* nterface to A2DP Application Programming Interface
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef A2D_API_H
|
||||
#define A2D_API_H
|
||||
#include "stack/sdp_api.h"
|
||||
#if (A2D_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** constants
|
||||
*****************************************************************************/
|
||||
|
||||
/* Profile supported features */
|
||||
#define A2D_SUPF_PLAYER 0x0001
|
||||
#define A2D_SUPF_MIC 0x0002
|
||||
#define A2D_SUPF_TUNER 0x0004
|
||||
#define A2D_SUPF_MIXER 0x0008
|
||||
|
||||
#define A2D_SUPF_HEADPHONE 0x0001
|
||||
#define A2D_SUPF_SPEAKER 0x0002
|
||||
#define A2D_SUPF_RECORDER 0x0004
|
||||
#define A2D_SUPF_AMP 0x0008
|
||||
|
||||
/* AV Media Types */
|
||||
#define A2D_MEDIA_TYPE_AUDIO 0x00 /* audio media type + RFA */
|
||||
#define A2D_MEDIA_TYPE_VIDEO 0x10 /* video media type + RFA */
|
||||
#define A2D_MEDIA_TYPE_MULTI 0x20 /* multimedia media type + RFA */
|
||||
|
||||
/* AV Media Codec Type (Audio Codec ID) */
|
||||
#define A2D_MEDIA_CT_SBC 0x00 /* SBC media codec type */
|
||||
#define A2D_MEDIA_CT_M12 0x01 /* MPEG-1, 2 Audio media codec type */
|
||||
#define A2D_MEDIA_CT_M24 0x02 /* MPEG-2, 4 AAC media codec type */
|
||||
#define A2D_MEDIA_CT_ATRAC 0x04 /* ATRAC family media codec type */
|
||||
|
||||
#define A2D_SUCCESS 0 /* Success */
|
||||
#define A2D_FAIL 0x0A /* Failed */
|
||||
#define A2D_BUSY 0x0B /* A2D_FindService is already in progress */
|
||||
#define A2D_INVALID_PARAMS 0x0C /* bad parameters */
|
||||
#define A2D_WRONG_CODEC 0x0D /* wrong codec info */
|
||||
#define A2D_BAD_CODEC_TYPE 0xC1 /* Media Codec Type is not valid */
|
||||
#define A2D_NS_CODEC_TYPE 0xC2 /* Media Codec Type is not supported */
|
||||
#define A2D_BAD_SAMP_FREQ 0xC3 /* Sampling Frequency is not valid or multiple values have been selected */
|
||||
#define A2D_NS_SAMP_FREQ 0xC4 /* Sampling Frequency is not supported */
|
||||
#define A2D_BAD_CH_MODE 0xC5 /* Channel Mode is not valid or multiple values have been selected */
|
||||
#define A2D_NS_CH_MODE 0xC6 /* Channel Mode is not supported */
|
||||
#define A2D_BAD_SUBBANDS 0xC7 /* None or multiple values have been selected for Number of Subbands */
|
||||
#define A2D_NS_SUBBANDS 0xC8 /* Number of Subbands is not supported */
|
||||
#define A2D_BAD_ALLOC_MTHD 0xC9 /* None or multiple values have been selected for Allocation Method */
|
||||
#define A2D_NS_ALLOC_MTHD 0xCA /* Allocation Method is not supported */
|
||||
#define A2D_BAD_MIN_BITPOOL 0xCB /* Minimum Bitpool Value is not valid */
|
||||
#define A2D_NS_MIN_BITPOOL 0xCC /* Minimum Bitpool Value is not supported */
|
||||
#define A2D_BAD_MAX_BITPOOL 0xCD /* Maximum Bitpool Value is not valid */
|
||||
#define A2D_NS_MAX_BITPOOL 0xCE /* Maximum Bitpool Value is not supported */
|
||||
#define A2D_BAD_LAYER 0xCF /* None or multiple values have been selected for Layer */
|
||||
#define A2D_NS_LAYER 0xD0 /* Layer is not supported */
|
||||
#define A2D_NS_CRC 0xD1 /* CRC is not supported */
|
||||
#define A2D_NS_MPF 0xD2 /* MPF-2 is not supported */
|
||||
#define A2D_NS_VBR 0xD3 /* VBR is not supported */
|
||||
#define A2D_BAD_BIT_RATE 0xD4 /* None or multiple values have been selected for Bit Rate */
|
||||
#define A2D_NS_BIT_RATE 0xD5 /* Bit Rate is not supported */
|
||||
#define A2D_BAD_OBJ_TYPE 0xD6 /* Either 1) Object type is not valid (b3-b0) or 2) None or multiple values have been selected for Object Type */
|
||||
#define A2D_NS_OBJ_TYPE 0xD7 /* Object type is not supported */
|
||||
#define A2D_BAD_CHANNEL 0xD8 /* None or multiple values have been selected for Channels */
|
||||
#define A2D_NS_CHANNEL 0xD9 /* Channels is not supported */
|
||||
#define A2D_BAD_BLOCK_LEN 0xDD /* None or multiple values have been selected for Block Length */
|
||||
#define A2D_BAD_CP_TYPE 0xE0 /* The requested CP Type is not supported. */
|
||||
#define A2D_BAD_CP_FORMAT 0xE1 /* The format of Content Protection Service Capability/Content Protection Scheme Dependent Data is not correct. */
|
||||
|
||||
typedef UINT8 tA2D_STATUS;
|
||||
|
||||
/* the return values from A2D_BitsSet() */
|
||||
#define A2D_SET_ONE_BIT 1 /* one and only one bit is set */
|
||||
#define A2D_SET_ZERO_BIT 0 /* all bits clear */
|
||||
#define A2D_SET_MULTL_BIT 2 /* multiple bits are set */
|
||||
|
||||
/*****************************************************************************
|
||||
** type definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/* This data type is used in A2D_FindService() to initialize the SDP database
|
||||
* to hold the result service search. */
|
||||
typedef struct {
|
||||
UINT32 db_len; /* Length, in bytes, of the discovery database */
|
||||
UINT16 num_attr;/* The number of attributes in p_attrs */
|
||||
tSDP_DISCOVERY_DB *p_db; /* Pointer to the discovery database */
|
||||
UINT16 *p_attrs; /* The attributes filter. If NULL, A2DP API sets the attribute filter
|
||||
* to be ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_BT_PROFILE_DESC_LIST,
|
||||
* ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and ATTR_ID_PROVIDER_NAME.
|
||||
* If not NULL, the input is taken as the filter. */
|
||||
} tA2D_SDP_DB_PARAMS;
|
||||
|
||||
/* This data type is used in tA2D_FIND_CBACK to report the result of the SDP discovery process. */
|
||||
typedef struct {
|
||||
UINT16 service_len; /* Length, in bytes, of the service name */
|
||||
UINT16 provider_len; /* Length, in bytes, of the provider name */
|
||||
char *p_service_name; /* Pointer the service name. This character string may not be null terminated.
|
||||
* Use the service_len parameter to safely copy this string */
|
||||
char *p_provider_name;/* Pointer the provider name. This character string may not be null terminated.
|
||||
* Use the provider_len parameter to safely copy this string */
|
||||
UINT16 features; /* Profile supported features */
|
||||
UINT16 avdt_version; /* AVDTP protocol version */
|
||||
} tA2D_Service;
|
||||
|
||||
/* This is the callback to notify the result of the SDP discovery process. */
|
||||
typedef void (tA2D_FIND_CBACK)(BOOLEAN found, tA2D_Service *p_service);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** external function declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_AddRecord
|
||||
**
|
||||
** Description This function is called by a server application to add
|
||||
** SRC or SNK information to an SDP record. Prior to
|
||||
** calling this function the application must call
|
||||
** SDP_CreateRecord() to create an SDP record.
|
||||
**
|
||||
** Input Parameters:
|
||||
** service_uuid: Indicates SRC or SNK.
|
||||
**
|
||||
** p_service_name: Pointer to a null-terminated character
|
||||
** string containing the service name.
|
||||
**
|
||||
** p_provider_name: Pointer to a null-terminated character
|
||||
** string containing the provider name.
|
||||
**
|
||||
** features: Profile supported features.
|
||||
**
|
||||
** sdp_handle: SDP handle returned by SDP_CreateRecord().
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns A2D_SUCCESS if function execution succeeded,
|
||||
** A2D_INVALID_PARAMS if bad parameters are given.
|
||||
** A2D_FAIL if function execution failed.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern tA2D_STATUS A2D_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
|
||||
UINT16 features, UINT32 sdp_handle);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_FindService
|
||||
**
|
||||
** Description This function is called by a client application to
|
||||
** perform service discovery and retrieve SRC or SNK SDP
|
||||
** record information from a server. Information is
|
||||
** returned for the first service record found on the
|
||||
** server that matches the service UUID. The callback
|
||||
** function will be executed when service discovery is
|
||||
** complete. There can only be one outstanding call to
|
||||
** A2D_FindService() at a time; the application must wait
|
||||
** for the callback before it makes another call to
|
||||
** the function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** service_uuid: Indicates SRC or SNK.
|
||||
**
|
||||
** bd_addr: BD address of the peer device.
|
||||
**
|
||||
** p_db: Pointer to the information to initialize
|
||||
** the discovery database.
|
||||
**
|
||||
** p_cback: Pointer to the A2D_FindService()
|
||||
** callback function.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns A2D_SUCCESS if function execution succeeded,
|
||||
** A2D_INVALID_PARAMS if bad parameters are given.
|
||||
** A2D_BUSY if discovery is already in progress.
|
||||
** A2D_FAIL if function execution failed.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern tA2D_STATUS A2D_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
tA2D_SDP_DB_PARAMS *p_db, tA2D_FIND_CBACK *p_cback);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_SetTraceLevel
|
||||
**
|
||||
** Description Sets the trace level for A2D. If 0xff is passed, the
|
||||
** current trace level is returned.
|
||||
**
|
||||
** Input Parameters:
|
||||
** new_level: The level to set the A2D tracing to:
|
||||
** 0xff-returns the current setting.
|
||||
** 0-turns off tracing.
|
||||
** >= 1-Errors.
|
||||
** >= 2-Warnings.
|
||||
** >= 3-APIs.
|
||||
** >= 4-Events.
|
||||
** >= 5-Debug.
|
||||
**
|
||||
** Returns The new trace level or current trace level if
|
||||
** the input parameter is 0xff.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT8 A2D_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
/******************************************************************************
|
||||
** Function A2D_BitsSet
|
||||
**
|
||||
** Description Check the given num for the number of bits set
|
||||
** Returns A2D_SET_ONE_BIT, if one and only one bit is set
|
||||
** A2D_SET_ZERO_BIT, if all bits clear
|
||||
** A2D_SET_MULTL_BIT, if multiple bits are set
|
||||
******************************************************************************/
|
||||
extern UINT8 A2D_BitsSet(UINT8 num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function A2D_Init
|
||||
**
|
||||
** Description This function is called at stack startup to allocate the
|
||||
** control block (if using dynamic memory), and initializes the
|
||||
** control block and tracing level.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void A2D_Init(void);
|
||||
extern void A2D_Deinit(void);
|
||||
#endif ///A2D_INCLUDED
|
||||
#endif /* A2D_API_H */
|
213
tools/sdk/include/bluedroid/stack/a2d_sbc.h
Normal file
213
tools/sdk/include/bluedroid/stack/a2d_sbc.h
Normal file
@ -0,0 +1,213 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* nterface to low complexity subband codec (SBC)
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef A2D_SBC_H
|
||||
#define A2D_SBC_H
|
||||
#if (A2D_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
/* the length of the SBC Media Payload header. */
|
||||
#define A2D_SBC_MPL_HDR_LEN 1
|
||||
|
||||
/* the LOSC of SBC media codec capabilitiy */
|
||||
#define A2D_SBC_INFO_LEN 6
|
||||
|
||||
/* for Codec Specific Information Element */
|
||||
#define A2D_SBC_IE_SAMP_FREQ_MSK 0xF0 /* b7-b4 sampling frequency */
|
||||
#define A2D_SBC_IE_SAMP_FREQ_16 0x80 /* b7:16 kHz */
|
||||
#define A2D_SBC_IE_SAMP_FREQ_32 0x40 /* b6:32 kHz */
|
||||
#define A2D_SBC_IE_SAMP_FREQ_44 0x20 /* b5:44.1kHz */
|
||||
#define A2D_SBC_IE_SAMP_FREQ_48 0x10 /* b4:48 kHz */
|
||||
|
||||
#define A2D_SBC_IE_CH_MD_MSK 0x0F /* b3-b0 channel mode */
|
||||
#define A2D_SBC_IE_CH_MD_MONO 0x08 /* b3: mono */
|
||||
#define A2D_SBC_IE_CH_MD_DUAL 0x04 /* b2: dual */
|
||||
#define A2D_SBC_IE_CH_MD_STEREO 0x02 /* b1: stereo */
|
||||
#define A2D_SBC_IE_CH_MD_JOINT 0x01 /* b0: joint stereo */
|
||||
|
||||
#define A2D_SBC_IE_BLOCKS_MSK 0xF0 /* b7-b4 number of blocks */
|
||||
#define A2D_SBC_IE_BLOCKS_4 0x80 /* 4 blocks */
|
||||
#define A2D_SBC_IE_BLOCKS_8 0x40 /* 8 blocks */
|
||||
#define A2D_SBC_IE_BLOCKS_12 0x20 /* 12blocks */
|
||||
#define A2D_SBC_IE_BLOCKS_16 0x10 /* 16blocks */
|
||||
|
||||
#define A2D_SBC_IE_SUBBAND_MSK 0x0C /* b3-b2 number of subbands */
|
||||
#define A2D_SBC_IE_SUBBAND_4 0x08 /* b3: 4 */
|
||||
#define A2D_SBC_IE_SUBBAND_8 0x04 /* b2: 8 */
|
||||
|
||||
#define A2D_SBC_IE_ALLOC_MD_MSK 0x03 /* b1-b0 allocation mode */
|
||||
#define A2D_SBC_IE_ALLOC_MD_S 0x02 /* b1: SNR */
|
||||
#define A2D_SBC_IE_ALLOC_MD_L 0x01 /* b0: loundess */
|
||||
|
||||
#define A2D_SBC_IE_MIN_BITPOOL 2
|
||||
#define A2D_SBC_IE_MAX_BITPOOL 250
|
||||
|
||||
/* for media payload header */
|
||||
#define A2D_SBC_HDR_F_MSK 0x80
|
||||
#define A2D_SBC_HDR_S_MSK 0x40
|
||||
#define A2D_SBC_HDR_L_MSK 0x20
|
||||
#define A2D_SBC_HDR_NUM_MSK 0x0F
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/* data type for the SBC Codec Information Element*/
|
||||
typedef struct {
|
||||
UINT8 samp_freq; /* Sampling frequency */
|
||||
UINT8 ch_mode; /* Channel mode */
|
||||
UINT8 block_len; /* Block length */
|
||||
UINT8 num_subbands; /* Number of subbands */
|
||||
UINT8 alloc_mthd; /* Allocation method */
|
||||
UINT8 max_bitpool; /* Maximum bitpool */
|
||||
UINT8 min_bitpool; /* Minimum bitpool */
|
||||
} tA2D_SBC_CIE;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_SbcChkFrInit
|
||||
**
|
||||
** Description check if need to init the descramble control block.
|
||||
**
|
||||
** Returns nothing.
|
||||
******************************************************************************/
|
||||
extern void A2D_SbcChkFrInit(UINT8 *p_pkt);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_SbcDescramble
|
||||
**
|
||||
** Description descramble the packet.
|
||||
**
|
||||
** Returns nothing.
|
||||
******************************************************************************/
|
||||
extern void A2D_SbcDescramble(UINT8 *p_pkt, UINT16 len);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_BldSbcInfo
|
||||
**
|
||||
** Description This function is called by an application to build
|
||||
** the SBC Media Codec Capabilities byte sequence
|
||||
** beginning from the LOSC octet.
|
||||
** Input Parameters:
|
||||
** media_type: Indicates Audio, or Multimedia.
|
||||
**
|
||||
** p_ie: The SBC Codec Information Element information.
|
||||
**
|
||||
** Output Parameters:
|
||||
** p_result: the resulting codec info byte sequence.
|
||||
**
|
||||
** Returns A2D_SUCCESS if function execution succeeded.
|
||||
** Error status code, otherwise.
|
||||
******************************************************************************/
|
||||
extern tA2D_STATUS A2D_BldSbcInfo(UINT8 media_type, tA2D_SBC_CIE *p_ie,
|
||||
UINT8 *p_result);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_ParsSbcInfo
|
||||
**
|
||||
** Description This function is called by an application to parse
|
||||
** the SBC Media Codec Capabilities byte sequence
|
||||
** beginning from the LOSC octet.
|
||||
** Input Parameters:
|
||||
** p_info: the byte sequence to parse.
|
||||
**
|
||||
** for_caps: TRUE, if the byte sequence is for get capabilities response.
|
||||
**
|
||||
** Output Parameters:
|
||||
** p_ie: The SBC Codec Information Element information.
|
||||
**
|
||||
** Returns A2D_SUCCESS if function execution succeeded.
|
||||
** Error status code, otherwise.
|
||||
******************************************************************************/
|
||||
extern tA2D_STATUS A2D_ParsSbcInfo(tA2D_SBC_CIE *p_ie, UINT8 *p_info,
|
||||
BOOLEAN for_caps);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_BldSbcMplHdr
|
||||
**
|
||||
** Description This function is called by an application to parse
|
||||
** the SBC Media Payload header.
|
||||
** Input Parameters:
|
||||
** frag: 1, if fragmented. 0, otherwise.
|
||||
**
|
||||
** start: 1, if the starting packet of a fragmented frame.
|
||||
**
|
||||
** last: 1, if the last packet of a fragmented frame.
|
||||
**
|
||||
** num: If frag is 1, this is the number of remaining fragments
|
||||
** (including this fragment) of this frame.
|
||||
** If frag is 0, this is the number of frames in this packet.
|
||||
**
|
||||
** Output Parameters:
|
||||
** p_dst: the resulting media payload header byte sequence.
|
||||
**
|
||||
** Returns void.
|
||||
******************************************************************************/
|
||||
extern void A2D_BldSbcMplHdr(UINT8 *p_dst, BOOLEAN frag, BOOLEAN start,
|
||||
BOOLEAN last, UINT8 num);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function A2D_ParsSbcMplHdr
|
||||
**
|
||||
** Description This function is called by an application to parse
|
||||
** the SBC Media Payload header.
|
||||
** Input Parameters:
|
||||
** p_src: the byte sequence to parse..
|
||||
**
|
||||
** Output Parameters:
|
||||
** frag: 1, if fragmented. 0, otherwise.
|
||||
**
|
||||
** start: 1, if the starting packet of a fragmented frame.
|
||||
**
|
||||
** last: 1, if the last packet of a fragmented frame.
|
||||
**
|
||||
** num: If frag is 1, this is the number of remaining fragments
|
||||
** (including this fragment) of this frame.
|
||||
** If frag is 0, this is the number of frames in this packet.
|
||||
**
|
||||
** Returns void.
|
||||
******************************************************************************/
|
||||
extern void A2D_ParsSbcMplHdr(UINT8 *p_src, BOOLEAN *p_frag,
|
||||
BOOLEAN *p_start, BOOLEAN *p_last,
|
||||
UINT8 *p_num);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///A2D_INCLUDED == TRUE
|
||||
|
||||
#endif /* A2D_SBC_H */
|
279
tools/sdk/include/bluedroid/stack/avct_api.h
Normal file
279
tools/sdk/include/bluedroid/stack/avct_api.h
Normal file
@ -0,0 +1,279 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 interface file contains the interface to the Audio Video Control
|
||||
* Transport Protocol (AVCTP).
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef AVCT_API_H
|
||||
#define AVCT_API_H
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
#include "common/bt_target.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
/* API function return value result codes. */
|
||||
#define AVCT_SUCCESS 0 /* Function successful */
|
||||
#define AVCT_NO_RESOURCES 1 /* Not enough resources */
|
||||
#define AVCT_BAD_HANDLE 2 /* Bad handle */
|
||||
#define AVCT_PID_IN_USE 3 /* PID already in use */
|
||||
#define AVCT_NOT_OPEN 4 /* Connection not open */
|
||||
|
||||
/* PSM for AVCT. */
|
||||
#define AVCT_PSM 0x0017
|
||||
#define AVCT_BR_PSM 0x001B
|
||||
|
||||
/* Protocol revision numbers */
|
||||
#define AVCT_REV_1_0 0x0100
|
||||
#define AVCT_REV_1_2 0x0102
|
||||
#define AVCT_REV_1_3 0x0103
|
||||
#define AVCT_REV_1_4 0x0104
|
||||
|
||||
/* the layer_specific settings */
|
||||
#define AVCT_DATA_CTRL 0x0001 /* for the control channel */
|
||||
#define AVCT_DATA_BROWSE 0x0002 /* for the browsing channel */
|
||||
#define AVCT_DATA_PARTIAL 0x0100 /* Only have room for a partial message */
|
||||
|
||||
#define AVCT_MIN_CONTROL_MTU 48 /* Per the AVRC spec, minimum MTU for the control channel */
|
||||
#define AVCT_MIN_BROWSE_MTU 335 /* Per the AVRC spec, minimum MTU for the browsing channel */
|
||||
|
||||
/* Message offset. The number of bytes needed by the protocol stack for the
|
||||
** protocol headers of an AVCTP message packet.
|
||||
*/
|
||||
#define AVCT_MSG_OFFSET 15
|
||||
#define AVCT_BROWSE_OFFSET 17 /* the default offset for browsing channel */
|
||||
|
||||
/* Connection role. */
|
||||
#define AVCT_INT 0 /* Initiator connection */
|
||||
#define AVCT_ACP 1 /* Acceptor connection */
|
||||
|
||||
/* Control role. */
|
||||
#define AVCT_TARGET 1 /* target */
|
||||
#define AVCT_CONTROL 2 /* controller */
|
||||
#define AVCT_PASSIVE 4 /* If conflict, allow the other side to succeed */
|
||||
|
||||
/* Command/Response indicator. */
|
||||
#define AVCT_CMD 0 /* Command message */
|
||||
#define AVCT_RSP 2 /* Response message */
|
||||
#define AVCT_REJ 3 /* Message rejected */
|
||||
|
||||
/* Control callback events. */
|
||||
#define AVCT_CONNECT_CFM_EVT 0 /* Connection confirm */
|
||||
#define AVCT_CONNECT_IND_EVT 1 /* Connection indication */
|
||||
#define AVCT_DISCONNECT_CFM_EVT 2 /* Disconnect confirm */
|
||||
#define AVCT_DISCONNECT_IND_EVT 3 /* Disconnect indication */
|
||||
#define AVCT_CONG_IND_EVT 4 /* Congestion indication */
|
||||
#define AVCT_UNCONG_IND_EVT 5 /* Uncongestion indication */
|
||||
#define AVCT_BROWSE_CONN_CFM_EVT 6 /* Browse Connection confirm */
|
||||
#define AVCT_BROWSE_CONN_IND_EVT 7 /* Browse Connection indication */
|
||||
#define AVCT_BROWSE_DISCONN_CFM_EVT 8 /* Browse Disconnect confirm */
|
||||
#define AVCT_BROWSE_DISCONN_IND_EVT 9 /* Browse Disconnect indication */
|
||||
#define AVCT_BROWSE_CONG_IND_EVT 10 /* Congestion indication */
|
||||
#define AVCT_BROWSE_UNCONG_IND_EVT 11 /* Uncongestion indication */
|
||||
|
||||
|
||||
/* General purpose failure result code for callback events. */
|
||||
#define AVCT_RESULT_FAIL 5
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/* Control callback function. */
|
||||
typedef void (tAVCT_CTRL_CBACK)(UINT8 handle, UINT8 event, UINT16 result,
|
||||
BD_ADDR peer_addr);
|
||||
|
||||
/* Message callback function */
|
||||
/* p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE */
|
||||
typedef void (tAVCT_MSG_CBACK)(UINT8 handle, UINT8 label, UINT8 cr,
|
||||
BT_HDR *p_pkt);
|
||||
|
||||
/* Structure used by AVCT_CreateConn. */
|
||||
typedef struct {
|
||||
tAVCT_CTRL_CBACK *p_ctrl_cback; /* Control callback */
|
||||
tAVCT_MSG_CBACK *p_msg_cback; /* Message callback */
|
||||
UINT16 pid; /* Profile ID */
|
||||
UINT8 role; /* Initiator/acceptor role */
|
||||
UINT8 control; /* Control role (Control/Target) */
|
||||
} tAVCT_CC;
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_Register
|
||||
**
|
||||
** Description This is the system level registration function for the
|
||||
** AVCTP protocol. This function initializes AVCTP and
|
||||
** prepares the protocol stack for its use. This function
|
||||
** must be called once by the system or platform using AVCTP
|
||||
** before the other functions of the API an be used.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_Deregister
|
||||
**
|
||||
** Description This function is called to deregister use AVCTP protocol.
|
||||
** It is called when AVCTP is no longer being used by any
|
||||
** application in the system. Before this function can be
|
||||
** called, all connections must be removed with
|
||||
** AVCT_RemoveConn().
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVCT_Deregister(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_CreateConn
|
||||
**
|
||||
** Description Create an AVCTP connection. There are two types of
|
||||
** connections, initiator and acceptor, as determined by
|
||||
** the p_cc->role parameter. When this function is called to
|
||||
** create an initiator connection, an AVCTP connection to
|
||||
** the peer device is initiated if one does not already exist.
|
||||
** If an acceptor connection is created, the connection waits
|
||||
** passively for an incoming AVCTP connection from a peer device.
|
||||
**
|
||||
**
|
||||
** Returns AVCT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_CreateConn(UINT8 *p_handle, tAVCT_CC *p_cc,
|
||||
BD_ADDR peer_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_RemoveConn
|
||||
**
|
||||
** Description Remove an AVCTP connection. This function is called when
|
||||
** the application is no longer using a connection. If this
|
||||
** is the last connection to a peer the L2CAP channel for AVCTP
|
||||
** will be closed.
|
||||
**
|
||||
**
|
||||
** Returns AVCT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_RemoveConn(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_CreateBrowse
|
||||
**
|
||||
** Description Create an AVCTP connection. There are two types of
|
||||
** connections, initiator and acceptor, as determined by
|
||||
** the p_cc->role parameter. When this function is called to
|
||||
** create an initiator connection, an AVCTP connection to
|
||||
** the peer device is initiated if one does not already exist.
|
||||
** If an acceptor connection is created, the connection waits
|
||||
** passively for an incoming AVCTP connection from a peer device.
|
||||
**
|
||||
**
|
||||
** Returns AVCT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_CreateBrowse(UINT8 handle, UINT8 role);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_RemoveBrowse
|
||||
**
|
||||
** Description Remove an AVCTP connection. This function is called when
|
||||
** the application is no longer using a connection. If this
|
||||
** is the last connection to a peer the L2CAP channel for AVCTP
|
||||
** will be closed.
|
||||
**
|
||||
**
|
||||
** Returns AVCT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_RemoveBrowse(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_GetBrowseMtu
|
||||
**
|
||||
** Description Get the peer_mtu for the AVCTP Browse channel of the given
|
||||
** connection.
|
||||
**
|
||||
** Returns the peer browsing channel MTU.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_GetBrowseMtu (UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_GetPeerMtu
|
||||
**
|
||||
** Description Get the peer_mtu for the AVCTP channel of the given
|
||||
** connection.
|
||||
**
|
||||
** Returns the peer MTU size.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_GetPeerMtu (UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVCT_MsgReq
|
||||
**
|
||||
** Description Send an AVCTP message to a peer device. In calling
|
||||
** AVCT_MsgReq(), the application should keep track of the
|
||||
** congestion state of AVCTP as communicated with events
|
||||
** AVCT_CONG_IND_EVT and AVCT_UNCONG_IND_EVT. If the
|
||||
** application calls AVCT_MsgReq() when AVCTP is congested
|
||||
** the message may be discarded. The application may make its
|
||||
** first call to AVCT_MsgReq() after it receives an
|
||||
** AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control channel or
|
||||
** AVCT_BROWSE_CONN_CFM_EVT or AVCT_BROWSE_CONN_IND_EVT on browsing channel.
|
||||
**
|
||||
** p_msg->layer_specific must be set to
|
||||
** AVCT_DATA_CTRL for control channel traffic;
|
||||
** AVCT_DATA_BROWSE for for browse channel traffic.
|
||||
**
|
||||
** Returns AVCT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* AVCT_API_H */
|
988
tools/sdk/include/bluedroid/stack/avdt_api.h
Normal file
988
tools/sdk/include/bluedroid/stack/avdt_api.h
Normal file
@ -0,0 +1,988 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This interface file contains the interface to the Audio Video
|
||||
* Distribution Transport Protocol (AVDTP).
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef AVDT_API_H
|
||||
#define AVDT_API_H
|
||||
|
||||
#include "stack/bt_types.h"
|
||||
#include "common/bt_target.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
#ifndef AVDT_VERSION
|
||||
#define AVDT_VERSION 0x0102
|
||||
#endif
|
||||
#define AVDT_VERSION_SYNC 0x0103
|
||||
|
||||
/* API function return value result codes. */
|
||||
#define AVDT_SUCCESS 0 /* Function successful */
|
||||
#define AVDT_BAD_PARAMS 1 /* Invalid parameters */
|
||||
#define AVDT_NO_RESOURCES 2 /* Not enough resources */
|
||||
#define AVDT_BAD_HANDLE 3 /* Bad handle */
|
||||
#define AVDT_BUSY 4 /* A procedure is already in progress */
|
||||
#define AVDT_WRITE_FAIL 5 /* Write failed */
|
||||
|
||||
/* The index to access the codec type in codec_info[]. */
|
||||
#define AVDT_CODEC_TYPE_INDEX 2
|
||||
|
||||
/* The size in bytes of a Adaptation Layer header. */
|
||||
#define AVDT_AL_HDR_SIZE 3
|
||||
|
||||
/* The size in bytes of a media packet header. */
|
||||
#define AVDT_MEDIA_HDR_SIZE 12
|
||||
|
||||
/* AVDTP 7.5.3 Adaptation Layer Fragmentation
|
||||
* original length of the un-fragmented transport packet should be specified by
|
||||
* two bytes length field of Adaptation Layer Header */
|
||||
#define AVDT_MAX_MEDIA_SIZE (0xFFFF - AVDT_MEDIA_HDR_SIZE)
|
||||
|
||||
/* The handle is used when reporting MULTI_AV specific events */
|
||||
#define AVDT_MULTI_AV_HANDLE 0xFF
|
||||
|
||||
/* The number of bytes needed by the protocol stack for the protocol headers
|
||||
** of a media packet. This is the size of the media packet header, the
|
||||
** L2CAP packet header and HCI header.
|
||||
*/
|
||||
#define AVDT_MEDIA_OFFSET 23
|
||||
|
||||
/* The marker bit is used by the application to mark significant events such
|
||||
** as frame boundaries in the data stream. This constant is used to check or
|
||||
** set the marker bit in the m_pt parameter of an AVDT_WriteReq()
|
||||
** or AVDT_DATA_IND_EVT.
|
||||
*/
|
||||
#define AVDT_MARKER_SET 0x80
|
||||
|
||||
/* SEP Type. This indicates the stream endpoint type. */
|
||||
#define AVDT_TSEP_SRC 0 /* Source SEP */
|
||||
#define AVDT_TSEP_SNK 1 /* Sink SEP */
|
||||
|
||||
/* initiator/acceptor role for adaption */
|
||||
#define AVDT_INT 0 /* initiator */
|
||||
#define AVDT_ACP 1 /* acceptor */
|
||||
|
||||
/* Media Type. This indicates the media type of the stream endpoint. */
|
||||
#define AVDT_MEDIA_AUDIO 0 /* Audio SEP */
|
||||
#define AVDT_MEDIA_VIDEO 1 /* Video SEP */
|
||||
#define AVDT_MEDIA_MULTI 2 /* Multimedia SEP */
|
||||
|
||||
/* for reporting packets */
|
||||
#define AVDT_RTCP_PT_SR 200 /* the packet type - SR (Sender Report) */
|
||||
#define AVDT_RTCP_PT_RR 201 /* the packet type - RR (Receiver Report) */
|
||||
#define AVDT_RTCP_PT_SDES 202 /* the packet type - SDES (Source Description) */
|
||||
typedef UINT8 AVDT_REPORT_TYPE;
|
||||
|
||||
#define AVDT_RTCP_SDES_CNAME 1 /* SDES item CNAME */
|
||||
#ifndef AVDT_MAX_CNAME_SIZE
|
||||
#define AVDT_MAX_CNAME_SIZE 28
|
||||
#endif
|
||||
|
||||
/* Protocol service capabilities. This indicates the protocol service
|
||||
** capabilities of a stream endpoint. This value is a mask.
|
||||
** Multiple values can be combined with a bitwise OR.
|
||||
*/
|
||||
#define AVDT_PSC_TRANS (1<<1) /* Media transport */
|
||||
#define AVDT_PSC_REPORT (1<<2) /* Reporting */
|
||||
#define AVDT_PSC_RECOV (1<<3) /* Recovery */
|
||||
#define AVDT_PSC_HDRCMP (1<<5) /* Header compression */
|
||||
#define AVDT_PSC_MUX (1<<6) /* Multiplexing */
|
||||
#define AVDT_PSC_DELAY_RPT (1<<8) /* Delay Report */
|
||||
|
||||
/* Recovery type. This indicates the recovery type. */
|
||||
#define AVDT_RECOV_RFC2733 1 /* RFC2733 recovery */
|
||||
|
||||
/* Header compression capabilities. This indicates the header compression
|
||||
** capabilities. This value is a mask. Multiple values can be combined
|
||||
** with a bitwise OR.
|
||||
*/
|
||||
#define AVDT_HDRCMP_MEDIA (1<<5) /* Available for media packets */
|
||||
#define AVDT_HDRCMP_RECOV (1<<6) /* Available for recovery packets */
|
||||
#define AVDT_HDRCMP_BACKCH (1<<7) /* Back channel supported */
|
||||
|
||||
/* Multiplexing capabilities mask. */
|
||||
#define AVDT_MUX_FRAG (1<<7) /* Allow Adaptation Layer Fragmentation */
|
||||
|
||||
/* Application service category. This indicates the application
|
||||
** service category.
|
||||
*/
|
||||
#define AVDT_ASC_PROTECT 4 /* Content protection */
|
||||
#define AVDT_ASC_CODEC 7 /* Codec */
|
||||
|
||||
/* Error codes. The following are error codes defined in the AVDTP and GAVDP
|
||||
** specifications. These error codes communicate protocol errors between
|
||||
** AVDTP and the application. More detailed descriptions of the error codes
|
||||
** and their appropriate use can be found in the AVDTP and GAVDP specifications.
|
||||
** These error codes are unrelated to the result values returned by the
|
||||
** AVDTP API functions.
|
||||
*/
|
||||
#define AVDT_ERR_HEADER 0x01 /* Bad packet header format */
|
||||
#define AVDT_ERR_LENGTH 0x11 /* Bad packet length */
|
||||
#define AVDT_ERR_SEID 0x12 /* Invalid SEID */
|
||||
#define AVDT_ERR_IN_USE 0x13 /* The SEP is in use */
|
||||
#define AVDT_ERR_NOT_IN_USE 0x14 /* The SEP is not in use */
|
||||
#define AVDT_ERR_CATEGORY 0x17 /* Bad service category */
|
||||
#define AVDT_ERR_PAYLOAD 0x18 /* Bad payload format */
|
||||
#define AVDT_ERR_NSC 0x19 /* Requested command not supported */
|
||||
#define AVDT_ERR_INVALID_CAP 0x1A /* Reconfigure attempted invalid capabilities */
|
||||
#define AVDT_ERR_RECOV_TYPE 0x22 /* Requested recovery type not defined */
|
||||
#define AVDT_ERR_MEDIA_TRANS 0x23 /* Media transport capability not correct */
|
||||
#define AVDT_ERR_RECOV_FMT 0x25 /* Recovery service capability not correct */
|
||||
#define AVDT_ERR_ROHC_FMT 0x26 /* Header compression service capability not correct */
|
||||
#define AVDT_ERR_CP_FMT 0x27 /* Content protection service capability not correct */
|
||||
#define AVDT_ERR_MUX_FMT 0x28 /* Multiplexing service capability not correct */
|
||||
#define AVDT_ERR_UNSUP_CFG 0x29 /* Configuration not supported */
|
||||
#define AVDT_ERR_BAD_STATE 0x31 /* Message cannot be processed in this state */
|
||||
#define AVDT_ERR_REPORT_FMT 0x65 /* Report service capability not correct */
|
||||
#define AVDT_ERR_SERVICE 0x80 /* Invalid service category */
|
||||
#define AVDT_ERR_RESOURCE 0x81 /* Insufficient resources */
|
||||
#define AVDT_ERR_INVALID_MCT 0xC1 /* Invalid Media Codec Type */
|
||||
#define AVDT_ERR_UNSUP_MCT 0xC2 /* Unsupported Media Codec Type */
|
||||
#define AVDT_ERR_INVALID_LEVEL 0xC3 /* Invalid Level */
|
||||
#define AVDT_ERR_UNSUP_LEVEL 0xC4 /* Unsupported Level */
|
||||
#define AVDT_ERR_INVALID_CP 0xE0 /* Invalid Content Protection Type */
|
||||
#define AVDT_ERR_INVALID_FORMAT 0xE1 /* Invalid Content Protection format */
|
||||
|
||||
/* Additional error codes. This indicates error codes used by AVDTP
|
||||
** in addition to the ones defined in the specifications.
|
||||
*/
|
||||
#define AVDT_ERR_CONNECT 0x07 /* Connection failed. */
|
||||
#define AVDT_ERR_TIMEOUT 0x08 /* Response timeout. */
|
||||
|
||||
/* Control callback events. */
|
||||
#define AVDT_DISCOVER_CFM_EVT 0 /* Discover confirm */
|
||||
#define AVDT_GETCAP_CFM_EVT 1 /* Get capabilities confirm */
|
||||
#define AVDT_OPEN_CFM_EVT 2 /* Open confirm */
|
||||
#define AVDT_OPEN_IND_EVT 3 /* Open indication */
|
||||
#define AVDT_CONFIG_IND_EVT 4 /* Configuration indication */
|
||||
#define AVDT_START_CFM_EVT 5 /* Start confirm */
|
||||
#define AVDT_START_IND_EVT 6 /* Start indication */
|
||||
#define AVDT_SUSPEND_CFM_EVT 7 /* Suspend confirm */
|
||||
#define AVDT_SUSPEND_IND_EVT 8 /* Suspend indication */
|
||||
#define AVDT_CLOSE_CFM_EVT 9 /* Close confirm */
|
||||
#define AVDT_CLOSE_IND_EVT 10 /* Close indication */
|
||||
#define AVDT_RECONFIG_CFM_EVT 11 /* Reconfiguration confirm */
|
||||
#define AVDT_RECONFIG_IND_EVT 12 /* Reconfiguration indication */
|
||||
#define AVDT_SECURITY_CFM_EVT 13 /* Security confirm */
|
||||
#define AVDT_SECURITY_IND_EVT 14 /* Security indication */
|
||||
#define AVDT_WRITE_CFM_EVT 15 /* Write confirm */
|
||||
#define AVDT_CONNECT_IND_EVT 16 /* Signaling channel connected */
|
||||
#define AVDT_DISCONNECT_IND_EVT 17 /* Signaling channel disconnected */
|
||||
#define AVDT_REPORT_CONN_EVT 18 /* Reporting channel connected */
|
||||
#define AVDT_REPORT_DISCONN_EVT 19 /* Reporting channel disconnected */
|
||||
#define AVDT_DELAY_REPORT_EVT 20 /* Delay report received */
|
||||
#define AVDT_DELAY_REPORT_CFM_EVT 21 /* Delay report response received */
|
||||
|
||||
#define AVDT_MAX_EVT (AVDT_DELAY_REPORT_CFM_EVT)
|
||||
|
||||
/* PSM for AVDT */
|
||||
#define AVDT_PSM 0x0019
|
||||
|
||||
/* Nonsupported protocol command messages. This value is used in tAVDT_CS */
|
||||
#define AVDT_NSC_SUSPEND 0x01 /* Suspend command not supported */
|
||||
#define AVDT_NSC_RECONFIG 0x02 /* Reconfigure command not supported */
|
||||
#define AVDT_NSC_SECURITY 0x04 /* Security command not supported */
|
||||
|
||||
/* AVDT disconnection reason */
|
||||
#define AVDT_DISC_RSN_NORMAL 0
|
||||
#define AVDT_DISC_RSN_ABNORMAL (0xce) /* unintentional disconnection */
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
UINT32 ntp_sec; /* NTP time: seconds relative to 0h UTC on 1 January 1900 */
|
||||
UINT32 ntp_frac; /* NTP time: the fractional part */
|
||||
UINT32 rtp_time; /* timestamp in RTP header */
|
||||
UINT32 pkt_count; /* sender's packet count: since starting transmission
|
||||
* up until the time this SR packet was generated. */
|
||||
UINT32 octet_count; /* sender's octet count: same comment */
|
||||
} tAVDT_SENDER_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT8 frag_lost; /* fraction lost since last RR */
|
||||
UINT32 packet_lost; /* cumulative number of packets lost since the beginning */
|
||||
UINT32 seq_num_rcvd; /* extended highest sequence number received */
|
||||
UINT32 jitter; /* interarrival jitter */
|
||||
UINT32 lsr; /* last SR timestamp */
|
||||
UINT32 dlsr; /* delay since last SR */
|
||||
} tAVDT_REPORT_BLK;
|
||||
|
||||
typedef union {
|
||||
tAVDT_SENDER_INFO sr;
|
||||
tAVDT_REPORT_BLK rr;
|
||||
UINT8 cname[AVDT_MAX_CNAME_SIZE + 1];
|
||||
} tAVDT_REPORT_DATA;
|
||||
|
||||
/* This structure contains parameters which are set at registration. */
|
||||
typedef struct {
|
||||
UINT16 ctrl_mtu; /* L2CAP MTU of the AVDTP signaling channel */
|
||||
UINT8 ret_tout; /* AVDTP signaling retransmission timeout */
|
||||
UINT8 sig_tout; /* AVDTP signaling message timeout */
|
||||
UINT8 idle_tout; /* AVDTP idle signaling channel timeout */
|
||||
UINT8 sec_mask; /* Security mask for BTM_SetSecurityLevel() */
|
||||
} tAVDT_REG;
|
||||
|
||||
/* This structure contains the SEP information. This information is
|
||||
** transferred during the discovery procedure.
|
||||
*/
|
||||
typedef struct {
|
||||
BOOLEAN in_use; /* TRUE if stream is currently in use */
|
||||
UINT8 seid; /* Stream endpoint identifier */
|
||||
UINT8 media_type; /* Media type */
|
||||
UINT8 tsep; /* SEP type */
|
||||
} tAVDT_SEP_INFO;
|
||||
|
||||
/* This structure contains the SEP configuration. */
|
||||
typedef struct {
|
||||
UINT8 codec_info[AVDT_CODEC_SIZE]; /* Codec capabilities array */
|
||||
UINT8 protect_info[AVDT_PROTECT_SIZE]; /* Content protection capabilities */
|
||||
UINT8 num_codec; /* Number of media codec information elements */
|
||||
UINT8 num_protect; /* Number of content protection information elements */
|
||||
UINT16 psc_mask; /* Protocol service capabilities mask */
|
||||
UINT8 recov_type; /* Recovery type */
|
||||
UINT8 recov_mrws; /* Maximum recovery window size */
|
||||
UINT8 recov_mnmp; /* Recovery maximum number of media packets */
|
||||
UINT8 hdrcmp_mask; /* Header compression capabilities */
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
UINT8 mux_mask; /* Multiplexing capabilities. AVDT_MUX_XXX bits can be combined with a bitwise OR */
|
||||
UINT8 mux_tsid_media; /* TSID for media transport session */
|
||||
UINT8 mux_tcid_media; /* TCID for media transport session */
|
||||
UINT8 mux_tsid_report; /* TSID for reporting transport session */
|
||||
UINT8 mux_tcid_report; /* TCID for reporting transport session */
|
||||
UINT8 mux_tsid_recov; /* TSID for recovery transport session */
|
||||
UINT8 mux_tcid_recov; /* TCID for recovery transport session */
|
||||
#endif
|
||||
} tAVDT_CFG;
|
||||
|
||||
/* Header structure for callback event parameters. */
|
||||
typedef struct {
|
||||
UINT8 err_code; /* Zero if operation succeeded; nonzero if operation failed */
|
||||
UINT8 err_param; /* Error parameter included for some events */
|
||||
UINT8 label; /* Transaction label */
|
||||
UINT8 seid; /* For internal use only */
|
||||
UINT8 sig_id; /* For internal use only */
|
||||
UINT8 ccb_idx; /* For internal use only */
|
||||
} tAVDT_EVT_HDR;
|
||||
|
||||
/* This data structure is associated with the AVDT_GETCAP_CFM_EVT,
|
||||
** AVDT_RECONFIG_IND_EVT, and AVDT_RECONFIG_CFM_EVT.
|
||||
*/
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
tAVDT_CFG *p_cfg; /* Pointer to configuration for this SEP */
|
||||
} tAVDT_CONFIG;
|
||||
|
||||
/* This data structure is associated with the AVDT_CONFIG_IND_EVT. */
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
tAVDT_CFG *p_cfg; /* Pointer to configuration for this SEP */
|
||||
UINT8 int_seid; /* Stream endpoint ID of stream initiating the operation */
|
||||
} tAVDT_SETCONFIG;
|
||||
|
||||
/* This data structure is associated with the AVDT_OPEN_IND_EVT and AVDT_OPEN_CFM_EVT. */
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
UINT16 peer_mtu; /* Transport channel L2CAP MTU of the peer */
|
||||
UINT16 lcid; /* L2CAP LCID for media channel */
|
||||
} tAVDT_OPEN;
|
||||
|
||||
/* This data structure is associated with the AVDT_SECURITY_IND_EVT
|
||||
** and AVDT_SECURITY_CFM_EVT.
|
||||
*/
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
UINT8 *p_data; /* Pointer to security data */
|
||||
UINT16 len; /* Length in bytes of the security data */
|
||||
} tAVDT_SECURITY;
|
||||
|
||||
/* This data structure is associated with the AVDT_DISCOVER_CFM_EVT. */
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
tAVDT_SEP_INFO *p_sep_info; /* Pointer to SEP information */
|
||||
UINT8 num_seps; /* Number of stream endpoints */
|
||||
} tAVDT_DISCOVER;
|
||||
|
||||
/* This data structure is associated with the AVDT_DELAY_REPORT_EVT. */
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
UINT16 delay; /* Delay value */
|
||||
} tAVDT_DELAY_RPT;
|
||||
|
||||
/* Union of all control callback event data structures */
|
||||
typedef union {
|
||||
tAVDT_EVT_HDR hdr;
|
||||
tAVDT_DISCOVER discover_cfm;
|
||||
tAVDT_CONFIG getcap_cfm;
|
||||
tAVDT_OPEN open_cfm;
|
||||
tAVDT_OPEN open_ind;
|
||||
tAVDT_SETCONFIG config_ind;
|
||||
tAVDT_EVT_HDR start_cfm;
|
||||
tAVDT_EVT_HDR suspend_cfm;
|
||||
tAVDT_EVT_HDR close_cfm;
|
||||
tAVDT_CONFIG reconfig_cfm;
|
||||
tAVDT_CONFIG reconfig_ind;
|
||||
tAVDT_SECURITY security_cfm;
|
||||
tAVDT_SECURITY security_ind;
|
||||
tAVDT_EVT_HDR connect_ind;
|
||||
tAVDT_EVT_HDR disconnect_ind;
|
||||
tAVDT_EVT_HDR report_conn;
|
||||
tAVDT_DELAY_RPT delay_rpt_cmd;
|
||||
} tAVDT_CTRL;
|
||||
|
||||
/* This is the control callback function. This function passes control events
|
||||
** to the application. This function is required for all registered stream
|
||||
** endpoints and for the AVDT_DiscoverReq() and AVDT_GetCapReq() functions.
|
||||
**
|
||||
*/
|
||||
typedef void (tAVDT_CTRL_CBACK)(UINT8 handle, BD_ADDR bd_addr, UINT8 event,
|
||||
tAVDT_CTRL *p_data);
|
||||
|
||||
/* This is the data callback function. It is executed when AVDTP has a media
|
||||
** packet ready for the application. This function is required for SNK
|
||||
** endpoints and not applicable for SRC endpoints.
|
||||
*/
|
||||
typedef void (tAVDT_DATA_CBACK)(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
|
||||
UINT8 m_pt);
|
||||
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
/* This is the second version of the data callback function. This version uses
|
||||
** application buffer assigned by AVDT_SetMediaBuf. Caller can assign different
|
||||
** buffer during callback or can leave the current buffer for further using.
|
||||
** This callback is called when AVDTP has a media packet ready for the application.
|
||||
** This function is required for SNK endpoints and not applicable for SRC endpoints.
|
||||
*/
|
||||
typedef void (tAVDT_MEDIA_CBACK)(UINT8 handle, UINT8 *p_payload, UINT32 payload_len,
|
||||
UINT32 time_stamp, UINT16 seq_num, UINT8 m_pt, UINT8 marker);
|
||||
#endif
|
||||
|
||||
#if AVDT_REPORTING == TRUE
|
||||
/* This is the report callback function. It is executed when AVDTP has a reporting
|
||||
** packet ready for the application. This function is required for streams
|
||||
** created with AVDT_PSC_REPORT.
|
||||
*/
|
||||
typedef void (tAVDT_REPORT_CBACK)(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
tAVDT_REPORT_DATA *p_data);
|
||||
#endif
|
||||
|
||||
typedef UINT16 (tAVDT_GETCAP_REQ) (BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg, tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/* This structure contains information required when a stream is created.
|
||||
** It is passed to the AVDT_CreateStream() function.
|
||||
*/
|
||||
typedef struct {
|
||||
tAVDT_CFG cfg; /* SEP configuration */
|
||||
tAVDT_CTRL_CBACK *p_ctrl_cback; /* Control callback function */
|
||||
tAVDT_DATA_CBACK *p_data_cback; /* Data callback function */
|
||||
#if AVDT_MULTIPLEXING == TRUE
|
||||
tAVDT_MEDIA_CBACK *p_media_cback; /* Media callback function. It will be called only if p_data_cback is NULL */
|
||||
#endif
|
||||
#if AVDT_REPORTING == TRUE
|
||||
tAVDT_REPORT_CBACK *p_report_cback;/* Report callback function. */
|
||||
#endif
|
||||
UINT16 mtu; /* The L2CAP MTU of the transport channel */
|
||||
UINT16 flush_to; /* The L2CAP flush timeout of the transport channel */
|
||||
UINT8 tsep; /* SEP type */
|
||||
UINT8 media_type; /* Media type */
|
||||
UINT16 nsc_mask; /* Nonsupported protocol command messages */
|
||||
} tAVDT_CS;
|
||||
|
||||
/* AVDT data option mask is used in the write request */
|
||||
#define AVDT_DATA_OPT_NONE 0x00 /* No option still add RTP header */
|
||||
#define AVDT_DATA_OPT_NO_RTP (0x01 << 0) /* Skip adding RTP header */
|
||||
|
||||
typedef UINT8 tAVDT_DATA_OPT_MASK;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_Register
|
||||
**
|
||||
** Description This is the system level registration function for the
|
||||
** AVDTP protocol. This function initializes AVDTP and
|
||||
** prepares the protocol stack for its use. This function
|
||||
** must be called once by the system or platform using AVDTP
|
||||
** before the other functions of the API an be used.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDT_Register(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_Deregister
|
||||
**
|
||||
** Description This function is called to deregister use AVDTP protocol.
|
||||
** It is called when AVDTP is no longer being used by any
|
||||
** application in the system. Before this function can be
|
||||
** called, all streams must be removed with AVDT_RemoveStream().
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDT_Deregister(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SINK_Activate
|
||||
**
|
||||
** Description Activate SEP of A2DP Sink. In Use parameter is adjusted.
|
||||
** In Use will be made false in case of activation. A2DP SRC
|
||||
** will receive in_use as false and can open A2DP Sink
|
||||
** connection
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDT_SINK_Activate(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SINK_Deactivate
|
||||
**
|
||||
** Description Deactivate SEP of A2DP Sink. In Use parameter is adjusted.
|
||||
** In Use will be made TRUE in case of activation. A2DP SRC
|
||||
** will receive in_use as true and will not open A2DP Sink
|
||||
** connection
|
||||
**
|
||||
** Returns void.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDT_SINK_Deactivate(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_AbortReq
|
||||
**
|
||||
** Description Trigger Abort request to pass AVDTP Abort related mandatory
|
||||
** PTS Test case.
|
||||
**
|
||||
** Returns void.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDT_AbortReq(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_CreateStream
|
||||
**
|
||||
** Description Create a stream endpoint. After a stream endpoint is
|
||||
** created an application can initiate a connection between
|
||||
** this endpoint and an endpoint on a peer device. In
|
||||
** addition, a peer device can discover, get the capabilities,
|
||||
** and connect to this endpoint.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_CreateStream(UINT8 *p_handle, tAVDT_CS *p_cs);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_RemoveStream
|
||||
**
|
||||
** Description Remove a stream endpoint. This function is called when
|
||||
** the application is no longer using a stream endpoint.
|
||||
** If this function is called when the endpoint is connected
|
||||
** the connection is closed and then the stream endpoint
|
||||
** is removed.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_RemoveStream(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_DiscoverReq
|
||||
**
|
||||
** Description This function initiates a connection to the AVDTP service
|
||||
** on the peer device, if not already present, and discovers
|
||||
** the stream endpoints on the peer device. (Please note
|
||||
** that AVDTP discovery is unrelated to SDP discovery).
|
||||
** This function can be called at any time regardless of whether
|
||||
** there is an AVDTP connection to the peer device.
|
||||
**
|
||||
** When discovery is complete, an AVDT_DISCOVER_CFM_EVT
|
||||
** is sent to the application via its callback function.
|
||||
** The application must not call AVDT_GetCapReq() or
|
||||
** AVDT_DiscoverReq() again to the same device until
|
||||
** discovery is complete.
|
||||
**
|
||||
** The memory addressed by sep_info is allocated by the
|
||||
** application. This memory is written to by AVDTP as part
|
||||
** of the discovery procedure. This memory must remain
|
||||
** accessible until the application receives the
|
||||
** AVDT_DISCOVER_CFM_EVT.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_DiscoverReq(BD_ADDR bd_addr, tAVDT_SEP_INFO *p_sep_info,
|
||||
UINT8 max_seps, tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_GetCapReq
|
||||
**
|
||||
** Description This function initiates a connection to the AVDTP service
|
||||
** on the peer device, if not already present, and gets the
|
||||
** capabilities of a stream endpoint on the peer device.
|
||||
** This function can be called at any time regardless of
|
||||
** whether there is an AVDTP connection to the peer device.
|
||||
**
|
||||
** When the procedure is complete, an AVDT_GETCAP_CFM_EVT is
|
||||
** sent to the application via its callback function. The
|
||||
** application must not call AVDT_GetCapReq() or
|
||||
** AVDT_DiscoverReq() again until the procedure is complete.
|
||||
**
|
||||
** The memory pointed to by p_cfg is allocated by the
|
||||
** application. This memory is written to by AVDTP as part
|
||||
** of the get capabilities procedure. This memory must
|
||||
** remain accessible until the application receives
|
||||
** the AVDT_GETCAP_CFM_EVT.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_GetCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg,
|
||||
tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_GetAllCapReq
|
||||
**
|
||||
** Description This function initiates a connection to the AVDTP service
|
||||
** on the peer device, if not already present, and gets the
|
||||
** capabilities of a stream endpoint on the peer device.
|
||||
** This function can be called at any time regardless of
|
||||
** whether there is an AVDTP connection to the peer device.
|
||||
**
|
||||
** When the procedure is complete, an AVDT_GETCAP_CFM_EVT is
|
||||
** sent to the application via its callback function. The
|
||||
** application must not call AVDT_GetCapReq() or
|
||||
** AVDT_DiscoverReq() again until the procedure is complete.
|
||||
**
|
||||
** The memory pointed to by p_cfg is allocated by the
|
||||
** application. This memory is written to by AVDTP as part
|
||||
** of the get capabilities procedure. This memory must
|
||||
** remain accessible until the application receives
|
||||
** the AVDT_GETCAP_CFM_EVT.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_GetAllCapReq(BD_ADDR bd_addr, UINT8 seid, tAVDT_CFG *p_cfg,
|
||||
tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_DelayReport
|
||||
**
|
||||
** Description This functions sends a Delay Report to the peer device
|
||||
** that is associated with a particular SEID.
|
||||
** This function is called by SNK device.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_DelayReport(UINT8 handle, UINT8 seid, UINT16 delay);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_OpenReq
|
||||
**
|
||||
** Description This function initiates a connection to the AVDTP service
|
||||
** on the peer device, if not already present, and connects
|
||||
** to a stream endpoint on a peer device. When the connection
|
||||
** is completed, an AVDT_OPEN_CFM_EVT is sent to the
|
||||
** application via the control callback function for this handle.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_OpenReq(UINT8 handle, BD_ADDR bd_addr, UINT8 seid,
|
||||
tAVDT_CFG *p_cfg);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_ConfigRsp
|
||||
**
|
||||
** Description Respond to a configure request from the peer device. This
|
||||
** function must be called if the application receives an
|
||||
** AVDT_CONFIG_IND_EVT through its control callback.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_ConfigRsp(UINT8 handle, UINT8 label, UINT8 error_code,
|
||||
UINT8 category);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_StartReq
|
||||
**
|
||||
** Description Start one or more stream endpoints. This initiates the
|
||||
** transfer of media packets for the streams. All stream
|
||||
** endpoints must previously be opened. When the streams
|
||||
** are started, an AVDT_START_CFM_EVT is sent to the
|
||||
** application via the control callback function for each stream.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_StartReq(UINT8 *p_handles, UINT8 num_handles);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SuspendReq
|
||||
**
|
||||
** Description Suspend one or more stream endpoints. This suspends the
|
||||
** transfer of media packets for the streams. All stream
|
||||
** endpoints must previously be open and started. When the
|
||||
** streams are suspended, an AVDT_SUSPEND_CFM_EVT is sent to
|
||||
** the application via the control callback function for
|
||||
** each stream.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_SuspendReq(UINT8 *p_handles, UINT8 num_handles);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_CloseReq
|
||||
**
|
||||
** Description Close a stream endpoint. This stops the transfer of media
|
||||
** packets and closes the transport channel associated with
|
||||
** this stream endpoint. When the stream is closed, an
|
||||
** AVDT_CLOSE_CFM_EVT is sent to the application via the
|
||||
** control callback function for this handle.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_CloseReq(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_ReconfigReq
|
||||
**
|
||||
** Description Reconfigure a stream endpoint. This allows the application
|
||||
** to change the codec or content protection capabilities of
|
||||
** a stream endpoint after it has been opened. This function
|
||||
** can only be called if the stream is opened but not started
|
||||
** or if the stream has been suspended. When the procedure
|
||||
** is completed, an AVDT_RECONFIG_CFM_EVT is sent to the
|
||||
** application via the control callback function for this handle.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_ReconfigReq(UINT8 handle, tAVDT_CFG *p_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_ReconfigRsp
|
||||
**
|
||||
** Description Respond to a reconfigure request from the peer device.
|
||||
** This function must be called if the application receives
|
||||
** an AVDT_RECONFIG_IND_EVT through its control callback.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_ReconfigRsp(UINT8 handle, UINT8 label, UINT8 error_code,
|
||||
UINT8 category);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SecurityReq
|
||||
**
|
||||
** Description Send a security request to the peer device. When the
|
||||
** security procedure is completed, an AVDT_SECURITY_CFM_EVT
|
||||
** is sent to the application via the control callback function
|
||||
** for this handle. (Please note that AVDTP security procedures
|
||||
** are unrelated to Bluetooth link level security.)
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_SecurityReq(UINT8 handle, UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SecurityRsp
|
||||
**
|
||||
** Description Respond to a security request from the peer device.
|
||||
** This function must be called if the application receives
|
||||
** an AVDT_SECURITY_IND_EVT through its control callback.
|
||||
** (Please note that AVDTP security procedures are unrelated
|
||||
** to Bluetooth link level security.)
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_SecurityRsp(UINT8 handle, UINT8 label, UINT8 error_code,
|
||||
UINT8 *p_data, UINT16 len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_WriteReq
|
||||
**
|
||||
** Description Send a media packet to the peer device. The stream must
|
||||
** be started before this function is called. Also, this
|
||||
** function can only be called if the stream is a SRC.
|
||||
**
|
||||
** When AVDTP has sent the media packet and is ready for the
|
||||
** next packet, an AVDT_WRITE_CFM_EVT is sent to the
|
||||
** application via the control callback. The application must
|
||||
** wait for the AVDT_WRITE_CFM_EVT before it makes the next
|
||||
** call to AVDT_WriteReq(). If the applications calls
|
||||
** AVDT_WriteReq() before it receives the event the packet
|
||||
** will not be sent. The application may make its first call
|
||||
** to AVDT_WriteReq() after it receives an AVDT_START_CFM_EVT
|
||||
** or AVDT_START_IND_EVT.
|
||||
**
|
||||
** The application passes the packet using the BT_HDR structure.
|
||||
** This structure is described in section 2.1. The offset
|
||||
** field must be equal to or greater than AVDT_MEDIA_OFFSET.
|
||||
** This allows enough space in the buffer for the L2CAP and
|
||||
** AVDTP headers.
|
||||
**
|
||||
** The memory pointed to by p_pkt must be a GKI buffer
|
||||
** allocated by the application. This buffer will be freed
|
||||
** by the protocol stack; the application must not free
|
||||
** this buffer.
|
||||
**
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_WriteReq(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
|
||||
UINT8 m_pt);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_WriteReqOpt
|
||||
**
|
||||
** Description Send a media packet to the peer device. The stream must
|
||||
** be started before this function is called. Also, this
|
||||
** function can only be called if the stream is a SRC
|
||||
**
|
||||
** When AVDTP has sent the media packet and is ready for the
|
||||
** next packet, an AVDT_WRITE_CFM_EVT is sent to the
|
||||
** application via the control callback. The application must
|
||||
** wait for the AVDT_WRITE_CFM_EVT before it makes the next
|
||||
** call to AVDT_WriteReq(). If the applications calls
|
||||
** AVDT_WriteReq() before it receives the event the packet
|
||||
** will not be sent. The application may make its first call
|
||||
** to AVDT_WriteReq() after it receives an AVDT_START_CFM_EVT
|
||||
** or AVDT_START_IND_EVT.
|
||||
**
|
||||
** The application passes the packet using the BT_HDR structure
|
||||
** This structure is described in section 2.1. The offset
|
||||
** field must be equal to or greater than AVDT_MEDIA_OFFSET
|
||||
** (if NO_RTP is specified, L2CAP_MIN_OFFSET can be used)
|
||||
** This allows enough space in the buffer for the L2CAP and
|
||||
** AVDTP headers.
|
||||
**
|
||||
** The memory pointed to by p_pkt must be a GKI buffer
|
||||
** allocated by the application. This buffer will be freed
|
||||
** by the protocol stack; the application must not free
|
||||
** this buffer.
|
||||
**
|
||||
** The opt parameter allows passing specific options like:
|
||||
** - NO_RTP : do not add the RTP header to buffer
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_WriteReqOpt(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp,
|
||||
UINT8 m_pt, tAVDT_DATA_OPT_MASK opt);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_ConnectReq
|
||||
**
|
||||
** Description This function initiates an AVDTP signaling connection
|
||||
** to the peer device. When the connection is completed, an
|
||||
** AVDT_CONNECT_IND_EVT is sent to the application via its
|
||||
** control callback function. If the connection attempt fails
|
||||
** an AVDT_DISCONNECT_IND_EVT is sent. The security mask
|
||||
** parameter overrides the outgoing security mask set in
|
||||
** AVDT_Register().
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_ConnectReq(BD_ADDR bd_addr, UINT8 sec_mask,
|
||||
tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_DisconnectReq
|
||||
**
|
||||
** Description This function disconnect an AVDTP signaling connection
|
||||
** to the peer device. When disconnected an
|
||||
** AVDT_DISCONNECT_IND_EVT is sent to the application via its
|
||||
** control callback function.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_DisconnectReq(BD_ADDR bd_addr, tAVDT_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_GetL2CapChannel
|
||||
**
|
||||
** Description Get the L2CAP CID used by the handle.
|
||||
**
|
||||
** Returns CID if successful, otherwise 0.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_GetL2CapChannel(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_GetSignalChannel
|
||||
**
|
||||
** Description Get the L2CAP CID used by the signal channel of the given handle.
|
||||
**
|
||||
** Returns CID if successful, otherwise 0.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_WriteDataReq
|
||||
**
|
||||
** Description Send a media packet to the peer device. The stream must
|
||||
** be started before this function is called. Also, this
|
||||
** function can only be called if the stream is a SRC.
|
||||
**
|
||||
** When AVDTP has sent the media packet and is ready for the
|
||||
** next packet, an AVDT_WRITE_CFM_EVT is sent to the
|
||||
** application via the control callback. The application must
|
||||
** wait for the AVDT_WRITE_CFM_EVT before it makes the next
|
||||
** call to AVDT_WriteDataReq(). If the applications calls
|
||||
** AVDT_WriteDataReq() before it receives the event the packet
|
||||
** will not be sent. The application may make its first call
|
||||
** to AVDT_WriteDataReq() after it receives an
|
||||
** AVDT_START_CFM_EVT or AVDT_START_IND_EVT.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
|
||||
UINT32 time_stamp, UINT8 m_pt, UINT8 marker);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SetMediaBuf
|
||||
**
|
||||
** Description Assigns buffer for media packets or forbids using of assigned
|
||||
** buffer if argument p_buf is NULL. This function can only
|
||||
** be called if the stream is a SNK.
|
||||
**
|
||||
** AVDTP uses this buffer to reassemble fragmented media packets.
|
||||
** When AVDTP receives a complete media packet, it calls the
|
||||
** p_media_cback assigned by AVDT_CreateStream().
|
||||
** This function can be called during callback to assign a
|
||||
** different buffer for next media packet or can leave the current
|
||||
** buffer for next packet.
|
||||
**
|
||||
** Returns AVDT_SUCCESS if successful, otherwise error.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_SetMediaBuf(UINT8 handle, UINT8 *p_buf, UINT32 buf_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDT_SendReport
|
||||
**
|
||||
** Description
|
||||
**
|
||||
**
|
||||
**
|
||||
** Returns
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 AVDT_SendReport(UINT8 handle, AVDT_REPORT_TYPE type,
|
||||
tAVDT_REPORT_DATA *p_data);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVDT_SetTraceLevel
|
||||
**
|
||||
** Description Sets the trace level for AVDT. If 0xff is passed, the
|
||||
** current trace level is returned.
|
||||
**
|
||||
** Input Parameters:
|
||||
** new_level: The level to set the AVDT tracing to:
|
||||
** 0xff-returns the current setting.
|
||||
** 0-turns off tracing.
|
||||
** >= 1-Errors.
|
||||
** >= 2-Warnings.
|
||||
** >= 3-APIs.
|
||||
** >= 4-Events.
|
||||
** >= 5-Debug.
|
||||
**
|
||||
** Returns The new trace level or current trace level if
|
||||
** the input parameter is 0xff.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT8 AVDT_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* AVDT_API_H */
|
230
tools/sdk/include/bluedroid/stack/avdtc_api.h
Normal file
230
tools/sdk/include/bluedroid/stack/avdtc_api.h
Normal file
@ -0,0 +1,230 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This interface file contains the interface AVDTP conformance API. These
|
||||
* additional API functions and callback events are provided for
|
||||
* conformance testing purposes only. They are not intended to be used by
|
||||
* an application.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef AVDT_CAPI_H
|
||||
#define AVDT_CAPI_H
|
||||
|
||||
#include "stack/avdt_api.h"
|
||||
|
||||
/* start AVDTC events here to distinguish from AVDT events */
|
||||
#define AVDTC_EVT_BEGIN 0x80
|
||||
|
||||
#define AVDTC_DISCOVER_IND_EVT (0 + AVDTC_EVT_BEGIN) /* Discover indication */
|
||||
#define AVDTC_GETCAP_IND_EVT (1 + AVDTC_EVT_BEGIN) /* Get capabilities indication */
|
||||
#define AVDTC_SETCONFIG_CFM_EVT (2 + AVDTC_EVT_BEGIN) /* Set configuration confirm */
|
||||
#define AVDTC_GETCONFIG_IND_EVT (3 + AVDTC_EVT_BEGIN) /* Get configuration indication */
|
||||
#define AVDTC_GETCONFIG_CFM_EVT (4 + AVDTC_EVT_BEGIN) /* Get configuration confirm */
|
||||
#define AVDTC_OPEN_IND_EVT (5 + AVDTC_EVT_BEGIN) /* Open indication */
|
||||
#define AVDTC_START_IND_EVT (6 + AVDTC_EVT_BEGIN) /* Start indication */
|
||||
#define AVDTC_CLOSE_IND_EVT (7 + AVDTC_EVT_BEGIN) /* Close indication */
|
||||
#define AVDTC_SUSPEND_IND_EVT (8 + AVDTC_EVT_BEGIN) /* Suspend indication */
|
||||
#define AVDTC_ABORT_IND_EVT (9 + AVDTC_EVT_BEGIN) /* Abort indication */
|
||||
#define AVDTC_ABORT_CFM_EVT (10 + AVDTC_EVT_BEGIN) /* Abort confirm */
|
||||
|
||||
typedef struct {
|
||||
tAVDT_EVT_HDR hdr; /* Event header */
|
||||
UINT8 seid_list[AVDT_NUM_SEPS]; /* Array of SEID values */
|
||||
UINT8 num_seps; /* Number of values in array */
|
||||
} tAVDT_MULTI;
|
||||
|
||||
/* Union of all control callback event data structures */
|
||||
typedef union {
|
||||
tAVDT_EVT_HDR hdr;
|
||||
tAVDT_CONFIG getconfig_cfm;
|
||||
tAVDT_MULTI start_ind;
|
||||
tAVDT_MULTI suspend_ind;
|
||||
} tAVDTC_CTRL;
|
||||
|
||||
typedef void tAVDTC_CTRL_CBACK(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDTC_CTRL *p_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_Init
|
||||
**
|
||||
** Description This function is called to begin using the conformance API.
|
||||
** It must be called after AVDT_Register() and before any
|
||||
** other API or conformance API functions are called.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_Init(tAVDTC_CTRL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_DiscoverRsp
|
||||
**
|
||||
** Description Send a discover response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_DiscoverRsp(BD_ADDR bd_addr, UINT8 label,
|
||||
tAVDT_SEP_INFO sep_info[], UINT8 num_seps);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_GetCapRsp
|
||||
**
|
||||
** Description Send a get capabilities response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_GetCapRsp(BD_ADDR bd_addr, UINT8 label, tAVDT_CFG *p_cap);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_GetAllCapRsp
|
||||
**
|
||||
** Description Send a get all capabilities response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_GetAllCapRsp(BD_ADDR bd_addr, UINT8 label, tAVDT_CFG *p_cap);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_GetConfigReq
|
||||
**
|
||||
** Description Send a get configuration request.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_GetConfigReq(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_GetConfigRsp
|
||||
**
|
||||
** Description Send a get configuration response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_GetConfigRsp(UINT8 handle, UINT8 label, tAVDT_CFG *p_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_OpenReq
|
||||
**
|
||||
** Description Send an open request.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_OpenReq(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_OpenRsp
|
||||
**
|
||||
** Description Send an open response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_OpenRsp(UINT8 handle, UINT8 label);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_StartRsp
|
||||
**
|
||||
** Description Send a start response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_StartRsp(UINT8 *p_handles, UINT8 num_handles, UINT8 label);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_CloseRsp
|
||||
**
|
||||
** Description Send a close response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_CloseRsp(UINT8 handle, UINT8 label);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_SuspendRsp
|
||||
**
|
||||
** Description Send a suspend response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_SuspendRsp(UINT8 *p_handles, UINT8 num_handles, UINT8 label);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_AbortReq
|
||||
**
|
||||
** Description Send an abort request.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_AbortReq(UINT8 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_AbortRsp
|
||||
**
|
||||
** Description Send an abort response.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_AbortRsp(UINT8 handle, UINT8 label);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVDTC_Rej
|
||||
**
|
||||
** Description Send a reject message.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVDTC_Rej(UINT8 handle, BD_ADDR bd_addr, UINT8 cmd, UINT8 label,
|
||||
UINT8 err_code, UINT8 err_param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* AVDT_CAPI_H */
|
653
tools/sdk/include/bluedroid/stack/avrc_api.h
Normal file
653
tools/sdk/include/bluedroid/stack/avrc_api.h
Normal file
@ -0,0 +1,653 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* nterface to AVRCP Application Programming Interface
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef AVRC_API_H
|
||||
#define AVRC_API_H
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/avct_api.h"
|
||||
#include "stack/sdp_api.h"
|
||||
#include "stack/avrc_defs.h"
|
||||
#if (AVRC_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** constants
|
||||
*****************************************************************************/
|
||||
|
||||
/* API function return value result codes. */
|
||||
#define AVRC_SUCCESS AVCT_SUCCESS /* 0 Function successful */
|
||||
#define AVRC_NO_RESOURCES AVCT_NO_RESOURCES /* 1 Not enough resources */
|
||||
#define AVRC_BAD_HANDLE AVCT_BAD_HANDLE /* 2 Bad handle */
|
||||
#define AVRC_PID_IN_USE AVCT_PID_IN_USE /* 3 PID already in use */
|
||||
#define AVRC_NOT_OPEN AVCT_NOT_OPEN /* 4 Connection not open */
|
||||
#define AVRC_MSG_TOO_BIG 5 /* 5 the message length exceed the MTU of the browsing channel */
|
||||
#define AVRC_FAIL 0x10 /* 0x10 generic failure */
|
||||
#define AVRC_BAD_PARAM 0x11 /* 0x11 bad parameter */
|
||||
|
||||
/* Control role - same as AVCT_TARGET/AVCT_CONTROL */
|
||||
#define AVRC_CT_TARGET 1 /* target */
|
||||
#define AVRC_CT_CONTROL 2 /* controller */
|
||||
#define AVRC_CT_PASSIVE 4 /* If conflict, allow the other side to succeed */
|
||||
|
||||
/* Connection role */
|
||||
#define AVRC_CONN_INT AVCT_INT /* initiator */
|
||||
#define AVRC_CONN_ACP AVCT_ACP /* Acceptor */
|
||||
|
||||
|
||||
/* AVRC CTRL events */
|
||||
/* AVRC_OPEN_IND_EVT event is sent when the connection is successfully opened.
|
||||
* This eventis sent in response to an AVRC_Open(). */
|
||||
#define AVRC_OPEN_IND_EVT 0
|
||||
|
||||
/* AVRC_CLOSE_IND_EVT event is sent when a connection is closed.
|
||||
* This event can result from a call to AVRC_Close() or when the peer closes
|
||||
* the connection. It is also sent when a connection attempted through
|
||||
* AVRC_Open() fails. */
|
||||
#define AVRC_CLOSE_IND_EVT 1
|
||||
|
||||
/* AVRC_CONG_IND_EVT event indicates that AVCTP is congested and cannot send
|
||||
* any more messages. */
|
||||
#define AVRC_CONG_IND_EVT 2
|
||||
|
||||
/* AVRC_UNCONG_IND_EVT event indicates that AVCTP is uncongested and ready to
|
||||
* send messages. */
|
||||
#define AVRC_UNCONG_IND_EVT 3
|
||||
|
||||
/* AVRC_BROWSE_OPEN_IND_EVT event is sent when the browse channel is successfully opened.
|
||||
* This eventis sent in response to an AVRC_Open() or AVRC_OpenBrowse() . */
|
||||
#define AVRC_BROWSE_OPEN_IND_EVT 4
|
||||
|
||||
/* AVRC_BROWSE_CLOSE_IND_EVT event is sent when a browse channel is closed.
|
||||
* This event can result from a call to AVRC_Close(), AVRC_CloseBrowse() or when the peer closes
|
||||
* the connection. It is also sent when a connection attempted through
|
||||
* AVRC_OpenBrowse() fails. */
|
||||
#define AVRC_BROWSE_CLOSE_IND_EVT 5
|
||||
|
||||
/* AVRC_BROWSE_CONG_IND_EVT event indicates that AVCTP browse channel is congested and cannot send
|
||||
* any more messages. */
|
||||
#define AVRC_BROWSE_CONG_IND_EVT 6
|
||||
|
||||
/* AVRC_BROWSE_UNCONG_IND_EVT event indicates that AVCTP browse channel is uncongested and ready to
|
||||
* send messages. */
|
||||
#define AVRC_BROWSE_UNCONG_IND_EVT 7
|
||||
|
||||
/* AVRC_CMD_TIMEOUT_EVT event indicates timeout waiting for AVRC command response from the peer */
|
||||
#define AVRC_CMD_TIMEOUT_EVT 8
|
||||
|
||||
/* Supported categories */
|
||||
#define AVRC_SUPF_CT_CAT1 0x0001 /* Category 1 */
|
||||
#define AVRC_SUPF_CT_CAT2 0x0002 /* Category 2 */
|
||||
#define AVRC_SUPF_CT_CAT3 0x0004 /* Category 3 */
|
||||
#define AVRC_SUPF_CT_CAT4 0x0008 /* Category 4 */
|
||||
#define AVRC_SUPF_CT_BROWSE 0x0040 /* Browsing */
|
||||
|
||||
#define AVRC_SUPF_TG_CAT1 0x0001 /* Category 1 */
|
||||
#define AVRC_SUPF_TG_CAT2 0x0002 /* Category 2 */
|
||||
#define AVRC_SUPF_TG_CAT3 0x0004 /* Category 3 */
|
||||
#define AVRC_SUPF_TG_CAT4 0x0008 /* Category 4 */
|
||||
#define AVRC_SUPF_TG_APP_SETTINGS 0x0010 /* Player Application Settings */
|
||||
#define AVRC_SUPF_TG_GROUP_NAVI 0x0020 /* Group Navigation */
|
||||
#define AVRC_SUPF_TG_BROWSE 0x0040 /* Browsing */
|
||||
#define AVRC_SUPF_TG_MULTI_PLAYER 0x0080 /* Muliple Media Player */
|
||||
|
||||
#define AVRC_META_SUCCESS AVRC_SUCCESS
|
||||
#define AVRC_META_FAIL AVRC_FAIL
|
||||
#define AVRC_METADATA_CMD 0x0000
|
||||
#define AVRC_METADATA_RESP 0x0001
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** data type definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/* This data type is used in AVRC_FindService() to initialize the SDP database
|
||||
* to hold the result service search. */
|
||||
typedef struct {
|
||||
UINT32 db_len; /* Length, in bytes, of the discovery database */
|
||||
tSDP_DISCOVERY_DB *p_db; /* Pointer to the discovery database */
|
||||
UINT16 num_attr;/* The number of attributes in p_attrs */
|
||||
UINT16 *p_attrs; /* The attributes filter. If NULL, AVRCP API sets the attribute filter
|
||||
* to be ATTR_ID_SERVICE_CLASS_ID_LIST, ATTR_ID_BT_PROFILE_DESC_LIST,
|
||||
* ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and ATTR_ID_PROVIDER_NAME.
|
||||
* If not NULL, the input is taken as the filter. */
|
||||
} tAVRC_SDP_DB_PARAMS;
|
||||
|
||||
/* This callback function returns service discovery information to the
|
||||
* application after the AVRC_FindService() API function is called. The
|
||||
* implementation of this callback function must copy the p_service_name
|
||||
* and p_provider_name parameters passed to it as they are not guaranteed
|
||||
* to remain after the callback function exits. */
|
||||
typedef void (tAVRC_FIND_CBACK) (UINT16 status);
|
||||
|
||||
|
||||
/* This is the control callback function. This function passes events
|
||||
* listed in Table 20 to the application. */
|
||||
typedef void (tAVRC_CTRL_CBACK) (UINT8 handle, UINT8 event, UINT16 result,
|
||||
BD_ADDR peer_addr);
|
||||
|
||||
|
||||
/* This is the message callback function. It is executed when AVCTP has
|
||||
* a message packet ready for the application. The implementation of this
|
||||
* callback function must copy the tAVRC_MSG structure passed to it as it
|
||||
* is not guaranteed to remain after the callback function exits. */
|
||||
typedef void (tAVRC_MSG_CBACK) (UINT8 handle, UINT8 label, UINT8 opcode,
|
||||
tAVRC_MSG *p_msg);
|
||||
|
||||
typedef struct {
|
||||
tAVRC_CTRL_CBACK *p_ctrl_cback; /* pointer to application control callback */
|
||||
tAVRC_MSG_CBACK *p_msg_cback; /* pointer to application message callback */
|
||||
UINT32 company_id; /* the company ID */
|
||||
UINT8 conn; /* Connection role (Initiator/acceptor) */
|
||||
UINT8 control; /* Control role (Control/Target) */
|
||||
} tAVRC_CONN_CB;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** external function declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_AddRecord
|
||||
**
|
||||
** Description This function is called to build an AVRCP SDP record.
|
||||
** Prior to calling this function the application must
|
||||
** call SDP_CreateRecord() to create an SDP record.
|
||||
**
|
||||
** Input Parameters:
|
||||
** service_uuid: Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
|
||||
** or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
|
||||
**
|
||||
** p_service_name: Pointer to a null-terminated character
|
||||
** string containing the service name.
|
||||
** If service name is not used set this to NULL.
|
||||
**
|
||||
** p_provider_name: Pointer to a null-terminated character
|
||||
** string containing the provider name.
|
||||
** If provider name is not used set this to NULL.
|
||||
**
|
||||
** categories: Supported categories.
|
||||
**
|
||||
** sdp_handle: SDP handle returned by SDP_CreateRecord().
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_NO_RESOURCES if not enough resources to build the SDP record.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
char *p_provider_name, UINT16 categories, UINT32 sdp_handle);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_FindService
|
||||
**
|
||||
** Description This function is called by the application to perform service
|
||||
** discovery and retrieve AVRCP SDP record information from a
|
||||
** peer device. Information is returned for the first service
|
||||
** record found on the server that matches the service UUID.
|
||||
** The callback function will be executed when service discovery
|
||||
** is complete. There can only be one outstanding call to
|
||||
** AVRC_FindService() at a time; the application must wait for
|
||||
** the callback before it makes another call to the function.
|
||||
** The application is responsible for allocating memory for the
|
||||
** discovery database. It is recommended that the size of the
|
||||
** discovery database be at least 300 bytes. The application
|
||||
** can deallocate the memory after the callback function has
|
||||
** executed.
|
||||
**
|
||||
** Input Parameters:
|
||||
** service_uuid: Indicates TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
|
||||
** or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
|
||||
**
|
||||
** bd_addr: BD address of the peer device.
|
||||
**
|
||||
** p_db: SDP discovery database parameters.
|
||||
**
|
||||
** p_cback: Pointer to the callback function.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_PARAMS if discovery database parameters are invalid.
|
||||
** AVRC_NO_RESOURCES if there are not enough resources to
|
||||
** perform the service search.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
tAVRC_SDP_DB_PARAMS *p_db, tAVRC_FIND_CBACK *p_cback);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_Open
|
||||
**
|
||||
** Description This function is called to open a connection to AVCTP.
|
||||
** The connection can be either an initiator or acceptor, as
|
||||
** determined by the p_ccb->stream parameter.
|
||||
** The connection can be a target, a controller or for both role,
|
||||
** as determined by the p_ccb->control parameter.
|
||||
** By definition, a target connection is an acceptor connection
|
||||
** that waits for an incoming AVCTP connection from the peer.
|
||||
** The connection remains available to the application until
|
||||
** the application closes it by calling AVRC_Close(). The
|
||||
** application does not need to reopen the connection after an
|
||||
** AVRC_CLOSE_IND_EVT is received.
|
||||
**
|
||||
** Input Parameters:
|
||||
** p_ccb->company_id: Company Identifier.
|
||||
**
|
||||
** p_ccb->p_ctrl_cback: Pointer to control callback function.
|
||||
**
|
||||
** p_ccb->p_msg_cback: Pointer to message callback function.
|
||||
**
|
||||
** p_ccb->conn: AVCTP connection role. This is set to
|
||||
** AVCTP_INT for initiator connections and AVCTP_ACP
|
||||
** for acceptor connections.
|
||||
**
|
||||
** p_ccb->control: Control role. This is set to
|
||||
** AVRC_CT_TARGET for target connections, AVRC_CT_CONTROL
|
||||
** for control connections or (AVRC_CT_TARGET|AVRC_CT_CONTROL)
|
||||
** for connections that support both roles.
|
||||
**
|
||||
** peer_addr: BD address of peer device. This value is
|
||||
** only used for initiator connections; for acceptor
|
||||
** connections it can be set to NULL.
|
||||
**
|
||||
** Output Parameters:
|
||||
** p_handle: Pointer to handle. This parameter is only
|
||||
** valid if AVRC_SUCCESS is returned.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_NO_RESOURCES if there are not enough resources to open
|
||||
** the connection.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_Open(UINT8 *p_handle, tAVRC_CONN_CB *p_ccb,
|
||||
BD_ADDR_PTR peer_addr);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_Close
|
||||
**
|
||||
** Description Close a connection opened with AVRC_Open().
|
||||
** This function is called when the
|
||||
** application is no longer using a connection.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_Close(UINT8 handle);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_OpenBrowse
|
||||
**
|
||||
** Description This function is called to open a browsing connection to AVCTP.
|
||||
** The connection can be either an initiator or acceptor, as
|
||||
** determined by the conn_role.
|
||||
** The handle is returned by a previous call to AVRC_Open.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_NO_RESOURCES if there are not enough resources to open
|
||||
** the connection.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_OpenBrowse(UINT8 handle, UINT8 conn_role);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_CloseBrowse
|
||||
**
|
||||
** Description Close a connection opened with AVRC_OpenBrowse().
|
||||
** This function is called when the
|
||||
** application is no longer using a connection.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_CloseBrowse(UINT8 handle);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_MsgReq
|
||||
**
|
||||
** Description This function is used to send the AVRCP byte stream in p_pkt
|
||||
** down to AVCTP.
|
||||
**
|
||||
** It is expected that p_pkt->offset is at least AVCT_MSG_OFFSET
|
||||
** p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE
|
||||
** p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or AVRC_OP_BROWSING
|
||||
** The above BT_HDR settings are set by the AVRC_Bld* functions.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_MsgReq (UINT8 handle, UINT8 label, UINT8 ctype, BT_HDR *p_pkt);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_UnitCmd
|
||||
**
|
||||
** Description Send a UNIT INFO command to the peer device. This
|
||||
** function can only be called for controller role connections.
|
||||
** Any response message from the peer is passed back through
|
||||
** the tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_UnitCmd(UINT8 handle, UINT8 label);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_SubCmd
|
||||
**
|
||||
** Description Send a SUBUNIT INFO command to the peer device. This
|
||||
** function can only be called for controller role connections.
|
||||
** Any response message from the peer is passed back through
|
||||
** the tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label.
|
||||
**
|
||||
** page: Specifies which part of the subunit type table
|
||||
** is requested. For AVRCP it is typically zero.
|
||||
** Value range is 0-7.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_SubCmd(UINT8 handle, UINT8 label, UINT8 page);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_PassCmd
|
||||
**
|
||||
** Description Send a PASS THROUGH command to the peer device. This
|
||||
** function can only be called for controller role connections.
|
||||
** Any response message from the peer is passed back through
|
||||
** the tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label.
|
||||
**
|
||||
** p_msg: Pointer to PASS THROUGH message structure.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_PassCmd(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_PassRsp
|
||||
**
|
||||
** Description Send a PASS THROUGH response to the peer device. This
|
||||
** function can only be called for target role connections.
|
||||
** This function must be called when a PASS THROUGH command
|
||||
** message is received from the peer through the
|
||||
** tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label. Must be the same value as
|
||||
** passed with the command message in the callback function.
|
||||
**
|
||||
** p_msg: Pointer to PASS THROUGH message structure.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_PassRsp(UINT8 handle, UINT8 label, tAVRC_MSG_PASS *p_msg);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_VendorCmd
|
||||
**
|
||||
** Description Send a VENDOR DEPENDENT command to the peer device. This
|
||||
** function can only be called for controller role connections.
|
||||
** Any response message from the peer is passed back through
|
||||
** the tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label.
|
||||
**
|
||||
** p_msg: Pointer to VENDOR DEPENDENT message structure.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_VendorCmd(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_VendorRsp
|
||||
**
|
||||
** Description Send a VENDOR DEPENDENT response to the peer device. This
|
||||
** function can only be called for target role connections.
|
||||
** This function must be called when a VENDOR DEPENDENT
|
||||
** command message is received from the peer through the
|
||||
** tAVRC_MSG_CBACK callback function.
|
||||
**
|
||||
** Input Parameters:
|
||||
** handle: Handle of this connection.
|
||||
**
|
||||
** label: Transaction label. Must be the same value as
|
||||
** passed with the command message in the callback function.
|
||||
**
|
||||
** p_msg: Pointer to VENDOR DEPENDENT message structure.
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
** Returns AVRC_SUCCESS if successful.
|
||||
** AVRC_BAD_HANDLE if handle is invalid.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_VendorRsp(UINT8 handle, UINT8 label, tAVRC_MSG_VENDOR *p_msg);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
** Function AVRC_SetTraceLevel
|
||||
**
|
||||
** Description Sets the trace level for AVRC. If 0xff is passed, the
|
||||
** current trace level is returned.
|
||||
**
|
||||
** Input Parameters:
|
||||
** new_level: The level to set the AVRC tracing to:
|
||||
** 0xff-returns the current setting.
|
||||
** 0-turns off tracing.
|
||||
** >= 1-Errors.
|
||||
** >= 2-Warnings.
|
||||
** >= 3-APIs.
|
||||
** >= 4-Events.
|
||||
** >= 5-Debug.
|
||||
**
|
||||
** Returns The new trace level or current trace level if
|
||||
** the input parameter is 0xff.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT8 AVRC_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_Init
|
||||
**
|
||||
** Description This function is called at stack startup to allocate the
|
||||
** control block (if using dynamic memory), and initializes the
|
||||
** control block and tracing level.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVRC_Init(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_Deinit
|
||||
**
|
||||
** Description This function is called at stack shotdown to free the
|
||||
** control block (if using dynamic memory), and deinitializes the
|
||||
** control block and tracing level.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void AVRC_Deinit(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_ParsCommand
|
||||
**
|
||||
** Description This function is used to parse the received command.
|
||||
**
|
||||
** Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
|
||||
** Otherwise, the error code defined by AVRCP 1.4
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tAVRC_STS AVRC_ParsCommand (tAVRC_MSG *p_msg, tAVRC_COMMAND *p_result,
|
||||
UINT8 *p_buf, UINT16 buf_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_ParsResponse
|
||||
**
|
||||
** Description This function is used to parse the received response.
|
||||
**
|
||||
** Returns AVRC_STS_NO_ERROR, if the message in p_data is parsed successfully.
|
||||
** Otherwise, the error code defined by AVRCP 1.4
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tAVRC_STS AVRC_ParsResponse (tAVRC_MSG *p_msg, tAVRC_RESPONSE *p_result,
|
||||
UINT8 *p_buf, UINT16 buf_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_BldCommand
|
||||
**
|
||||
** Description This function builds the given AVRCP command to the given
|
||||
** GKI buffer
|
||||
**
|
||||
** Returns AVRC_STS_NO_ERROR, if the command is built successfully
|
||||
** Otherwise, the error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tAVRC_STS AVRC_BldCommand( tAVRC_COMMAND *p_cmd, BT_HDR **pp_pkt);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_BldResponse
|
||||
**
|
||||
** Description This function builds the given AVRCP response to the given
|
||||
** GKI buffer
|
||||
**
|
||||
** Returns AVRC_STS_NO_ERROR, if the response is built successfully
|
||||
** Otherwise, the error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tAVRC_STS AVRC_BldResponse( UINT8 handle, tAVRC_RESPONSE *p_rsp, BT_HDR **pp_pkt);
|
||||
|
||||
/**************************************************************************
|
||||
**
|
||||
** Function AVRC_IsValidAvcType
|
||||
**
|
||||
** Description Check if correct AVC type is specified
|
||||
**
|
||||
** Returns returns TRUE if it is valid
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN AVRC_IsValidAvcType(UINT8 pdu_id, UINT8 avc_type);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function AVRC_IsValidPlayerAttr
|
||||
**
|
||||
** Description Check if the given attrib value is a valid one
|
||||
**
|
||||
**
|
||||
** Returns returns TRUE if it is valid
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN AVRC_IsValidPlayerAttr(UINT8 attr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///AVRC_INCLUDED == TRUE
|
||||
|
||||
|
||||
#endif /* AVRC_API_H */
|
1362
tools/sdk/include/bluedroid/stack/avrc_defs.h
Normal file
1362
tools/sdk/include/bluedroid/stack/avrc_defs.h
Normal file
File diff suppressed because it is too large
Load Diff
793
tools/sdk/include/bluedroid/stack/bt_types.h
Normal file
793
tools/sdk/include/bluedroid/stack/bt_types.h
Normal file
@ -0,0 +1,793 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BT_TYPES_H
|
||||
#define BT_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE true
|
||||
#endif
|
||||
|
||||
typedef uint8_t UINT8;
|
||||
typedef uint16_t UINT16;
|
||||
typedef uint32_t UINT32;
|
||||
typedef uint64_t UINT64;
|
||||
|
||||
typedef int8_t INT8;
|
||||
typedef int16_t INT16;
|
||||
typedef int32_t INT32;
|
||||
typedef bool BOOLEAN;
|
||||
|
||||
#define PACKED __packed
|
||||
// #define INLINE __inline
|
||||
|
||||
#define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3))
|
||||
#define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4))
|
||||
|
||||
/* READ WELL !!
|
||||
**
|
||||
** This section defines global events. These are events that cross layers.
|
||||
** Any event that passes between layers MUST be one of these events. Tasks
|
||||
** can use their own events internally, but a FUNDAMENTAL design issue is
|
||||
** that global events MUST be one of these events defined below.
|
||||
**
|
||||
** The convention used is the the event name contains the layer that the
|
||||
** event is going to.
|
||||
*/
|
||||
#define BT_EVT_MASK 0xFF00
|
||||
#define BT_SUB_EVT_MASK 0x00FF
|
||||
#define BT_STATIC_RAND_ADDR_MASK 0xC0
|
||||
/* To Bluetooth Upper Layers */
|
||||
/************************************/
|
||||
#define BT_EVT_TO_BTU_L2C_EVT 0x0900 /* L2CAP event */
|
||||
#define BT_EVT_TO_BTU_HCI_EVT 0x1000 /* HCI Event */
|
||||
#define BT_EVT_TO_BTU_HCI_BR_EDR_EVT (0x0000 | BT_EVT_TO_BTU_HCI_EVT) /* event from BR/EDR controller */
|
||||
#define BT_EVT_TO_BTU_HCI_AMP1_EVT (0x0001 | BT_EVT_TO_BTU_HCI_EVT) /* event from local AMP 1 controller */
|
||||
#define BT_EVT_TO_BTU_HCI_AMP2_EVT (0x0002 | BT_EVT_TO_BTU_HCI_EVT) /* event from local AMP 2 controller */
|
||||
#define BT_EVT_TO_BTU_HCI_AMP3_EVT (0x0003 | BT_EVT_TO_BTU_HCI_EVT) /* event from local AMP 3 controller */
|
||||
|
||||
#define BT_EVT_TO_BTU_HCI_ACL 0x1100 /* ACL Data from HCI */
|
||||
#define BT_EVT_TO_BTU_HCI_SCO 0x1200 /* SCO Data from HCI */
|
||||
#define BT_EVT_TO_BTU_HCIT_ERR 0x1300 /* HCI Transport Error */
|
||||
|
||||
#define BT_EVT_TO_BTU_SP_EVT 0x1400 /* Serial Port Event */
|
||||
#define BT_EVT_TO_BTU_SP_DATA 0x1500 /* Serial Port Data */
|
||||
|
||||
#define BT_EVT_TO_BTU_HCI_CMD 0x1600 /* HCI command from upper layer */
|
||||
|
||||
|
||||
#define BT_EVT_TO_BTU_L2C_SEG_XMIT 0x1900 /* L2CAP segment(s) transmitted */
|
||||
|
||||
#define BT_EVT_PROXY_INCOMING_MSG 0x1A00 /* BlueStackTester event: incoming message from target */
|
||||
|
||||
#define BT_EVT_BTSIM 0x1B00 /* Insight BTSIM event */
|
||||
#define BT_EVT_BTISE 0x1C00 /* Insight Script Engine event */
|
||||
|
||||
/* To LM */
|
||||
/************************************/
|
||||
#define BT_EVT_TO_LM_HCI_CMD 0x2000 /* HCI Command */
|
||||
#define BT_EVT_TO_LM_HCI_ACL 0x2100 /* HCI ACL Data */
|
||||
#define BT_EVT_TO_LM_HCI_SCO 0x2200 /* HCI SCO Data */
|
||||
#define BT_EVT_TO_LM_HCIT_ERR 0x2300 /* HCI Transport Error */
|
||||
#define BT_EVT_TO_LM_LC_EVT 0x2400 /* LC event */
|
||||
#define BT_EVT_TO_LM_LC_LMP 0x2500 /* LC Received LMP command frame */
|
||||
#define BT_EVT_TO_LM_LC_ACL 0x2600 /* LC Received ACL data */
|
||||
#define BT_EVT_TO_LM_LC_SCO 0x2700 /* LC Received SCO data (not used) */
|
||||
#define BT_EVT_TO_LM_LC_ACL_TX 0x2800 /* LMP data transmit complete */
|
||||
#define BT_EVT_TO_LM_LC_LMPC_TX 0x2900 /* LMP Command transmit complete */
|
||||
#define BT_EVT_TO_LM_LOCAL_ACL_LB 0x2a00 /* Data to be locally loopbacked */
|
||||
#define BT_EVT_TO_LM_HCI_ACL_ACK 0x2b00 /* HCI ACL Data ack (not used) */
|
||||
#define BT_EVT_TO_LM_DIAG 0x2c00 /* LM Diagnostics commands */
|
||||
|
||||
|
||||
#define BT_EVT_TO_BTM_CMDS 0x2f00
|
||||
#define BT_EVT_TO_BTM_PM_MDCHG_EVT (0x0001 | BT_EVT_TO_BTM_CMDS)
|
||||
|
||||
#define BT_EVT_TO_TCS_CMDS 0x3000
|
||||
|
||||
#define BT_EVT_TO_CTP_CMDS 0x3300
|
||||
|
||||
/* ftp events */
|
||||
#define BT_EVT_TO_FTP_SRVR_CMDS 0x3600
|
||||
#define BT_EVT_TO_FTP_CLNT_CMDS 0x3700
|
||||
|
||||
#define BT_EVT_TO_BTU_SAP 0x3800 /* SIM Access Profile events */
|
||||
|
||||
/* opp events */
|
||||
#define BT_EVT_TO_OPP_SRVR_CMDS 0x3900
|
||||
#define BT_EVT_TO_OPP_CLNT_CMDS 0x3a00
|
||||
|
||||
/* gap events */
|
||||
#define BT_EVT_TO_GAP_MSG 0x3b00
|
||||
|
||||
/* for NFC */
|
||||
/************************************/
|
||||
#define BT_EVT_TO_NFC_NCI 0x4000 /* NCI Command, Notification or Data*/
|
||||
#define BT_EVT_TO_NFC_INIT 0x4100 /* Initialization message */
|
||||
#define BT_EVT_TO_NCI_LP 0x4200 /* Low power */
|
||||
#define BT_EVT_TO_NFC_ERR 0x4300 /* Error notification to NFC Task */
|
||||
|
||||
#define BT_EVT_TO_NFCCSIM_NCI 0x4a00 /* events to NFCC simulation (NCI packets) */
|
||||
|
||||
/* HCISU Events */
|
||||
|
||||
#define BT_EVT_HCISU 0x5000
|
||||
|
||||
// btla-specific ++
|
||||
#define BT_EVT_TO_HCISU_RECONFIG_EVT (0x0001 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_UPDATE_BAUDRATE_EVT (0x0002 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_LP_ENABLE_EVT (0x0003 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_LP_DISABLE_EVT (0x0004 | BT_EVT_HCISU)
|
||||
// btla-specific --
|
||||
#define BT_EVT_TO_HCISU_LP_APP_SLEEPING_EVT (0x0005 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_LP_ALLOW_BT_SLEEP_EVT (0x0006 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_LP_WAKEUP_HOST_EVT (0x0007 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_LP_RCV_H4IBSS_EVT (0x0008 | BT_EVT_HCISU)
|
||||
#define BT_EVT_TO_HCISU_H5_RESET_EVT (0x0009 | BT_EVT_HCISU)
|
||||
#define BT_EVT_HCISU_START_QUICK_TIMER (0x000a | BT_EVT_HCISU)
|
||||
|
||||
#define BT_EVT_DATA_TO_AMP_1 0x5100
|
||||
#define BT_EVT_DATA_TO_AMP_15 0x5f00
|
||||
|
||||
/* HSP Events */
|
||||
|
||||
#define BT_EVT_BTU_HSP2 0x6000
|
||||
|
||||
#define BT_EVT_TO_BTU_HSP2_EVT (0x0001 | BT_EVT_BTU_HSP2)
|
||||
|
||||
/* BPP Events */
|
||||
#define BT_EVT_TO_BPP_PR_CMDS 0x6100 /* Printer Events */
|
||||
#define BT_EVT_TO_BPP_SND_CMDS 0x6200 /* BPP Sender Events */
|
||||
|
||||
/* BIP Events */
|
||||
#define BT_EVT_TO_BIP_CMDS 0x6300
|
||||
|
||||
/* HCRP Events */
|
||||
|
||||
#define BT_EVT_BTU_HCRP 0x7000
|
||||
|
||||
#define BT_EVT_TO_BTU_HCRP_EVT (0x0001 | BT_EVT_BTU_HCRP)
|
||||
#define BT_EVT_TO_BTU_HCRPM_EVT (0x0002 | BT_EVT_BTU_HCRP)
|
||||
|
||||
|
||||
#define BT_EVT_BTU_HFP 0x8000
|
||||
#define BT_EVT_TO_BTU_HFP_EVT (0x0001 | BT_EVT_BTU_HFP)
|
||||
|
||||
#define BT_EVT_BTU_IPC_EVT 0x9000
|
||||
#define BT_EVT_BTU_IPC_LOGMSG_EVT (0x0000 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_ACL_EVT (0x0001 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_BTU_EVT (0x0002 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_L2C_EVT (0x0003 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_L2C_MSG_EVT (0x0004 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_BTM_EVT (0x0005 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_AVDT_EVT (0x0006 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_SLIP_EVT (0x0007 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_MGMT_EVT (0x0008 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_BTTRC_EVT (0x0009 | BT_EVT_BTU_IPC_EVT)
|
||||
#define BT_EVT_BTU_IPC_BURST_EVT (0x000A | BT_EVT_BTU_IPC_EVT)
|
||||
|
||||
|
||||
/* BTIF Events */
|
||||
#define BT_EVT_BTIF 0xA000
|
||||
#define BT_EVT_CONTEXT_SWITCH_EVT (0x0001 | BT_EVT_BTIF)
|
||||
|
||||
/* Define the header of each buffer used in the Bluetooth stack.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t event;
|
||||
uint16_t len;
|
||||
uint16_t offset;
|
||||
uint16_t layer_specific;
|
||||
uint8_t data[];
|
||||
} BT_HDR;
|
||||
|
||||
#define BT_HDR_SIZE (sizeof (BT_HDR))
|
||||
|
||||
#define BT_PSM_SDP 0x0001
|
||||
#define BT_PSM_RFCOMM 0x0003
|
||||
#define BT_PSM_TCS 0x0005
|
||||
#define BT_PSM_CTP 0x0007
|
||||
#define BT_PSM_BNEP 0x000F
|
||||
#define BT_PSM_HIDC 0x0011
|
||||
#define BT_PSM_HIDI 0x0013
|
||||
#define BT_PSM_UPNP 0x0015
|
||||
#define BT_PSM_AVCTP 0x0017
|
||||
#define BT_PSM_AVDTP 0x0019
|
||||
#define BT_PSM_AVCTP_13 0x001B /* Advanced Control - Browsing */
|
||||
#define BT_PSM_UDI_CP 0x001D /* Unrestricted Digital Information Profile C-Plane */
|
||||
#define BT_PSM_ATT 0x001F /* Attribute Protocol */
|
||||
|
||||
|
||||
/* These macros extract the HCI opcodes from a buffer
|
||||
*/
|
||||
#define HCI_GET_CMD_HDR_OPCODE(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \
|
||||
(*((UINT8 *)((p) + 1) + p->offset + 1) << 8)))
|
||||
#define HCI_GET_CMD_HDR_PARAM_LEN(p) (UINT8) (*((UINT8 *)((p) + 1) + p->offset + 2))
|
||||
|
||||
#define HCI_GET_EVT_HDR_OPCODE(p) (UINT8)(*((UINT8 *)((p) + 1) + p->offset))
|
||||
#define HCI_GET_EVT_HDR_PARAM_LEN(p) (UINT8) (*((UINT8 *)((p) + 1) + p->offset + 1))
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
** Macros to get and put bytes to and from a stream (Little Endian format).
|
||||
*/
|
||||
#define UINT32_TO_STREAM(p, u32) {*(p)++ = (UINT8)(u32); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 24);}
|
||||
#define UINT24_TO_STREAM(p, u24) {*(p)++ = (UINT8)(u24); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)((u24) >> 16);}
|
||||
#define UINT16_TO_STREAM(p, u16) {*(p)++ = (UINT8)(u16); *(p)++ = (UINT8)((u16) >> 8);}
|
||||
#define UINT8_TO_STREAM(p, u8) {*(p)++ = (UINT8)(u8);}
|
||||
#define INT8_TO_STREAM(p, u8) {*(p)++ = (INT8)(u8);}
|
||||
#define ARRAY32_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < 32; ijk++) *(p)++ = (UINT8) a[31 - ijk];}
|
||||
#define ARRAY16_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < 16; ijk++) *(p)++ = (UINT8) a[15 - ijk];}
|
||||
#define ARRAY8_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < 8; ijk++) *(p)++ = (UINT8) a[7 - ijk];}
|
||||
#define BDADDR_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < BD_ADDR_LEN; ijk++) *(p)++ = (UINT8) a[BD_ADDR_LEN - 1 - ijk];}
|
||||
#define LAP_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < LAP_LEN; ijk++) *(p)++ = (UINT8) a[LAP_LEN - 1 - ijk];}
|
||||
#define DEVCLASS_TO_STREAM(p, a) {register int ijk; for (ijk = 0; ijk < DEV_CLASS_LEN;ijk++) *(p)++ = (UINT8) a[DEV_CLASS_LEN - 1 - ijk];}
|
||||
#define ARRAY_TO_STREAM(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[ijk];}
|
||||
#define REVERSE_ARRAY_TO_STREAM(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[len - 1 - ijk];}
|
||||
|
||||
#define STREAM_TO_UINT8(u8, p) {u8 = (UINT8)(*(p)); (p) += 1;}
|
||||
#define STREAM_TO_UINT16(u16, p) {u16 = ((UINT16)(*(p)) + (((UINT16)(*((p) + 1))) << 8)); (p) += 2;}
|
||||
#define STREAM_TO_UINT24(u32, p) {u32 = (((UINT32)(*(p))) + ((((UINT32)(*((p) + 1)))) << 8) + ((((UINT32)(*((p) + 2)))) << 16) ); (p) += 3;}
|
||||
#define STREAM_TO_UINT32(u32, p) {u32 = (((UINT32)(*(p))) + ((((UINT32)(*((p) + 1)))) << 8) + ((((UINT32)(*((p) + 2)))) << 16) + ((((UINT32)(*((p) + 3)))) << 24)); (p) += 4;}
|
||||
#define STREAM_TO_BDADDR(a, p) {register int ijk; register UINT8 *pbda = (UINT8 *)a + BD_ADDR_LEN - 1; for (ijk = 0; ijk < BD_ADDR_LEN; ijk++) *pbda-- = *p++;}
|
||||
#define STREAM_TO_ARRAY32(a, p) {register int ijk; register UINT8 *_pa = (UINT8 *)a + 31; for (ijk = 0; ijk < 32; ijk++) *_pa-- = *p++;}
|
||||
#define STREAM_TO_ARRAY16(a, p) {register int ijk; register UINT8 *_pa = (UINT8 *)a + 15; for (ijk = 0; ijk < 16; ijk++) *_pa-- = *p++;}
|
||||
#define STREAM_TO_ARRAY8(a, p) {register int ijk; register UINT8 *_pa = (UINT8 *)a + 7; for (ijk = 0; ijk < 8; ijk++) *_pa-- = *p++;}
|
||||
#define STREAM_TO_DEVCLASS(a, p) {register int ijk; register UINT8 *_pa = (UINT8 *)a + DEV_CLASS_LEN - 1; for (ijk = 0; ijk < DEV_CLASS_LEN; ijk++) *_pa-- = *p++;}
|
||||
#define STREAM_TO_LAP(a, p) {register int ijk; register UINT8 *plap = (UINT8 *)a + LAP_LEN - 1; for (ijk = 0; ijk < LAP_LEN; ijk++) *plap-- = *p++;}
|
||||
#define STREAM_TO_ARRAY(a, p, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) ((UINT8 *) a)[ijk] = *p++;}
|
||||
#define REVERSE_STREAM_TO_ARRAY(a, p, len) {register int ijk; register UINT8 *_pa = (UINT8 *)a + len - 1; for (ijk = 0; ijk < len; ijk++) *_pa-- = *p++;}
|
||||
|
||||
#define STREAM_SKIP_UINT8(p) do { (p) += 1; } while (0)
|
||||
#define STREAM_SKIP_UINT16(p) do { (p) += 2; } while (0)
|
||||
|
||||
/********************************************************************************
|
||||
** Macros to get and put bytes to and from a field (Little Endian format).
|
||||
** These are the same as to stream, except the pointer is not incremented.
|
||||
*/
|
||||
#define UINT32_TO_FIELD(p, u32) {*(UINT8 *)(p) = (UINT8)(u32); *((UINT8 *)(p)+1) = (UINT8)((u32) >> 8); *((UINT8 *)(p)+2) = (UINT8)((u32) >> 16); *((UINT8 *)(p)+3) = (UINT8)((u32) >> 24);}
|
||||
#define UINT24_TO_FIELD(p, u24) {*(UINT8 *)(p) = (UINT8)(u24); *((UINT8 *)(p)+1) = (UINT8)((u24) >> 8); *((UINT8 *)(p)+2) = (UINT8)((u24) >> 16);}
|
||||
#define UINT16_TO_FIELD(p, u16) {*(UINT8 *)(p) = (UINT8)(u16); *((UINT8 *)(p)+1) = (UINT8)((u16) >> 8);}
|
||||
#define UINT8_TO_FIELD(p, u8) {*(UINT8 *)(p) = (UINT8)(u8);}
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
** Macros to get and put bytes to and from a stream (Big Endian format)
|
||||
*/
|
||||
#define UINT64_TO_BE_STREAM(p, u64) {*(p)++ = (UINT8)((u64) >> 56); *(p)++ = (UINT8)((u64) >> 48); *(p)++ = (UINT8)((u64) >> 40); *(p)++ = (UINT8)((u64) >> 32); *(p)++ = (UINT8)((u64) >> 24); *(p)++ = (UINT8)((u64) >> 16); *(p)++ = (UINT8)((u64) >> 8); *(p)++ = (UINT8)(u64); }
|
||||
#define UINT32_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 24); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
|
||||
#define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (UINT8)((u24) >> 16); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)(u24);}
|
||||
#define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (UINT8)((u16) >> 8); *(p)++ = (UINT8)(u16);}
|
||||
#define UINT8_TO_BE_STREAM(p, u8) {*(p)++ = (UINT8)(u8);}
|
||||
#define ARRAY_TO_BE_STREAM(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[ijk];}
|
||||
#define ARRAY_TO_BE_STREAM_REVERSE(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[len - ijk - 1];}
|
||||
|
||||
#define BE_STREAM_TO_UINT8(u8, p) {u8 = (UINT8)(*(p)); (p) += 1;}
|
||||
#define BE_STREAM_TO_UINT16(u16, p) {u16 = (UINT16)(((UINT16)(*(p)) << 8) + (UINT16)(*((p) + 1))); (p) += 2;}
|
||||
#define BE_STREAM_TO_UINT24(u32, p) {u32 = (((UINT32)(*((p) + 2))) + ((UINT32)(*((p) + 1)) << 8) + ((UINT32)(*(p)) << 16)); (p) += 3;}
|
||||
#define BE_STREAM_TO_UINT32(u32, p) {u32 = ((UINT32)(*((p) + 3)) + ((UINT32)(*((p) + 2)) << 8) + ((UINT32)(*((p) + 1)) << 16) + ((UINT32)(*(p)) << 24)); (p) += 4;}
|
||||
#define BE_STREAM_TO_ARRAY(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) ((UINT8 *) a)[ijk] = *p++;}
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
** Macros to get and put bytes to and from a field (Big Endian format).
|
||||
** These are the same as to stream, except the pointer is not incremented.
|
||||
*/
|
||||
#define UINT32_TO_BE_FIELD(p, u32) {*(UINT8 *)(p) = (UINT8)((u32) >> 24); *((UINT8 *)(p)+1) = (UINT8)((u32) >> 16); *((UINT8 *)(p)+2) = (UINT8)((u32) >> 8); *((UINT8 *)(p)+3) = (UINT8)(u32); }
|
||||
#define UINT24_TO_BE_FIELD(p, u24) {*(UINT8 *)(p) = (UINT8)((u24) >> 16); *((UINT8 *)(p)+1) = (UINT8)((u24) >> 8); *((UINT8 *)(p)+2) = (UINT8)(u24);}
|
||||
#define UINT16_TO_BE_FIELD(p, u16) {*(UINT8 *)(p) = (UINT8)((u16) >> 8); *((UINT8 *)(p)+1) = (UINT8)(u16);}
|
||||
#define UINT8_TO_BE_FIELD(p, u8) {*(UINT8 *)(p) = (UINT8)(u8);}
|
||||
|
||||
|
||||
/* Common Bluetooth field definitions */
|
||||
#define BD_ADDR_LEN 6 /* Device address length */
|
||||
typedef UINT8 BD_ADDR[BD_ADDR_LEN]; /* Device address */
|
||||
typedef UINT8 *BD_ADDR_PTR; /* Pointer to Device Address */
|
||||
|
||||
#define AMP_KEY_TYPE_GAMP 0
|
||||
#define AMP_KEY_TYPE_WIFI 1
|
||||
#define AMP_KEY_TYPE_UWB 2
|
||||
typedef UINT8 tAMP_KEY_TYPE;
|
||||
|
||||
#define BT_OCTET8_LEN 8
|
||||
typedef UINT8 BT_OCTET8[BT_OCTET8_LEN]; /* octet array: size 16 */
|
||||
|
||||
#define LINK_KEY_LEN 16
|
||||
typedef UINT8 LINK_KEY[LINK_KEY_LEN]; /* Link Key */
|
||||
|
||||
#define AMP_LINK_KEY_LEN 32
|
||||
typedef UINT8 AMP_LINK_KEY[AMP_LINK_KEY_LEN]; /* Dedicated AMP and GAMP Link Keys */
|
||||
|
||||
#define BT_OCTET16_LEN 16
|
||||
typedef UINT8 BT_OCTET16[BT_OCTET16_LEN]; /* octet array: size 16 */
|
||||
|
||||
#define PIN_CODE_LEN 16
|
||||
typedef UINT8 PIN_CODE[PIN_CODE_LEN]; /* Pin Code (upto 128 bits) MSB is 0 */
|
||||
typedef UINT8 *PIN_CODE_PTR; /* Pointer to Pin Code */
|
||||
|
||||
#define BT_OCTET32_LEN 32
|
||||
typedef UINT8 BT_OCTET32[BT_OCTET32_LEN]; /* octet array: size 32 */
|
||||
|
||||
#define DEV_CLASS_LEN 3
|
||||
typedef UINT8 DEV_CLASS[DEV_CLASS_LEN]; /* Device class */
|
||||
typedef UINT8 *DEV_CLASS_PTR; /* Pointer to Device class */
|
||||
|
||||
#define EXT_INQ_RESP_LEN 3
|
||||
typedef UINT8 EXT_INQ_RESP[EXT_INQ_RESP_LEN];/* Extended Inquiry Response */
|
||||
typedef UINT8 *EXT_INQ_RESP_PTR; /* Pointer to Extended Inquiry Response */
|
||||
|
||||
#define BD_NAME_LEN 248
|
||||
typedef UINT8 BD_NAME[BD_NAME_LEN + 1]; /* Device name */
|
||||
typedef UINT8 *BD_NAME_PTR; /* Pointer to Device name */
|
||||
|
||||
#define BD_FEATURES_LEN 8
|
||||
typedef UINT8 BD_FEATURES[BD_FEATURES_LEN]; /* LMP features supported by device */
|
||||
|
||||
#define BT_EVENT_MASK_LEN 8
|
||||
typedef UINT8 BT_EVENT_MASK[BT_EVENT_MASK_LEN]; /* Event Mask */
|
||||
|
||||
#define LAP_LEN 3
|
||||
typedef UINT8 LAP[LAP_LEN]; /* IAC as passed to Inquiry (LAP) */
|
||||
typedef UINT8 INQ_LAP[LAP_LEN]; /* IAC as passed to Inquiry (LAP) */
|
||||
|
||||
#define RAND_NUM_LEN 16
|
||||
typedef UINT8 RAND_NUM[RAND_NUM_LEN];
|
||||
|
||||
#define ACO_LEN 12
|
||||
typedef UINT8 ACO[ACO_LEN]; /* Authenticated ciphering offset */
|
||||
|
||||
#define COF_LEN 12
|
||||
typedef UINT8 COF[COF_LEN]; /* ciphering offset number */
|
||||
|
||||
typedef struct {
|
||||
UINT8 qos_flags; /* TBD */
|
||||
UINT8 service_type; /* see below */
|
||||
UINT32 token_rate; /* bytes/second */
|
||||
UINT32 token_bucket_size; /* bytes */
|
||||
UINT32 peak_bandwidth; /* bytes/second */
|
||||
UINT32 latency; /* microseconds */
|
||||
UINT32 delay_variation; /* microseconds */
|
||||
} FLOW_SPEC;
|
||||
|
||||
/* Values for service_type */
|
||||
#define NO_TRAFFIC 0
|
||||
#define BEST_EFFORT 1
|
||||
#define GUARANTEED 2
|
||||
|
||||
/* Service class of the CoD */
|
||||
#define SERV_CLASS_NETWORKING (1 << 1)
|
||||
#define SERV_CLASS_RENDERING (1 << 2)
|
||||
#define SERV_CLASS_CAPTURING (1 << 3)
|
||||
#define SERV_CLASS_OBJECT_TRANSFER (1 << 4)
|
||||
#define SERV_CLASS_OBJECT_AUDIO (1 << 5)
|
||||
#define SERV_CLASS_OBJECT_TELEPHONY (1 << 6)
|
||||
#define SERV_CLASS_OBJECT_INFORMATION (1 << 7)
|
||||
|
||||
/* Second byte */
|
||||
#define SERV_CLASS_LIMITED_DISC_MODE (0x20)
|
||||
|
||||
/* Field size definitions. Note that byte lengths are rounded up. */
|
||||
#define ACCESS_CODE_BIT_LEN 72
|
||||
#define ACCESS_CODE_BYTE_LEN 9
|
||||
#define SHORTENED_ACCESS_CODE_BIT_LEN 68
|
||||
|
||||
typedef UINT8 ACCESS_CODE[ACCESS_CODE_BYTE_LEN];
|
||||
|
||||
#define SYNTH_TX 1 /* want synth code to TRANSMIT at this freq */
|
||||
#define SYNTH_RX 2 /* want synth code to RECEIVE at this freq */
|
||||
|
||||
#define SYNC_REPS 1 /* repeats of sync word transmitted to start of burst */
|
||||
|
||||
/* Bluetooth CLK27 */
|
||||
#define BT_CLK27 (2 << 26)
|
||||
|
||||
/* Bluetooth CLK12 is 1.28 sec */
|
||||
#define BT_CLK12_TO_MS(x) ((x) * 1280)
|
||||
#define BT_MS_TO_CLK12(x) ((x) / 1280)
|
||||
#define BT_CLK12_TO_SLOTS(x) ((x) << 11)
|
||||
|
||||
/* Bluetooth CLK is 0.625 msec */
|
||||
#define BT_CLK_TO_MS(x) (((x) * 5 + 3) / 8)
|
||||
#define BT_MS_TO_CLK(x) (((x) * 8 + 2) / 5)
|
||||
|
||||
#define BT_CLK_TO_MICROSECS(x) (((x) * 5000 + 3) / 8)
|
||||
#define BT_MICROSECS_TO_CLK(x) (((x) * 8 + 2499) / 5000)
|
||||
|
||||
/* Maximum UUID size - 16 bytes, and structure to hold any type of UUID. */
|
||||
#define MAX_UUID_SIZE 16
|
||||
typedef struct {
|
||||
#define LEN_UUID_16 2
|
||||
#define LEN_UUID_32 4
|
||||
#define LEN_UUID_128 16
|
||||
|
||||
UINT16 len;
|
||||
|
||||
union {
|
||||
UINT16 uuid16;
|
||||
UINT32 uuid32;
|
||||
UINT8 uuid128[MAX_UUID_SIZE];
|
||||
} uu;
|
||||
|
||||
} tBT_UUID;
|
||||
|
||||
#define BT_EIR_FLAGS_TYPE 0x01
|
||||
#define BT_EIR_MORE_16BITS_UUID_TYPE 0x02
|
||||
#define BT_EIR_COMPLETE_16BITS_UUID_TYPE 0x03
|
||||
#define BT_EIR_MORE_32BITS_UUID_TYPE 0x04
|
||||
#define BT_EIR_COMPLETE_32BITS_UUID_TYPE 0x05
|
||||
#define BT_EIR_MORE_128BITS_UUID_TYPE 0x06
|
||||
#define BT_EIR_COMPLETE_128BITS_UUID_TYPE 0x07
|
||||
#define BT_EIR_SHORTENED_LOCAL_NAME_TYPE 0x08
|
||||
#define BT_EIR_COMPLETE_LOCAL_NAME_TYPE 0x09
|
||||
#define BT_EIR_TX_POWER_LEVEL_TYPE 0x0A
|
||||
#define BT_EIR_OOB_BD_ADDR_TYPE 0x0C
|
||||
#define BT_EIR_OOB_COD_TYPE 0x0D
|
||||
#define BT_EIR_OOB_SSP_HASH_C_TYPE 0x0E
|
||||
#define BT_EIR_OOB_SSP_RAND_R_TYPE 0x0F
|
||||
#define BT_EIR_MANUFACTURER_SPECIFIC_TYPE 0xFF
|
||||
|
||||
#define BT_OOB_COD_SIZE 3
|
||||
#define BT_OOB_HASH_C_SIZE 16
|
||||
#define BT_OOB_RAND_R_SIZE 16
|
||||
|
||||
/* Broadcom proprietary UUIDs and reserved PSMs
|
||||
**
|
||||
** The lowest 4 bytes byte of the UUID or GUID depends on the feature. Typically,
|
||||
** the value of those bytes will be the PSM or SCN, but it is up to the features.
|
||||
*/
|
||||
#define BRCM_PROPRIETARY_UUID_BASE 0xDA, 0x23, 0x41, 0x02, 0xA3, 0xBB, 0xC1, 0x71, 0xBA, 0x09, 0x6f, 0x21
|
||||
#define BRCM_PROPRIETARY_GUID_BASE 0xda23, 0x4102, 0xa3, 0xbb, 0xc1, 0x71, 0xba, 0x09, 0x6f, 0x21
|
||||
|
||||
/* We will not allocate a PSM in the reserved range to 3rd party apps
|
||||
*/
|
||||
#define BRCM_RESERVED_PSM_START 0x5AE1
|
||||
#define BRCM_RESERVED_PSM_END 0x5AFF
|
||||
|
||||
#define BRCM_UTILITY_SERVICE_PSM 0x5AE1
|
||||
#define BRCM_MATCHER_PSM 0x5AE3
|
||||
|
||||
/* Connection statistics
|
||||
*/
|
||||
|
||||
/* Structure to hold connection stats */
|
||||
#ifndef BT_CONN_STATS_DEFINED
|
||||
#define BT_CONN_STATS_DEFINED
|
||||
|
||||
/* These bits are used in the bIsConnected field */
|
||||
#define BT_CONNECTED_USING_BREDR 1
|
||||
#define BT_CONNECTED_USING_AMP 2
|
||||
|
||||
typedef struct {
|
||||
UINT32 is_connected;
|
||||
INT32 rssi;
|
||||
UINT32 bytes_sent;
|
||||
UINT32 bytes_rcvd;
|
||||
UINT32 duration;
|
||||
} tBT_CONN_STATS;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Low Energy definitions
|
||||
**
|
||||
** Address types
|
||||
*/
|
||||
#define BLE_ADDR_PUBLIC 0x00
|
||||
#define BLE_ADDR_RANDOM 0x01
|
||||
#define BLE_ADDR_PUBLIC_ID 0x02
|
||||
#define BLE_ADDR_RANDOM_ID 0x03
|
||||
#define BLE_ADDR_TYPE_MAX BLE_ADDR_RANDOM_ID
|
||||
#define BLE_ADDR_UNKNOWN_TYPE 0XFF
|
||||
typedef UINT8 tBLE_ADDR_TYPE;
|
||||
#define BLE_ADDR_TYPE_MASK (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)
|
||||
|
||||
#define BT_TRANSPORT_INVALID 0
|
||||
#define BT_TRANSPORT_BR_EDR 1
|
||||
#define BT_TRANSPORT_LE 2
|
||||
typedef UINT8 tBT_TRANSPORT;
|
||||
|
||||
#define BLE_ADDR_IS_STATIC(x) ((x[0] & 0xC0) == 0xC0)
|
||||
|
||||
typedef struct {
|
||||
tBLE_ADDR_TYPE type;
|
||||
BD_ADDR bda;
|
||||
} tBLE_BD_ADDR;
|
||||
|
||||
/* Device Types
|
||||
*/
|
||||
#define BT_DEVICE_TYPE_BREDR 0x01
|
||||
#define BT_DEVICE_TYPE_BLE 0x02
|
||||
#define BT_DEVICE_TYPE_DUMO 0x03
|
||||
typedef UINT8 tBT_DEVICE_TYPE;
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* Define trace levels */
|
||||
#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
|
||||
#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
|
||||
#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
|
||||
#define BT_TRACE_LEVEL_API 3 /* API traces */
|
||||
#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
|
||||
#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
|
||||
#define BT_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */
|
||||
|
||||
#define MAX_TRACE_LEVEL 6
|
||||
|
||||
|
||||
/* Define New Trace Type Definition */
|
||||
/* TRACE_CTRL_TYPE 0x^^000000*/
|
||||
#define TRACE_CTRL_MASK 0xff000000
|
||||
#define TRACE_GET_CTRL(x) ((((UINT32)(x)) & TRACE_CTRL_MASK) >> 24)
|
||||
|
||||
#define TRACE_CTRL_GENERAL 0x00000000
|
||||
#define TRACE_CTRL_STR_RESOURCE 0x01000000
|
||||
#define TRACE_CTRL_SEQ_FLOW 0x02000000
|
||||
#define TRACE_CTRL_MAX_NUM 3
|
||||
|
||||
/* LAYER SPECIFIC 0x00^^0000*/
|
||||
#define TRACE_LAYER_MASK 0x00ff0000
|
||||
#define TRACE_GET_LAYER(x) ((((UINT32)(x)) & TRACE_LAYER_MASK) >> 16)
|
||||
|
||||
#define TRACE_LAYER_NONE 0x00000000
|
||||
#define TRACE_LAYER_USB 0x00010000
|
||||
#define TRACE_LAYER_SERIAL 0x00020000
|
||||
#define TRACE_LAYER_SOCKET 0x00030000
|
||||
#define TRACE_LAYER_RS232 0x00040000
|
||||
#define TRACE_LAYER_TRANS_MAX_NUM 5
|
||||
#define TRACE_LAYER_TRANS_ALL 0x007f0000
|
||||
#define TRACE_LAYER_LC 0x00050000
|
||||
#define TRACE_LAYER_LM 0x00060000
|
||||
#define TRACE_LAYER_HCI 0x00070000
|
||||
#define TRACE_LAYER_L2CAP 0x00080000
|
||||
#define TRACE_LAYER_RFCOMM 0x00090000
|
||||
#define TRACE_LAYER_SDP 0x000a0000
|
||||
#define TRACE_LAYER_TCS 0x000b0000
|
||||
#define TRACE_LAYER_OBEX 0x000c0000
|
||||
#define TRACE_LAYER_BTM 0x000d0000
|
||||
#define TRACE_LAYER_GAP 0x000e0000
|
||||
#define TRACE_LAYER_ICP 0x00110000
|
||||
#define TRACE_LAYER_HSP2 0x00120000
|
||||
#define TRACE_LAYER_SPP 0x00130000
|
||||
#define TRACE_LAYER_CTP 0x00140000
|
||||
#define TRACE_LAYER_BPP 0x00150000
|
||||
#define TRACE_LAYER_HCRP 0x00160000
|
||||
#define TRACE_LAYER_FTP 0x00170000
|
||||
#define TRACE_LAYER_OPP 0x00180000
|
||||
#define TRACE_LAYER_BTU 0x00190000
|
||||
#define TRACE_LAYER_GKI 0x001a0000
|
||||
#define TRACE_LAYER_BNEP 0x001b0000
|
||||
#define TRACE_LAYER_PAN 0x001c0000
|
||||
#define TRACE_LAYER_HFP 0x001d0000
|
||||
#define TRACE_LAYER_HID 0x001e0000
|
||||
#define TRACE_LAYER_BIP 0x001f0000
|
||||
#define TRACE_LAYER_AVP 0x00200000
|
||||
#define TRACE_LAYER_A2D 0x00210000
|
||||
#define TRACE_LAYER_SAP 0x00220000
|
||||
#define TRACE_LAYER_AMP 0x00230000
|
||||
#define TRACE_LAYER_MCA 0x00240000
|
||||
#define TRACE_LAYER_ATT 0x00250000
|
||||
#define TRACE_LAYER_SMP 0x00260000
|
||||
#define TRACE_LAYER_NFC 0x00270000
|
||||
#define TRACE_LAYER_NCI 0x00280000
|
||||
#define TRACE_LAYER_LLCP 0x00290000
|
||||
#define TRACE_LAYER_NDEF 0x002a0000
|
||||
#define TRACE_LAYER_RW 0x002b0000
|
||||
#define TRACE_LAYER_CE 0x002c0000
|
||||
#define TRACE_LAYER_P2P 0x002d0000
|
||||
#define TRACE_LAYER_SNEP 0x002e0000
|
||||
#define TRACE_LAYER_CHO 0x002f0000
|
||||
#define TRACE_LAYER_NFA 0x00300000
|
||||
|
||||
#define TRACE_LAYER_MAX_NUM 0x0031
|
||||
|
||||
|
||||
/* TRACE_ORIGINATOR 0x0000^^00*/
|
||||
#define TRACE_ORG_MASK 0x0000ff00
|
||||
#define TRACE_GET_ORG(x) ((((UINT32)(x)) & TRACE_ORG_MASK) >> 8)
|
||||
|
||||
#define TRACE_ORG_STACK 0x00000000
|
||||
#define TRACE_ORG_HCI_TRANS 0x00000100
|
||||
#define TRACE_ORG_PROTO_DISP 0x00000200
|
||||
#define TRACE_ORG_RPC 0x00000300
|
||||
#define TRACE_ORG_GKI 0x00000400
|
||||
#define TRACE_ORG_APPL 0x00000500
|
||||
#define TRACE_ORG_SCR_WRAPPER 0x00000600
|
||||
#define TRACE_ORG_SCR_ENGINE 0x00000700
|
||||
#define TRACE_ORG_USER_SCR 0x00000800
|
||||
#define TRACE_ORG_TESTER 0x00000900
|
||||
#define TRACE_ORG_MAX_NUM 10 /* 32-bit mask; must be < 32 */
|
||||
#define TRACE_LITE_ORG_MAX_NUM 6
|
||||
#define TRACE_ORG_ALL 0x03ff
|
||||
#define TRACE_ORG_RPC_TRANS 0x04
|
||||
|
||||
#define TRACE_ORG_REG 0x00000909
|
||||
#define TRACE_ORG_REG_SUCCESS 0x0000090a
|
||||
|
||||
/* TRACE_TYPE 0x000000^^*/
|
||||
#define TRACE_TYPE_MASK 0x000000ff
|
||||
#define TRACE_GET_TYPE(x) (((UINT32)(x)) & TRACE_TYPE_MASK)
|
||||
|
||||
#define TRACE_TYPE_ERROR 0x00000000
|
||||
#define TRACE_TYPE_WARNING 0x00000001
|
||||
#define TRACE_TYPE_API 0x00000002
|
||||
#define TRACE_TYPE_EVENT 0x00000003
|
||||
#define TRACE_TYPE_DEBUG 0x00000004
|
||||
#define TRACE_TYPE_STACK_ONLY_MAX TRACE_TYPE_DEBUG
|
||||
#define TRACE_TYPE_TX 0x00000005
|
||||
#define TRACE_TYPE_RX 0x00000006
|
||||
#define TRACE_TYPE_DEBUG_ASSERT 0x00000007
|
||||
#define TRACE_TYPE_GENERIC 0x00000008
|
||||
#define TRACE_TYPE_REG 0x00000009
|
||||
#define TRACE_TYPE_REG_SUCCESS 0x0000000a
|
||||
#define TRACE_TYPE_CMD_TX 0x0000000b
|
||||
#define TRACE_TYPE_EVT_TX 0x0000000c
|
||||
#define TRACE_TYPE_ACL_TX 0x0000000d
|
||||
#define TRACE_TYPE_CMD_RX 0x0000000e
|
||||
#define TRACE_TYPE_EVT_RX 0x0000000f
|
||||
#define TRACE_TYPE_ACL_RX 0x00000010
|
||||
#define TRACE_TYPE_TARGET_TRACE 0x00000011
|
||||
#define TRACE_TYPE_SCO_TX 0x00000012
|
||||
#define TRACE_TYPE_SCO_RX 0x00000013
|
||||
|
||||
|
||||
#define TRACE_TYPE_MAX_NUM 20
|
||||
#define TRACE_TYPE_ALL 0xffff
|
||||
|
||||
/* Define color for script type */
|
||||
#define SCR_COLOR_DEFAULT 0
|
||||
#define SCR_COLOR_TYPE_COMMENT 1
|
||||
#define SCR_COLOR_TYPE_COMMAND 2
|
||||
#define SCR_COLOR_TYPE_EVENT 3
|
||||
#define SCR_COLOR_TYPE_SELECT 4
|
||||
|
||||
/* Define protocol trace flag values */
|
||||
#define SCR_PROTO_TRACE_HCI_SUMMARY 0x00000001
|
||||
#define SCR_PROTO_TRACE_HCI_DATA 0x00000002
|
||||
#define SCR_PROTO_TRACE_L2CAP 0x00000004
|
||||
#define SCR_PROTO_TRACE_RFCOMM 0x00000008
|
||||
#define SCR_PROTO_TRACE_SDP 0x00000010
|
||||
#define SCR_PROTO_TRACE_TCS 0x00000020
|
||||
#define SCR_PROTO_TRACE_OBEX 0x00000040
|
||||
#define SCR_PROTO_TRACE_OAPP 0x00000080 /* OBEX Application Profile */
|
||||
#define SCR_PROTO_TRACE_AMP 0x00000100
|
||||
#define SCR_PROTO_TRACE_BNEP 0x00000200
|
||||
#define SCR_PROTO_TRACE_AVP 0x00000400
|
||||
#define SCR_PROTO_TRACE_MCA 0x00000800
|
||||
#define SCR_PROTO_TRACE_ATT 0x00001000
|
||||
#define SCR_PROTO_TRACE_SMP 0x00002000
|
||||
#define SCR_PROTO_TRACE_NCI 0x00004000
|
||||
#define SCR_PROTO_TRACE_LLCP 0x00008000
|
||||
#define SCR_PROTO_TRACE_NDEF 0x00010000
|
||||
#define SCR_PROTO_TRACE_RW 0x00020000
|
||||
#define SCR_PROTO_TRACE_CE 0x00040000
|
||||
#define SCR_PROTO_TRACE_SNEP 0x00080000
|
||||
#define SCR_PROTO_TRACE_CHO 0x00100000
|
||||
#define SCR_PROTO_TRACE_ALL 0x001fffff
|
||||
#define SCR_PROTO_TRACE_HCI_LOGGING_VSE 0x0800 /* Brcm vs event for logmsg and protocol traces */
|
||||
|
||||
#define MAX_SCRIPT_TYPE 5
|
||||
|
||||
#define TCS_PSM_INTERCOM 5
|
||||
#define TCS_PSM_CORDLESS 7
|
||||
#define BT_PSM_BNEP 0x000F
|
||||
/* Define PSMs HID uses */
|
||||
#define HID_PSM_CONTROL 0x0011
|
||||
#define HID_PSM_INTERRUPT 0x0013
|
||||
|
||||
/* Define a function for logging */
|
||||
typedef void (BT_LOG_FUNC) (int trace_type, const char *fmt_str, ...);
|
||||
|
||||
/* bd addr length and type */
|
||||
#ifndef BD_ADDR_LEN
|
||||
#define BD_ADDR_LEN 6
|
||||
typedef uint8_t BD_ADDR[BD_ADDR_LEN];
|
||||
#endif
|
||||
|
||||
// From bd.c
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
/* global constant for "any" bd addr */
|
||||
static const BD_ADDR bd_addr_any = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||
static const BD_ADDR bd_addr_null = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
/*****************************************************************************
|
||||
** Functions
|
||||
*****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bdcpy
|
||||
**
|
||||
** Description Copy bd addr b to a.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static inline void bdcpy(BD_ADDR a, const BD_ADDR b)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = BD_ADDR_LEN; i != 0; i--) {
|
||||
*a++ = *b++;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bdcmp
|
||||
**
|
||||
** Description Compare bd addr b to a.
|
||||
**
|
||||
**
|
||||
** Returns Zero if b==a, nonzero otherwise (like memcmp).
|
||||
**
|
||||
*******************************************************************************/
|
||||
static inline int bdcmp(const BD_ADDR a, const BD_ADDR b)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = BD_ADDR_LEN; i != 0; i--) {
|
||||
if (*a++ != *b++) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bdcmpany
|
||||
**
|
||||
** Description Compare bd addr to "any" bd addr.
|
||||
**
|
||||
**
|
||||
** Returns Zero if a equals bd_addr_any.
|
||||
**
|
||||
*******************************************************************************/
|
||||
static inline int bdcmpany(const BD_ADDR a)
|
||||
{
|
||||
return bdcmp(a, bd_addr_any);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bdsetany
|
||||
**
|
||||
** Description Set bd addr to "any" bd addr.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static inline void bdsetany(BD_ADDR a)
|
||||
{
|
||||
bdcpy(a, bd_addr_any);
|
||||
}
|
||||
#endif
|
4101
tools/sdk/include/bluedroid/stack/btm_api.h
Normal file
4101
tools/sdk/include/bluedroid/stack/btm_api.h
Normal file
File diff suppressed because it is too large
Load Diff
2041
tools/sdk/include/bluedroid/stack/btm_ble_api.h
Normal file
2041
tools/sdk/include/bluedroid/stack/btm_ble_api.h
Normal file
File diff suppressed because it is too large
Load Diff
285
tools/sdk/include/bluedroid/stack/btu.h
Normal file
285
tools/sdk/include/bluedroid/stack/btu.h
Normal file
@ -0,0 +1,285 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains the main Bluetooth Upper Layer definitions. The Broadcom
|
||||
* implementations of L2CAP RFCOMM, SDP and the BTIf run as one GKI task. The
|
||||
* btu_task switches between them.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BTU_H
|
||||
#define BTU_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
|
||||
// HACK(zachoverflow): temporary dark magic
|
||||
#define BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK 0x1700 // didn't look used in bt_types...here goes nothing
|
||||
typedef struct {
|
||||
void (*callback)(BT_HDR *);
|
||||
} post_to_task_hack_t;
|
||||
|
||||
typedef struct {
|
||||
void (*callback)(BT_HDR *);
|
||||
BT_HDR *response;
|
||||
void *context;
|
||||
} command_complete_hack_t;
|
||||
|
||||
typedef struct {
|
||||
void (*callback)(BT_HDR *);
|
||||
uint8_t status;
|
||||
BT_HDR *command;
|
||||
void *context;
|
||||
} command_status_hack_t;
|
||||
|
||||
/* callbacks
|
||||
*/
|
||||
typedef void (*tBTU_TIMER_CALLBACK)(TIMER_LIST_ENT *p_tle);
|
||||
typedef void (*tBTU_EVENT_CALLBACK)(BT_HDR *p_hdr);
|
||||
|
||||
|
||||
/* Define the timer types maintained by BTU
|
||||
*/
|
||||
#define BTU_TTYPE_BTM_DEV_CTL 1
|
||||
#define BTU_TTYPE_L2CAP_LINK 2
|
||||
#define BTU_TTYPE_L2CAP_CHNL 3
|
||||
#define BTU_TTYPE_L2CAP_HOLD 4
|
||||
#define BTU_TTYPE_SDP 5
|
||||
#define BTU_TTYPE_BTM_SCO 6
|
||||
#define BTU_TTYPE_BTM_ACL 9
|
||||
#define BTU_TTYPE_BTM_RMT_NAME 10
|
||||
#define BTU_TTYPE_RFCOMM_MFC 11
|
||||
#define BTU_TTYPE_RFCOMM_PORT 12
|
||||
#define BTU_TTYPE_TCS_L2CAP 13
|
||||
#define BTU_TTYPE_TCS_CALL 14
|
||||
#define BTU_TTYPE_TCS_WUG 15
|
||||
#define BTU_TTYPE_AUTO_SYNC 16
|
||||
#define BTU_TTYPE_CTP_RECON 17
|
||||
#define BTU_TTYPE_CTP_T100 18
|
||||
#define BTU_TTYPE_CTP_GUARD 19
|
||||
#define BTU_TTYPE_CTP_DETACH 20
|
||||
|
||||
#define BTU_TTYPE_SPP_CONN_RETRY 21
|
||||
#define BTU_TTYPE_USER_FUNC 22
|
||||
|
||||
#define BTU_TTYPE_FTP_DISC 25
|
||||
#define BTU_TTYPE_OPP_DISC 26
|
||||
|
||||
#define BTU_TTYPE_CTP_TL_DISCVY 28
|
||||
#define BTU_TTYPE_IPFRAG_TIMER 29
|
||||
#define BTU_TTYPE_HSP2_AT_CMD_TO 30
|
||||
#define BTU_TTYPE_HSP2_REPEAT_RING 31
|
||||
|
||||
#define BTU_TTYPE_CTP_GW_INIT 32
|
||||
#define BTU_TTYPE_CTP_GW_CONN 33
|
||||
#define BTU_TTYPE_CTP_GW_IDLE 35
|
||||
|
||||
#define BTU_TTYPE_ICP_L2CAP 36
|
||||
#define BTU_TTYPE_ICP_T100 37
|
||||
|
||||
#define BTU_TTYPE_HSP2_WAIT_OK 38
|
||||
|
||||
/* HCRP Timers */
|
||||
#define BTU_TTYPE_HCRP_NOTIF_REG 39
|
||||
#define BTU_TTYPE_HCRP_PROTO_RSP 40
|
||||
#define BTU_TTYPE_HCRP_CR_GRANT 41
|
||||
#define BTU_TTYPE_HCRP_CR_CHECK 42
|
||||
#define BTU_TTYPE_HCRP_W4_CLOSE 43
|
||||
|
||||
/* HCRPM Timers */
|
||||
#define BTU_TTYPE_HCRPM_NOTIF_REG 44
|
||||
#define BTU_TTYPE_HCRPM_NOTIF_KEEP 45
|
||||
#define BTU_TTYPE_HCRPM_API_RSP 46
|
||||
#define BTU_TTYPE_HCRPM_W4_OPEN 47
|
||||
#define BTU_TTYPE_HCRPM_W4_CLOSE 48
|
||||
|
||||
/* BNEP Timers */
|
||||
#define BTU_TTYPE_BNEP 50
|
||||
|
||||
#define BTU_TTYPE_HSP2_SDP_FAIL_TO 55
|
||||
#define BTU_TTYPE_HSP2_SDP_RTRY_TO 56
|
||||
|
||||
/* BTU internal */
|
||||
/* unused 60 */
|
||||
|
||||
#define BTU_TTYPE_AVDT_CCB_RET 61
|
||||
#define BTU_TTYPE_AVDT_CCB_RSP 62
|
||||
#define BTU_TTYPE_AVDT_CCB_IDLE 63
|
||||
#define BTU_TTYPE_AVDT_SCB_TC 64
|
||||
|
||||
#define BTU_TTYPE_HID_DEV_REPAGE_TO 65
|
||||
#define BTU_TTYPE_HID_HOST_REPAGE_TO 66
|
||||
|
||||
#define BTU_TTYPE_HSP2_DELAY_CKPD_RCV 67
|
||||
|
||||
#define BTU_TTYPE_SAP_TO 68
|
||||
|
||||
/* BPP Timer */
|
||||
#define BTU_TTYPE_BPP_REF_CHNL 72
|
||||
|
||||
/* LP HC idle Timer */
|
||||
#define BTU_TTYPE_LP_HC_IDLE_TO 74
|
||||
|
||||
/* Patch RAM Timer */
|
||||
#define BTU_TTYPE_PATCHRAM_TO 75
|
||||
|
||||
/* eL2CAP Info Request and other proto cmds timer */
|
||||
#define BTU_TTYPE_L2CAP_FCR_ACK 78
|
||||
#define BTU_TTYPE_L2CAP_INFO 79
|
||||
/* L2CAP update connection parameters timer */
|
||||
#define BTU_TTYPE_L2CAP_UPDA_CONN_PARAMS 80
|
||||
|
||||
#define BTU_TTYPE_MCA_CCB_RSP 98
|
||||
|
||||
/* BTU internal timer for BLE activity */
|
||||
#define BTU_TTYPE_BLE_INQUIRY 99
|
||||
#define BTU_TTYPE_BLE_GAP_LIM_DISC 100
|
||||
#define BTU_TTYPE_ATT_WAIT_FOR_RSP 101
|
||||
#define BTU_TTYPE_SMP_PAIRING_CMD 102
|
||||
#define BTU_TTYPE_BLE_RANDOM_ADDR 103
|
||||
#define BTU_TTYPE_ATT_WAIT_FOR_APP_RSP 104
|
||||
#define BTU_TTYPE_ATT_WAIT_FOR_IND_ACK 105
|
||||
|
||||
#define BTU_TTYPE_BLE_GAP_FAST_ADV 106
|
||||
#define BTU_TTYPE_BLE_OBSERVE 107
|
||||
|
||||
#define BTU_TTYPE_UCD_TO 108
|
||||
#define BTU_TTYPE_BLE_SCAN 109
|
||||
|
||||
|
||||
/* This is the inquiry response information held by BTU, and available
|
||||
** to applications.
|
||||
*/
|
||||
typedef struct {
|
||||
BD_ADDR remote_bd_addr;
|
||||
UINT8 page_scan_rep_mode;
|
||||
UINT8 page_scan_per_mode;
|
||||
UINT8 page_scan_mode;
|
||||
DEV_CLASS dev_class;
|
||||
UINT16 clock_offset;
|
||||
} tBTU_INQ_INFO;
|
||||
|
||||
|
||||
|
||||
#define BTU_MAX_REG_TIMER (2) /* max # timer callbacks which may register */
|
||||
#define BTU_MAX_REG_EVENT (6) /* max # event callbacks which may register */
|
||||
#define BTU_DEFAULT_DATA_SIZE (0x2a0)
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
#define BTU_DEFAULT_BLE_DATA_SIZE (27)
|
||||
#endif
|
||||
|
||||
/* structure to hold registered timers */
|
||||
typedef struct {
|
||||
TIMER_LIST_ENT *p_tle; /* timer entry */
|
||||
tBTU_TIMER_CALLBACK timer_cb; /* callback triggered when timer expires */
|
||||
} tBTU_TIMER_REG;
|
||||
|
||||
/* structure to hold registered event callbacks */
|
||||
typedef struct {
|
||||
UINT16 event_range; /* start of event range */
|
||||
tBTU_EVENT_CALLBACK event_cb; /* callback triggered when event is in range */
|
||||
} tBTU_EVENT_REG;
|
||||
|
||||
#define NFC_MAX_LOCAL_CTRLS 0
|
||||
|
||||
/* the index to BTU command queue array */
|
||||
#define NFC_CONTROLLER_ID (1)
|
||||
#define BTU_MAX_LOCAL_CTRLS (1 + NFC_MAX_LOCAL_CTRLS) /* only BR/EDR */
|
||||
|
||||
/* Define structure holding BTU variables
|
||||
*/
|
||||
typedef struct {
|
||||
tBTU_TIMER_REG timer_reg[BTU_MAX_REG_TIMER];
|
||||
tBTU_EVENT_REG event_reg[BTU_MAX_REG_EVENT];
|
||||
|
||||
BOOLEAN reset_complete; /* TRUE after first ack from device received */
|
||||
UINT8 trace_level; /* Trace level for HCI layer */
|
||||
} tBTU_CB;
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
*/
|
||||
/* Global BTU data */
|
||||
#if BTU_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTU_CB btu_cb;
|
||||
#else
|
||||
extern tBTU_CB *btu_cb_ptr;
|
||||
#define btu_cb (*btu_cb_ptr)
|
||||
#endif
|
||||
|
||||
extern const BD_ADDR BT_BD_ANY;
|
||||
|
||||
/* Functions provided by btu_task.c
|
||||
************************************
|
||||
*/
|
||||
void btu_start_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
|
||||
void btu_stop_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_free_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_start_timer_oneshot(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
|
||||
void btu_stop_timer_oneshot(TIMER_LIST_ENT *p_tle);
|
||||
|
||||
void btu_uipc_rx_cback(BT_HDR *p_msg);
|
||||
|
||||
/*
|
||||
** Quick Timer
|
||||
*/
|
||||
#if defined(QUICK_TIMER_TICKS_PER_SEC) && (QUICK_TIMER_TICKS_PER_SEC > 0)
|
||||
void btu_start_quick_timer (TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout);
|
||||
void btu_stop_quick_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_free_quick_timer (TIMER_LIST_ENT *p_tle);
|
||||
void btu_process_quick_timer_evt (void);
|
||||
#endif
|
||||
|
||||
#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
|
||||
void btu_check_bt_sleep (void);
|
||||
#endif
|
||||
|
||||
/* Functions provided by btu_hcif.c
|
||||
************************************
|
||||
*/
|
||||
void btu_hcif_process_event (UINT8 controller_id, BT_HDR *p_buf);
|
||||
void btu_hcif_send_cmd (UINT8 controller_id, BT_HDR *p_msg);
|
||||
void btu_hcif_send_host_rdy_for_data(void);
|
||||
void btu_hcif_cmd_timeout (UINT8 controller_id);
|
||||
|
||||
/* Functions provided by btu_core.c
|
||||
************************************
|
||||
*/
|
||||
void btu_init_core(void);
|
||||
void btu_free_core(void);
|
||||
|
||||
void BTU_StartUp(void);
|
||||
void BTU_ShutDown(void);
|
||||
|
||||
void btu_task_start_up(void);
|
||||
void btu_task_shut_down(void);
|
||||
|
||||
UINT16 BTU_BleAclPktSize(void);
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
217
tools/sdk/include/bluedroid/stack/dyn_mem.h
Normal file
217
tools/sdk/include/bluedroid/stack/dyn_mem.h
Normal file
@ -0,0 +1,217 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 DYN_MEM_H
|
||||
#define DYN_MEM_H
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY
|
||||
#define BTU_DYNAMIC_MEMORY TRUE
|
||||
#define BTM_DYNAMIC_MEMORY TRUE
|
||||
#define L2C_DYNAMIC_MEMORY TRUE
|
||||
#define GATT_DYNAMIC_MEMORY TRUE
|
||||
#define SMP_DYNAMIC_MEMORY TRUE
|
||||
#define BTA_DYNAMIC_MEMORY TRUE
|
||||
#define SDP_DYNAMIC_MEMORY TRUE
|
||||
#define RFC_DYNAMIC_MEMORY TRUE
|
||||
#define TCS_DYNAMIC_MEMORY TRUE
|
||||
#define BNEP_DYNAMIC_MEMORY TRUE
|
||||
#define AVDT_DYNAMIC_MEMORY TRUE
|
||||
#define AVCT_DYNAMIC_MEMORY TRUE
|
||||
#define MCA_DYNAMIC_MEMORY TRUE
|
||||
#define A2D_DYNAMIC_MEMORY TRUE
|
||||
#define VDP_DYNAMIC_MEMORY TRUE
|
||||
#define AVRC_DYNAMIC_MEMORY TRUE
|
||||
#define BIP_DYNAMIC_MEMORY TRUE
|
||||
#define BPP_DYNAMIC_MEMORY TRUE
|
||||
#define CTP_DYNAMIC_MEMORY TRUE
|
||||
#define FTP_DYNAMIC_MEMORY TRUE
|
||||
#define HCRP_DYNAMIC_MEMORY TRUE
|
||||
#define HFP_DYNAMIC_MEMORY TRUE
|
||||
#define HID_DYNAMIC_MEMORY TRUE
|
||||
#define HSP2_DYNAMIC_MEMORY TRUE
|
||||
#define ICP_DYNAMIC_MEMORY TRUE
|
||||
#define OPP_DYNAMIC_MEMORY TRUE
|
||||
#define PAN_DYNAMIC_MEMORY TRUE
|
||||
#define SPP_DYNAMIC_MEMORY TRUE
|
||||
#define SLIP_DYNAMIC_MEMORY TRUE
|
||||
#define LLCP_DYNAMIC_MEMORY TRUE
|
||||
#define BTC_SBC_DEC_DYNAMIC_MEMORY TRUE
|
||||
|
||||
#else /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
|
||||
|
||||
#define SDP_DYNAMIC_MEMORY FALSE
|
||||
#define RFC_DYNAMIC_MEMORY FALSE
|
||||
#define TCS_DYNAMIC_MEMORY FALSE
|
||||
#define BNEP_DYNAMIC_MEMORY FALSE
|
||||
#define AVDT_DYNAMIC_MEMORY FALSE
|
||||
#define AVCT_DYNAMIC_MEMORY FALSE
|
||||
#define MCA_DYNAMIC_MEMORY FALSE
|
||||
#define A2D_DYNAMIC_MEMORY FALSE
|
||||
#define VDP_DYNAMIC_MEMORY FALSE
|
||||
#define AVRC_DYNAMIC_MEMORY FALSE
|
||||
#define BIP_DYNAMIC_MEMORY FALSE
|
||||
#define BPP_DYNAMIC_MEMORY FALSE
|
||||
#define CTP_DYNAMIC_MEMORY FALSE
|
||||
#define FTP_DYNAMIC_MEMORY FALSE
|
||||
#define HCRP_DYNAMIC_MEMORY FALSE
|
||||
#define HFP_DYNAMIC_MEMORY FALSE
|
||||
#define HID_DYNAMIC_MEMORY FALSE
|
||||
#define HSP2_DYNAMIC_MEMORY FALSE
|
||||
#define ICP_DYNAMIC_MEMORY FALSE
|
||||
#define OPP_DYNAMIC_MEMORY FALSE
|
||||
#define PAN_DYNAMIC_MEMORY FALSE
|
||||
#define SPP_DYNAMIC_MEMORY FALSE
|
||||
#define SLIP_DYNAMIC_MEMORY FALSE
|
||||
#define LLCP_DYNAMIC_MEMORY FALSE
|
||||
#define BTC_SBC_DEC_DYNAMIC_MEMORY FALSE
|
||||
|
||||
#endif /* #if CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY */
|
||||
/****************************************************************************
|
||||
** Define memory usage for each CORE component (if not defined in bdroid_buildcfg.h)
|
||||
** The default for each component is to use static memory allocations.
|
||||
*/
|
||||
#ifndef BTU_DYNAMIC_MEMORY
|
||||
#define BTU_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BTM_DYNAMIC_MEMORY
|
||||
#define BTM_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SDP_DYNAMIC_MEMORY
|
||||
#define SDP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef L2C_DYNAMIC_MEMORY
|
||||
#define L2C_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef RFC_DYNAMIC_MEMORY
|
||||
#define RFC_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef TCS_DYNAMIC_MEMORY
|
||||
#define TCS_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BNEP_DYNAMIC_MEMORY
|
||||
#define BNEP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef AVDT_DYNAMIC_MEMORY
|
||||
#define AVDT_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef AVCT_DYNAMIC_MEMORY
|
||||
#define AVCT_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef MCA_DYNAMIC_MEMORY
|
||||
#define MCA_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef GATT_DYNAMIC_MEMORY
|
||||
#define GATT_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SMP_DYNAMIC_MEMORY
|
||||
#define SMP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
** Define memory usage for each PROFILE component (if not defined in bdroid_buildcfg.h)
|
||||
** The default for each component is to use static memory allocations.
|
||||
*/
|
||||
#ifndef A2D_DYNAMIC_MEMORY
|
||||
#define A2D_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef VDP_DYNAMIC_MEMORY
|
||||
#define VDP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef AVRC_DYNAMIC_MEMORY
|
||||
#define AVRC_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BIP_DYNAMIC_MEMORY
|
||||
#define BIP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BPP_DYNAMIC_MEMORY
|
||||
#define BPP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef CTP_DYNAMIC_MEMORY
|
||||
#define CTP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef FTP_DYNAMIC_MEMORY
|
||||
#define FTP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef HCRP_DYNAMIC_MEMORY
|
||||
#define HCRP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef HFP_DYNAMIC_MEMORY
|
||||
#define HFP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef HID_DYNAMIC_MEMORY
|
||||
#define HID_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef HSP2_DYNAMIC_MEMORY
|
||||
#define HSP2_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef ICP_DYNAMIC_MEMORY
|
||||
#define ICP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef OPP_DYNAMIC_MEMORY
|
||||
#define OPP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef PAN_DYNAMIC_MEMORY
|
||||
#define PAN_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SPP_DYNAMIC_MEMORY
|
||||
#define SPP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef SLIP_DYNAMIC_MEMORY
|
||||
#define SLIP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#ifndef LLCP_DYNAMIC_MEMORY
|
||||
#define LLCP_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
** Define memory usage for BTA (if not defined in bdroid_buildcfg.h)
|
||||
** The default for each component is to use static memory allocations.
|
||||
*/
|
||||
#ifndef BTA_DYNAMIC_MEMORY
|
||||
#define BTA_DYNAMIC_MEMORY FALSE
|
||||
#endif
|
||||
|
||||
#endif /* #ifdef DYN_MEM_H */
|
||||
|
391
tools/sdk/include/bluedroid/stack/gap_api.h
Normal file
391
tools/sdk/include/bluedroid/stack/gap_api.h
Normal file
@ -0,0 +1,391 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef GAP_API_H
|
||||
#define GAP_API_H
|
||||
|
||||
#include "stack/sdpdefs.h"
|
||||
#include "stack/profiles_api.h"
|
||||
#include "stack/btm_api.h"
|
||||
#include "stack/l2c_api.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
/*** GAP Error and Status Codes ***/
|
||||
#define GAP_UNSUPPORTED (GAP_ERR_GRP + 0x01) /* Unsupported call */
|
||||
#define GAP_EOINQDB (GAP_ERR_GRP + 0x02) /* End of inquiry database marker */
|
||||
#define GAP_ERR_BUSY (GAP_ERR_GRP + 0x03) /* The requested function was busy */
|
||||
#define GAP_ERR_NO_CTRL_BLK (GAP_ERR_GRP + 0x04) /* No control blocks available */
|
||||
#define GAP_ERR_STARTING_CMD (GAP_ERR_GRP + 0x05) /* Error occurred while initiating the command */
|
||||
#define GAP_NO_BDADDR_REC (GAP_ERR_GRP + 0x06) /* No Inquiry DB record for BD_ADDR */
|
||||
#define GAP_ERR_ILL_MODE (GAP_ERR_GRP + 0x07) /* An illegal mode parameter was detected */
|
||||
#define GAP_ERR_ILL_INQ_TIME (GAP_ERR_GRP + 0x08) /* An illegal time parameter was detected */
|
||||
#define GAP_ERR_ILL_PARM (GAP_ERR_GRP + 0x09) /* An illegal parameter was detected */
|
||||
#define GAP_ERR_REM_NAME (GAP_ERR_GRP + 0x0a) /* Error starting the remote device name request */
|
||||
#define GAP_CMD_INITIATED (GAP_ERR_GRP + 0x0b) /* The GAP command was started (result pending) */
|
||||
#define GAP_DEVICE_NOT_UP (GAP_ERR_GRP + 0x0c) /* The device was not up; the request was not executed */
|
||||
#define GAP_BAD_BD_ADDR (GAP_ERR_GRP + 0x0d) /* The bd addr passed in was not found or invalid */
|
||||
|
||||
#define GAP_ERR_BAD_HANDLE (GAP_ERR_GRP + 0x0e) /* Bad GAP handle */
|
||||
#define GAP_ERR_BUF_OFFSET (GAP_ERR_GRP + 0x0f) /* Buffer offset invalid */
|
||||
#define GAP_ERR_BAD_STATE (GAP_ERR_GRP + 0x10) /* Connection is in invalid state */
|
||||
#define GAP_NO_DATA_AVAIL (GAP_ERR_GRP + 0x11) /* No data available */
|
||||
#define GAP_ERR_CONGESTED (GAP_ERR_GRP + 0x12) /* BT stack is congested */
|
||||
#define GAP_ERR_SECURITY (GAP_ERR_GRP + 0x13) /* Security failed */
|
||||
|
||||
#define GAP_ERR_PROCESSING (GAP_ERR_GRP + 0x14) /* General error processing BTM request */
|
||||
#define GAP_ERR_TIMEOUT (GAP_ERR_GRP + 0x15) /* Timeout occurred while processing cmd */
|
||||
#define GAP_EVT_CONN_OPENED 0x0100
|
||||
#define GAP_EVT_CONN_CLOSED 0x0101
|
||||
#define GAP_EVT_CONN_DATA_AVAIL 0x0102
|
||||
#define GAP_EVT_CONN_CONGESTED 0x0103
|
||||
#define GAP_EVT_CONN_UNCONGESTED 0x0104
|
||||
/* Values for 'chan_mode_mask' field */
|
||||
/* GAP_ConnOpen() - optional channels to negotiate */
|
||||
#define GAP_FCR_CHAN_OPT_BASIC L2CAP_FCR_CHAN_OPT_BASIC
|
||||
#define GAP_FCR_CHAN_OPT_ERTM L2CAP_FCR_CHAN_OPT_ERTM
|
||||
#define GAP_FCR_CHAN_OPT_STREAM L2CAP_FCR_CHAN_OPT_STREAM
|
||||
/*** used in connection variables and functions ***/
|
||||
#define GAP_INVALID_HANDLE 0xFFFF
|
||||
|
||||
/* This is used to change the criteria for AMP */
|
||||
#define GAP_PROTOCOL_ID (UUID_PROTOCOL_UDP)
|
||||
|
||||
|
||||
#ifndef GAP_PREFER_CONN_INT_MAX
|
||||
#define GAP_PREFER_CONN_INT_MAX BTM_BLE_CONN_INT_MIN
|
||||
#endif
|
||||
|
||||
#ifndef GAP_PREFER_CONN_INT_MIN
|
||||
#define GAP_PREFER_CONN_INT_MIN BTM_BLE_CONN_INT_MIN
|
||||
#endif
|
||||
|
||||
#ifndef GAP_PREFER_CONN_LATENCY
|
||||
#define GAP_PREFER_CONN_LATENCY 0
|
||||
#endif
|
||||
|
||||
#ifndef GAP_PREFER_CONN_SP_TOUT
|
||||
#define GAP_PREFER_CONN_SP_TOUT 2000
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
/*
|
||||
** Callback function for connection services
|
||||
*/
|
||||
typedef void (tGAP_CONN_CALLBACK) (UINT16 gap_handle, UINT16 event);
|
||||
|
||||
/*
|
||||
** Define the callback function prototypes. Parameters are specific
|
||||
** to each event and are described below
|
||||
*/
|
||||
typedef void (tGAP_CALLBACK) (UINT16 event, void *p_data);
|
||||
|
||||
|
||||
/* Definition of the GAP_FindAddrByName results structure */
|
||||
typedef struct {
|
||||
UINT16 status;
|
||||
BD_ADDR bd_addr;
|
||||
tBTM_BD_NAME devname;
|
||||
} tGAP_FINDADDR_RESULTS;
|
||||
|
||||
typedef struct {
|
||||
UINT16 int_min;
|
||||
UINT16 int_max;
|
||||
UINT16 latency;
|
||||
UINT16 sp_tout;
|
||||
} tGAP_BLE_PREF_PARAM;
|
||||
|
||||
typedef union {
|
||||
tGAP_BLE_PREF_PARAM conn_param;
|
||||
BD_ADDR reconn_bda;
|
||||
UINT16 icon;
|
||||
UINT8 *p_dev_name;
|
||||
UINT8 addr_resolution;
|
||||
|
||||
} tGAP_BLE_ATTR_VALUE;
|
||||
|
||||
typedef void (tGAP_BLE_CMPL_CBACK)(BOOLEAN status, BD_ADDR addr, UINT16 length, char *p_name);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
|
||||
/*** Functions for L2CAP connection interface ***/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnOpen
|
||||
**
|
||||
** Description This function is called to open a generic L2CAP connection.
|
||||
**
|
||||
** Returns handle of the connection if successful, else GAP_INVALID_HANDLE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnOpen (const char *p_serv_name, UINT8 service_id, BOOLEAN is_server,
|
||||
BD_ADDR p_rem_bda, UINT16 psm, tL2CAP_CFG_INFO *p_cfg,
|
||||
tL2CAP_ERTM_INFO *ertm_info,
|
||||
UINT16 security, UINT8 chan_mode_mask, tGAP_CONN_CALLBACK *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnClose
|
||||
**
|
||||
** Description This function is called to close a connection.
|
||||
**
|
||||
** Returns BT_PASS - closed OK
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnClose (UINT16 gap_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnReadData
|
||||
**
|
||||
** Description GKI buffer unaware application will call this function
|
||||
** after receiving GAP_EVT_RXDATA event. A data copy is made
|
||||
** into the receive buffer parameter.
|
||||
**
|
||||
** Returns BT_PASS - data read
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
** GAP_NO_DATA_AVAIL - no data available
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnReadData (UINT16 gap_handle, UINT8 *p_data,
|
||||
UINT16 max_len, UINT16 *p_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_GetRxQueueCnt
|
||||
**
|
||||
** Description This function return number of bytes on the rx queue.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the GAP_ConnOpen
|
||||
** p_rx_queue_count - Pointer to return queue count in.
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int GAP_GetRxQueueCnt (UINT16 handle, UINT32 *p_rx_queue_count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnBTRead
|
||||
**
|
||||
** Description GKI buffer aware applications will call this function after
|
||||
** receiving an GAP_EVT_RXDATA event to process the incoming
|
||||
** data buffer.
|
||||
**
|
||||
** Returns BT_PASS - data read
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
** GAP_NO_DATA_AVAIL - no data available
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnBTWrite
|
||||
**
|
||||
** Description GKI buffer aware applications can call this function to write data
|
||||
** by passing a pointer to the GKI buffer of data.
|
||||
**
|
||||
** Returns BT_PASS - data read
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
** GAP_ERR_BAD_STATE - connection not established
|
||||
** GAP_INVALID_BUF_OFFSET - buffer offset is invalid
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnBTWrite (UINT16 gap_handle, BT_HDR *p_buf);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnWriteData
|
||||
**
|
||||
** Description GKI buffer unaware application will call this function
|
||||
** to send data to the connection. A data copy is made into a GKI
|
||||
** buffer.
|
||||
**
|
||||
** Returns BT_PASS - data read
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
** GAP_ERR_BAD_STATE - connection not established
|
||||
** GAP_CONGESTION - system is congested
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnWriteData (UINT16 gap_handle, UINT8 *p_data,
|
||||
UINT16 max_len, UINT16 *p_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnReconfig
|
||||
**
|
||||
** Description Applications can call this function to reconfigure the connection.
|
||||
**
|
||||
** Returns BT_PASS - config process started
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnReconfig (UINT16 gap_handle, tL2CAP_CFG_INFO *p_cfg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnSetIdleTimeout
|
||||
**
|
||||
** Description Higher layers call this function to set the idle timeout for
|
||||
** a connection, or for all future connections. The "idle timeout"
|
||||
** is the amount of time that a connection can remain up with
|
||||
** no L2CAP channels on it. A timeout of zero means that the
|
||||
** connection will be torn down immediately when the last channel
|
||||
** is removed. A timeout of 0xFFFF means no timeout. Values are
|
||||
** in seconds.
|
||||
**
|
||||
** Returns BT_PASS - config process started
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnSetIdleTimeout (UINT16 gap_handle, UINT16 timeout);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnGetRemoteAddr
|
||||
**
|
||||
** Description This function is called to get the remote BD address
|
||||
** of a connection.
|
||||
**
|
||||
** Returns BT_PASS - closed OK
|
||||
** GAP_ERR_BAD_HANDLE - invalid handle
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 *GAP_ConnGetRemoteAddr (UINT16 gap_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnGetRemMtuSize
|
||||
**
|
||||
** Description Returns the remote device's MTU size.
|
||||
**
|
||||
** Returns UINT16 - maximum size buffer that can be transmitted to the peer
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnGetRemMtuSize (UINT16 gap_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_ConnGetL2CAPCid
|
||||
**
|
||||
** Description Returns the L2CAP channel id
|
||||
**
|
||||
** Parameters: handle - Handle of the connection
|
||||
**
|
||||
** Returns UINT16 - The L2CAP channel id
|
||||
** 0, if error
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GAP_ConnGetL2CAPCid (UINT16 gap_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_SetTraceLevel
|
||||
**
|
||||
** Description This function sets the trace level for GAP. If called with
|
||||
** a value of 0xFF, it simply returns the current trace level.
|
||||
**
|
||||
** Returns The new or current trace level
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 GAP_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_Init
|
||||
**
|
||||
** Description Initializes the control blocks used by GAP.
|
||||
** This routine should not be called except once per
|
||||
** stack invocation.
|
||||
**
|
||||
** Returns Nothing
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void GAP_Init(void);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_BleAttrDBUpdate
|
||||
**
|
||||
** Description update GAP local BLE attribute database.
|
||||
**
|
||||
** Returns Nothing
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void GAP_BleAttrDBUpdate(UINT16 attr_uuid, tGAP_BLE_ATTR_VALUE *p_value);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_BleReadPeerPrefConnParams
|
||||
**
|
||||
** Description Start a process to read a connected peripheral's preferred
|
||||
** connection parameters
|
||||
**
|
||||
** Returns TRUE if read started, else FALSE if GAP is busy
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GAP_BleReadPeerPrefConnParams (BD_ADDR peer_bda);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_BleReadPeerDevName
|
||||
**
|
||||
** Description Start a process to read a connected peripheral's device name.
|
||||
**
|
||||
** Returns TRUE if request accepted
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GAP_BleReadPeerDevName (BD_ADDR peer_bda, tGAP_BLE_CMPL_CBACK *p_cback);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_BleReadPeerAddressResolutionCap
|
||||
**
|
||||
** Description Start a process to read peer address resolution capability
|
||||
**
|
||||
** Returns TRUE if request accepted
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GAP_BleReadPeerAddressResolutionCap (BD_ADDR peer_bda,
|
||||
tGAP_BLE_CMPL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function GAP_BleCancelReadPeerDevName
|
||||
**
|
||||
** Description Cancel reading a peripheral's device name.
|
||||
**
|
||||
** Returns TRUE if request accepted
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GAP_BleCancelReadPeerDevName (BD_ADDR peer_bda);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* GAP_API_H */
|
1217
tools/sdk/include/bluedroid/stack/gatt_api.h
Normal file
1217
tools/sdk/include/bluedroid/stack/gatt_api.h
Normal file
File diff suppressed because it is too large
Load Diff
124
tools/sdk/include/bluedroid/stack/gattdefs.h
Normal file
124
tools/sdk/include/bluedroid/stack/gattdefs.h
Normal file
@ -0,0 +1,124 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains internally used ATT definitions
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GATTDEFS_H
|
||||
#define _GATTDEFS_H
|
||||
|
||||
#define GATT_ILLEGAL_UUID 0
|
||||
|
||||
/* GATT attribute types
|
||||
*/
|
||||
#define GATT_UUID_PRI_SERVICE 0x2800
|
||||
#define GATT_UUID_SEC_SERVICE 0x2801
|
||||
#define GATT_UUID_INCLUDE_SERVICE 0x2802
|
||||
#define GATT_UUID_CHAR_DECLARE 0x2803 /* Characteristic Declaration*/
|
||||
|
||||
#define GATT_UUID_CHAR_EXT_PROP 0x2900 /* Characteristic Extended Properties */
|
||||
#define GATT_UUID_CHAR_DESCRIPTION 0x2901 /* Characteristic User Description*/
|
||||
#define GATT_UUID_CHAR_CLIENT_CONFIG 0x2902 /* Client Characteristic Configuration */
|
||||
#define GATT_UUID_CHAR_SRVR_CONFIG 0x2903 /* Server Characteristic Configuration */
|
||||
#define GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
|
||||
#define GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
|
||||
#define GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
|
||||
#define GATT_UUID_EXT_RPT_REF_DESCR 0x2907
|
||||
#define GATT_UUID_RPT_REF_DESCR 0x2908
|
||||
|
||||
|
||||
/* GAP Profile Attributes
|
||||
*/
|
||||
#define GATT_UUID_GAP_DEVICE_NAME 0x2A00
|
||||
#define GATT_UUID_GAP_ICON 0x2A01
|
||||
#define GATT_UUID_GAP_PREF_CONN_PARAM 0x2A04
|
||||
#define GATT_UUID_GAP_CENTRAL_ADDR_RESOL 0x2AA6
|
||||
|
||||
/* Attribute Profile Attribute UUID */
|
||||
#define GATT_UUID_GATT_SRV_CHGD 0x2A05
|
||||
/* Attribute Protocol Test */
|
||||
|
||||
/* Link Loss Service */
|
||||
#define GATT_UUID_ALERT_LEVEL 0x2A06 /* Alert Level */
|
||||
#define GATT_UUID_TX_POWER_LEVEL 0x2A07 /* TX power level */
|
||||
|
||||
/* Time Profile */
|
||||
/* Current Time Service */
|
||||
#define GATT_UUID_CURRENT_TIME 0x2A2B /* Current Time */
|
||||
#define GATT_UUID_LOCAL_TIME_INFO 0x2A0F /* Local time info */
|
||||
#define GATT_UUID_REF_TIME_INFO 0x2A14 /* reference time information */
|
||||
|
||||
/* NwA Profile */
|
||||
#define GATT_UUID_NW_STATUS 0x2A18 /* network availability status */
|
||||
#define GATT_UUID_NW_TRIGGER 0x2A1A /* Network availability trigger */
|
||||
|
||||
/* phone alert */
|
||||
#define GATT_UUID_ALERT_STATUS 0x2A3F /* alert status */
|
||||
#define GATT_UUID_RINGER_CP 0x2A40 /* ringer control point */
|
||||
#define GATT_UUID_RINGER_SETTING 0x2A41 /* ringer setting */
|
||||
|
||||
/* Glucose Service */
|
||||
#define GATT_UUID_GM_MEASUREMENT 0x2A18
|
||||
#define GATT_UUID_GM_CONTEXT 0x2A34
|
||||
#define GATT_UUID_GM_CONTROL_POINT 0x2A52
|
||||
#define GATT_UUID_GM_FEATURE 0x2A51
|
||||
|
||||
/* device infor characteristic */
|
||||
#define GATT_UUID_SYSTEM_ID 0x2A23
|
||||
#define GATT_UUID_MODEL_NUMBER_STR 0x2A24
|
||||
#define GATT_UUID_SERIAL_NUMBER_STR 0x2A25
|
||||
#define GATT_UUID_FW_VERSION_STR 0x2A26
|
||||
#define GATT_UUID_HW_VERSION_STR 0x2A27
|
||||
#define GATT_UUID_SW_VERSION_STR 0x2A28
|
||||
#define GATT_UUID_MANU_NAME 0x2A29
|
||||
#define GATT_UUID_IEEE_DATA 0x2A2A
|
||||
#define GATT_UUID_PNP_ID 0x2A50
|
||||
|
||||
/* HID characteristics */
|
||||
#define GATT_UUID_HID_INFORMATION 0x2A4A
|
||||
#define GATT_UUID_HID_REPORT_MAP 0x2A4B
|
||||
#define GATT_UUID_HID_CONTROL_POINT 0x2A4C
|
||||
#define GATT_UUID_HID_REPORT 0x2A4D
|
||||
#define GATT_UUID_HID_PROTO_MODE 0x2A4E
|
||||
#define GATT_UUID_HID_BT_KB_INPUT 0x2A22
|
||||
#define GATT_UUID_HID_BT_KB_OUTPUT 0x2A32
|
||||
#define GATT_UUID_HID_BT_MOUSE_INPUT 0x2A33
|
||||
|
||||
/* Battery Service char */
|
||||
#define GATT_UUID_BATTERY_LEVEL 0x2A19
|
||||
|
||||
#define GATT_UUID_SC_CONTROL_POINT 0x2A55
|
||||
#define GATT_UUID_SENSOR_LOCATION 0x2A5D
|
||||
|
||||
/* RUNNERS SPEED AND CADENCE SERVICE */
|
||||
#define GATT_UUID_RSC_MEASUREMENT 0x2A53
|
||||
#define GATT_UUID_RSC_FEATURE 0x2A54
|
||||
|
||||
/* CYCLING SPEED AND CADENCE SERVICE */
|
||||
#define GATT_UUID_CSC_MEASUREMENT 0x2A5B
|
||||
#define GATT_UUID_CSC_FEATURE 0x2A5C
|
||||
|
||||
|
||||
/* Scan Parameter charatceristics */
|
||||
#define GATT_UUID_SCAN_INT_WINDOW 0x2A4F
|
||||
#define GATT_UUID_SCAN_REFRESH 0x2A31
|
||||
|
||||
#endif
|
2609
tools/sdk/include/bluedroid/stack/hcidefs.h
Normal file
2609
tools/sdk/include/bluedroid/stack/hcidefs.h
Normal file
File diff suppressed because it is too large
Load Diff
811
tools/sdk/include/bluedroid/stack/hcimsgs.h
Normal file
811
tools/sdk/include/bluedroid/stack/hcimsgs.h
Normal file
@ -0,0 +1,811 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 HCIMSGS_H
|
||||
#define HCIMSGS_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/hcidefs.h"
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
void bte_main_hci_send(BT_HDR *p_msg, UINT16 event);
|
||||
void bte_main_lpm_allow_bt_device_sleep(void);
|
||||
|
||||
/* Message by message.... */
|
||||
|
||||
BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration,
|
||||
UINT8 response_cnt);
|
||||
|
||||
#define HCIC_PARAM_SIZE_INQUIRY 5
|
||||
|
||||
|
||||
#define HCIC_INQ_INQ_LAP_OFF 0
|
||||
#define HCIC_INQ_DUR_OFF 3
|
||||
#define HCIC_INQ_RSP_CNT_OFF 4
|
||||
/* Inquiry */
|
||||
|
||||
/* Inquiry Cancel */
|
||||
BOOLEAN btsnd_hcic_inq_cancel(void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_INQ_CANCEL 0
|
||||
|
||||
/* Periodic Inquiry Mode */
|
||||
BOOLEAN btsnd_hcic_per_inq_mode(UINT16 max_period, UINT16 min_period,
|
||||
const LAP inq_lap, UINT8 duration,
|
||||
UINT8 response_cnt);
|
||||
|
||||
#define HCIC_PARAM_SIZE_PER_INQ_MODE 9
|
||||
|
||||
#define HCI_PER_INQ_MAX_INTRVL_OFF 0
|
||||
#define HCI_PER_INQ_MIN_INTRVL_OFF 2
|
||||
#define HCI_PER_INQ_INQ_LAP_OFF 4
|
||||
#define HCI_PER_INQ_DURATION_OFF 7
|
||||
#define HCI_PER_INQ_RSP_CNT_OFF 8
|
||||
/* Periodic Inquiry Mode */
|
||||
|
||||
/* Exit Periodic Inquiry Mode */
|
||||
BOOLEAN btsnd_hcic_exit_per_inq(void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_EXIT_PER_INQ 0
|
||||
/* Create Connection */
|
||||
BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types,
|
||||
UINT8 page_scan_rep_mode,
|
||||
UINT8 page_scan_mode,
|
||||
UINT16 clock_offset,
|
||||
UINT8 allow_switch);
|
||||
|
||||
#define HCIC_PARAM_SIZE_CREATE_CONN 13
|
||||
|
||||
#define HCIC_CR_CONN_BD_ADDR_OFF 0
|
||||
#define HCIC_CR_CONN_PKT_TYPES_OFF 6
|
||||
#define HCIC_CR_CONN_REP_MODE_OFF 8
|
||||
#define HCIC_CR_CONN_PAGE_SCAN_MODE_OFF 9
|
||||
#define HCIC_CR_CONN_CLK_OFF_OFF 10
|
||||
#define HCIC_CR_CONN_ALLOW_SWITCH_OFF 12
|
||||
/* Create Connection */
|
||||
|
||||
/* Disconnect */
|
||||
BOOLEAN btsnd_hcic_disconnect(UINT16 handle, UINT8 reason);
|
||||
|
||||
#define HCIC_PARAM_SIZE_DISCONNECT 3
|
||||
|
||||
#define HCI_DISC_HANDLE_OFF 0
|
||||
#define HCI_DISC_REASON_OFF 2
|
||||
/* Disconnect */
|
||||
|
||||
#if BTM_SCO_INCLUDED == TRUE
|
||||
/* Add SCO Connection */
|
||||
BOOLEAN btsnd_hcic_add_SCO_conn (UINT16 handle, UINT16 packet_types);
|
||||
#endif /* BTM_SCO_INCLUDED */
|
||||
|
||||
#define HCIC_PARAM_SIZE_ADD_SCO_CONN 4
|
||||
|
||||
#define HCI_ADD_SCO_HANDLE_OFF 0
|
||||
#define HCI_ADD_SCO_PACKET_TYPES_OFF 2
|
||||
/* Add SCO Connection */
|
||||
|
||||
/* Create Connection Cancel */
|
||||
BOOLEAN btsnd_hcic_create_conn_cancel(BD_ADDR dest);
|
||||
|
||||
#define HCIC_PARAM_SIZE_CREATE_CONN_CANCEL 6
|
||||
|
||||
#define HCIC_CR_CONN_CANCEL_BD_ADDR_OFF 0
|
||||
/* Create Connection Cancel */
|
||||
|
||||
/* Accept Connection Request */
|
||||
BOOLEAN btsnd_hcic_accept_conn (BD_ADDR bd_addr, UINT8 role);
|
||||
|
||||
#define HCIC_PARAM_SIZE_ACCEPT_CONN 7
|
||||
|
||||
#define HCI_ACC_CONN_BD_ADDR_OFF 0
|
||||
#define HCI_ACC_CONN_ROLE_OFF 6
|
||||
/* Accept Connection Request */
|
||||
|
||||
/* Reject Connection Request */
|
||||
BOOLEAN btsnd_hcic_reject_conn (BD_ADDR bd_addr, UINT8 reason);
|
||||
|
||||
#define HCIC_PARAM_SIZE_REJECT_CONN 7
|
||||
|
||||
#define HCI_REJ_CONN_BD_ADDR_OFF 0
|
||||
#define HCI_REJ_CONN_REASON_OFF 6
|
||||
/* Reject Connection Request */
|
||||
|
||||
/* Link Key Request Reply */
|
||||
BOOLEAN btsnd_hcic_link_key_req_reply (BD_ADDR bd_addr,
|
||||
LINK_KEY link_key);
|
||||
|
||||
#define HCIC_PARAM_SIZE_LINK_KEY_REQ_REPLY 22
|
||||
|
||||
#define HCI_LINK_KEY_REPLY_BD_ADDR_OFF 0
|
||||
#define HCI_LINK_KEY_REPLY_LINK_KEY_OFF 6
|
||||
/* Link Key Request Reply */
|
||||
|
||||
/* Link Key Request Neg Reply */
|
||||
BOOLEAN btsnd_hcic_link_key_neg_reply (BD_ADDR bd_addr);
|
||||
|
||||
#define HCIC_PARAM_SIZE_LINK_KEY_NEG_REPLY 6
|
||||
|
||||
#define HCI_LINK_KEY_NEG_REP_BD_ADR_OFF 0
|
||||
/* Link Key Request Neg Reply */
|
||||
|
||||
/* PIN Code Request Reply */
|
||||
BOOLEAN btsnd_hcic_pin_code_req_reply (BD_ADDR bd_addr,
|
||||
UINT8 pin_code_len,
|
||||
PIN_CODE pin_code);
|
||||
|
||||
#define HCIC_PARAM_SIZE_PIN_CODE_REQ_REPLY 23
|
||||
|
||||
#define HCI_PIN_CODE_REPLY_BD_ADDR_OFF 0
|
||||
#define HCI_PIN_CODE_REPLY_PIN_LEN_OFF 6
|
||||
#define HCI_PIN_CODE_REPLY_PIN_CODE_OFF 7
|
||||
/* PIN Code Request Reply */
|
||||
|
||||
/* Link Key Request Neg Reply */
|
||||
BOOLEAN btsnd_hcic_pin_code_neg_reply (BD_ADDR bd_addr);
|
||||
|
||||
#define HCIC_PARAM_SIZE_PIN_CODE_NEG_REPLY 6
|
||||
|
||||
#define HCI_PIN_CODE_NEG_REP_BD_ADR_OFF 0
|
||||
/* Link Key Request Neg Reply */
|
||||
|
||||
/* Change Connection Type */
|
||||
BOOLEAN btsnd_hcic_change_conn_type (UINT16 handle, UINT16 packet_types);
|
||||
|
||||
#define HCIC_PARAM_SIZE_CHANGE_CONN_TYPE 4
|
||||
|
||||
#define HCI_CHNG_PKT_TYPE_HANDLE_OFF 0
|
||||
#define HCI_CHNG_PKT_TYPE_PKT_TYPE_OFF 2
|
||||
/* Change Connection Type */
|
||||
|
||||
#define HCIC_PARAM_SIZE_CMD_HANDLE 2
|
||||
|
||||
#define HCI_CMD_HANDLE_HANDLE_OFF 0
|
||||
|
||||
BOOLEAN btsnd_hcic_auth_request (UINT16 handle); /* Authentication Request */
|
||||
|
||||
/* Set Connection Encryption */
|
||||
BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable);
|
||||
#define HCIC_PARAM_SIZE_SET_CONN_ENCRYPT 3
|
||||
|
||||
|
||||
#define HCI_SET_ENCRYPT_HANDLE_OFF 0
|
||||
#define HCI_SET_ENCRYPT_ENABLE_OFF 2
|
||||
/* Set Connection Encryption */
|
||||
|
||||
/* Remote Name Request */
|
||||
BOOLEAN btsnd_hcic_rmt_name_req (BD_ADDR bd_addr,
|
||||
UINT8 page_scan_rep_mode,
|
||||
UINT8 page_scan_mode,
|
||||
UINT16 clock_offset);
|
||||
|
||||
#define HCIC_PARAM_SIZE_RMT_NAME_REQ 10
|
||||
|
||||
#define HCI_RMT_NAME_BD_ADDR_OFF 0
|
||||
#define HCI_RMT_NAME_REP_MODE_OFF 6
|
||||
#define HCI_RMT_NAME_PAGE_SCAN_MODE_OFF 7
|
||||
#define HCI_RMT_NAME_CLK_OFF_OFF 8
|
||||
/* Remote Name Request */
|
||||
|
||||
/* Remote Name Request Cancel */
|
||||
BOOLEAN btsnd_hcic_rmt_name_req_cancel(BD_ADDR bd_addr);
|
||||
|
||||
#define HCIC_PARAM_SIZE_RMT_NAME_REQ_CANCEL 6
|
||||
|
||||
#define HCI_RMT_NAME_CANCEL_BD_ADDR_OFF 0
|
||||
/* Remote Name Request Cancel */
|
||||
|
||||
BOOLEAN btsnd_hcic_rmt_features_req(UINT16 handle); /* Remote Features Request */
|
||||
|
||||
/* Remote Extended Features */
|
||||
BOOLEAN btsnd_hcic_rmt_ext_features(UINT16 handle, UINT8 page_num);
|
||||
|
||||
#define HCIC_PARAM_SIZE_RMT_EXT_FEATURES 3
|
||||
|
||||
#define HCI_RMT_EXT_FEATURES_HANDLE_OFF 0
|
||||
#define HCI_RMT_EXT_FEATURES_PAGE_NUM_OFF 2
|
||||
/* Remote Extended Features */
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_rmt_ver_req(UINT16 handle); /* Remote Version Info Request */
|
||||
BOOLEAN btsnd_hcic_read_rmt_clk_offset(UINT16 handle); /* Remote Clock Offset */
|
||||
BOOLEAN btsnd_hcic_read_lmp_handle(UINT16 handle); /* Remote LMP Handle */
|
||||
|
||||
BOOLEAN btsnd_hcic_setup_esco_conn (UINT16 handle,
|
||||
UINT32 tx_bw, UINT32 rx_bw,
|
||||
UINT16 max_latency, UINT16 voice,
|
||||
UINT8 retrans_effort,
|
||||
UINT16 packet_types);
|
||||
#define HCIC_PARAM_SIZE_SETUP_ESCO 17
|
||||
|
||||
#define HCI_SETUP_ESCO_HANDLE_OFF 0
|
||||
#define HCI_SETUP_ESCO_TX_BW_OFF 2
|
||||
#define HCI_SETUP_ESCO_RX_BW_OFF 6
|
||||
#define HCI_SETUP_ESCO_MAX_LAT_OFF 10
|
||||
#define HCI_SETUP_ESCO_VOICE_OFF 12
|
||||
#define HCI_SETUP_ESCO_RETRAN_EFF_OFF 14
|
||||
#define HCI_SETUP_ESCO_PKT_TYPES_OFF 15
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_accept_esco_conn (BD_ADDR bd_addr,
|
||||
UINT32 tx_bw, UINT32 rx_bw,
|
||||
UINT16 max_latency,
|
||||
UINT16 content_fmt,
|
||||
UINT8 retrans_effort,
|
||||
UINT16 packet_types);
|
||||
#define HCIC_PARAM_SIZE_ACCEPT_ESCO 21
|
||||
|
||||
#define HCI_ACCEPT_ESCO_BDADDR_OFF 0
|
||||
#define HCI_ACCEPT_ESCO_TX_BW_OFF 6
|
||||
#define HCI_ACCEPT_ESCO_RX_BW_OFF 10
|
||||
#define HCI_ACCEPT_ESCO_MAX_LAT_OFF 14
|
||||
#define HCI_ACCEPT_ESCO_VOICE_OFF 16
|
||||
#define HCI_ACCEPT_ESCO_RETRAN_EFF_OFF 18
|
||||
#define HCI_ACCEPT_ESCO_PKT_TYPES_OFF 19
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason);
|
||||
#define HCIC_PARAM_SIZE_REJECT_ESCO 7
|
||||
|
||||
#define HCI_REJECT_ESCO_BDADDR_OFF 0
|
||||
#define HCI_REJECT_ESCO_REASON_OFF 6
|
||||
|
||||
/* Hold Mode */
|
||||
BOOLEAN btsnd_hcic_hold_mode(UINT16 handle, UINT16 max_hold_period,
|
||||
UINT16 min_hold_period);
|
||||
|
||||
#define HCIC_PARAM_SIZE_HOLD_MODE 6
|
||||
|
||||
#define HCI_HOLD_MODE_HANDLE_OFF 0
|
||||
#define HCI_HOLD_MODE_MAX_PER_OFF 2
|
||||
#define HCI_HOLD_MODE_MIN_PER_OFF 4
|
||||
/* Hold Mode */
|
||||
|
||||
/* Sniff Mode */
|
||||
BOOLEAN btsnd_hcic_sniff_mode(UINT16 handle,
|
||||
UINT16 max_sniff_period,
|
||||
UINT16 min_sniff_period,
|
||||
UINT16 sniff_attempt,
|
||||
UINT16 sniff_timeout);
|
||||
|
||||
#define HCIC_PARAM_SIZE_SNIFF_MODE 10
|
||||
|
||||
|
||||
#define HCI_SNIFF_MODE_HANDLE_OFF 0
|
||||
#define HCI_SNIFF_MODE_MAX_PER_OFF 2
|
||||
#define HCI_SNIFF_MODE_MIN_PER_OFF 4
|
||||
#define HCI_SNIFF_MODE_ATTEMPT_OFF 6
|
||||
#define HCI_SNIFF_MODE_TIMEOUT_OFF 8
|
||||
/* Sniff Mode */
|
||||
|
||||
BOOLEAN btsnd_hcic_exit_sniff_mode(UINT16 handle); /* Exit Sniff Mode */
|
||||
|
||||
/* Park Mode */
|
||||
BOOLEAN btsnd_hcic_park_mode (UINT16 handle,
|
||||
UINT16 beacon_max_interval,
|
||||
UINT16 beacon_min_interval);
|
||||
|
||||
#define HCIC_PARAM_SIZE_PARK_MODE 6
|
||||
|
||||
#define HCI_PARK_MODE_HANDLE_OFF 0
|
||||
#define HCI_PARK_MODE_MAX_PER_OFF 2
|
||||
#define HCI_PARK_MODE_MIN_PER_OFF 4
|
||||
/* Park Mode */
|
||||
|
||||
BOOLEAN btsnd_hcic_exit_park_mode(UINT16 handle); /* Exit Park Mode */
|
||||
|
||||
/* QoS Setup */
|
||||
BOOLEAN btsnd_hcic_qos_setup (UINT16 handle, UINT8 flags,
|
||||
UINT8 service_type,
|
||||
UINT32 token_rate, UINT32 peak,
|
||||
UINT32 latency, UINT32 delay_var);
|
||||
|
||||
#define HCIC_PARAM_SIZE_QOS_SETUP 20
|
||||
|
||||
#define HCI_QOS_HANDLE_OFF 0
|
||||
#define HCI_QOS_FLAGS_OFF 2
|
||||
#define HCI_QOS_SERVICE_TYPE_OFF 3
|
||||
#define HCI_QOS_TOKEN_RATE_OFF 4
|
||||
#define HCI_QOS_PEAK_BANDWIDTH_OFF 8
|
||||
#define HCI_QOS_LATENCY_OFF 12
|
||||
#define HCI_QOS_DELAY_VAR_OFF 16
|
||||
/* QoS Setup */
|
||||
|
||||
/* Switch Role Request */
|
||||
BOOLEAN btsnd_hcic_switch_role (BD_ADDR bd_addr, UINT8 role);
|
||||
|
||||
#define HCIC_PARAM_SIZE_SWITCH_ROLE 7
|
||||
|
||||
#define HCI_SWITCH_BD_ADDR_OFF 0
|
||||
#define HCI_SWITCH_ROLE_OFF 6
|
||||
/* Switch Role Request */
|
||||
|
||||
/* Write Policy Settings */
|
||||
BOOLEAN btsnd_hcic_write_policy_set(UINT16 handle, UINT16 settings);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_POLICY_SET 4
|
||||
|
||||
#define HCI_WRITE_POLICY_HANDLE_OFF 0
|
||||
#define HCI_WRITE_POLICY_SETTINGS_OFF 2
|
||||
/* Write Policy Settings */
|
||||
|
||||
/* Write Default Policy Settings */
|
||||
BOOLEAN btsnd_hcic_write_def_policy_set(UINT16 settings);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_DEF_POLICY_SET 2
|
||||
|
||||
#define HCI_WRITE_DEF_POLICY_SETTINGS_OFF 0
|
||||
/* Write Default Policy Settings */
|
||||
|
||||
/******************************************
|
||||
** Lisbon Features
|
||||
*******************************************/
|
||||
#if BTM_SSR_INCLUDED == TRUE
|
||||
/* Sniff Subrating */
|
||||
BOOLEAN btsnd_hcic_sniff_sub_rate(UINT16 handle, UINT16 max_lat,
|
||||
UINT16 min_remote_lat,
|
||||
UINT16 min_local_lat);
|
||||
|
||||
#define HCIC_PARAM_SIZE_SNIFF_SUB_RATE 8
|
||||
|
||||
#define HCI_SNIFF_SUB_RATE_HANDLE_OFF 0
|
||||
#define HCI_SNIFF_SUB_RATE_MAX_LAT_OFF 2
|
||||
#define HCI_SNIFF_SUB_RATE_MIN_REM_LAT_OFF 4
|
||||
#define HCI_SNIFF_SUB_RATE_MIN_LOC_LAT_OFF 6
|
||||
/* Sniff Subrating */
|
||||
|
||||
#else /* BTM_SSR_INCLUDED == FALSE */
|
||||
|
||||
#define btsnd_hcic_sniff_sub_rate(handle, max_lat, min_remote_lat, min_local_lat) FALSE
|
||||
|
||||
#endif /* BTM_SSR_INCLUDED */
|
||||
|
||||
/* Extended Inquiry Response */
|
||||
void btsnd_hcic_write_ext_inquiry_response(void *buffer, UINT8 fec_req);
|
||||
|
||||
#define HCIC_PARAM_SIZE_EXT_INQ_RESP 241
|
||||
|
||||
#define HCIC_EXT_INQ_RESP_FEC_OFF 0
|
||||
#define HCIC_EXT_INQ_RESP_RESPONSE 1
|
||||
/* IO Capabilities Response */
|
||||
BOOLEAN btsnd_hcic_io_cap_req_reply (BD_ADDR bd_addr, UINT8 capability,
|
||||
UINT8 oob_present, UINT8 auth_req);
|
||||
|
||||
#define HCIC_PARAM_SIZE_IO_CAP_RESP 9
|
||||
|
||||
#define HCI_IO_CAP_BD_ADDR_OFF 0
|
||||
#define HCI_IO_CAPABILITY_OFF 6
|
||||
#define HCI_IO_CAP_OOB_DATA_OFF 7
|
||||
#define HCI_IO_CAP_AUTH_REQ_OFF 8
|
||||
|
||||
/* IO Capabilities Req Neg Reply */
|
||||
BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code);
|
||||
|
||||
#define HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY 7
|
||||
|
||||
#define HCI_IO_CAP_NR_BD_ADDR_OFF 0
|
||||
#define HCI_IO_CAP_NR_ERR_CODE 6
|
||||
|
||||
/* Read Local OOB Data */
|
||||
BOOLEAN btsnd_hcic_read_local_oob_data (void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_R_LOCAL_OOB 0
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_user_conf_reply (BD_ADDR bd_addr, BOOLEAN is_yes);
|
||||
|
||||
#define HCIC_PARAM_SIZE_UCONF_REPLY 6
|
||||
|
||||
#define HCI_USER_CONF_BD_ADDR_OFF 0
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_user_passkey_reply (BD_ADDR bd_addr, UINT32 value);
|
||||
|
||||
#define HCIC_PARAM_SIZE_U_PKEY_REPLY 10
|
||||
|
||||
#define HCI_USER_PASSKEY_BD_ADDR_OFF 0
|
||||
#define HCI_USER_PASSKEY_VALUE_OFF 6
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_user_passkey_neg_reply (BD_ADDR bd_addr);
|
||||
|
||||
#define HCIC_PARAM_SIZE_U_PKEY_NEG_REPLY 6
|
||||
|
||||
#define HCI_USER_PASSKEY_NEG_BD_ADDR_OFF 0
|
||||
|
||||
/* Remote OOB Data Request Reply */
|
||||
BOOLEAN btsnd_hcic_rem_oob_reply (BD_ADDR bd_addr, UINT8 *p_c,
|
||||
UINT8 *p_r);
|
||||
|
||||
#define HCIC_PARAM_SIZE_REM_OOB_REPLY 38
|
||||
|
||||
#define HCI_REM_OOB_DATA_BD_ADDR_OFF 0
|
||||
#define HCI_REM_OOB_DATA_C_OFF 6
|
||||
#define HCI_REM_OOB_DATA_R_OFF 22
|
||||
|
||||
/* Remote OOB Data Request Negative Reply */
|
||||
BOOLEAN btsnd_hcic_rem_oob_neg_reply (BD_ADDR bd_addr);
|
||||
|
||||
#define HCIC_PARAM_SIZE_REM_OOB_NEG_REPLY 6
|
||||
|
||||
#define HCI_REM_OOB_DATA_NEG_BD_ADDR_OFF 0
|
||||
|
||||
/* Read Tx Power Level */
|
||||
BOOLEAN btsnd_hcic_read_inq_tx_power (void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_R_TX_POWER 0
|
||||
|
||||
/* Read Default Erroneous Data Reporting */
|
||||
BOOLEAN btsnd_hcic_read_default_erroneous_data_rpt (void);
|
||||
|
||||
#define HCIC_PARAM_SIZE_R_ERR_DATA_RPT 0
|
||||
|
||||
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
|
||||
BOOLEAN btsnd_hcic_enhanced_flush (UINT16 handle, UINT8 packet_type);
|
||||
|
||||
#define HCIC_PARAM_SIZE_ENHANCED_FLUSH 3
|
||||
#endif
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif);
|
||||
|
||||
#define HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF 7
|
||||
|
||||
#define HCI_SEND_KEYPRESS_NOTIF_BD_ADDR_OFF 0
|
||||
#define HCI_SEND_KEYPRESS_NOTIF_NOTIF_OFF 6
|
||||
|
||||
/**** end of Simple Pairing Commands ****/
|
||||
|
||||
/* Store Current Settings */
|
||||
#define MAX_FILT_COND (sizeof (BD_ADDR) + 1)
|
||||
|
||||
BOOLEAN btsnd_hcic_set_event_filter(UINT8 filt_type,
|
||||
UINT8 filt_cond_type,
|
||||
UINT8 *filt_cond,
|
||||
UINT8 filt_cond_len);
|
||||
|
||||
#define HCIC_PARAM_SIZE_SET_EVT_FILTER 9
|
||||
|
||||
#define HCI_FILT_COND_FILT_TYPE_OFF 0
|
||||
#define HCI_FILT_COND_COND_TYPE_OFF 1
|
||||
#define HCI_FILT_COND_FILT_OFF 2
|
||||
/* Set Event Filter */
|
||||
|
||||
/* Delete Stored Key */
|
||||
BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag);
|
||||
|
||||
#define HCIC_PARAM_SIZE_DELETE_STORED_KEY 7
|
||||
|
||||
#define HCI_DELETE_KEY_BD_ADDR_OFF 0
|
||||
#define HCI_DELETE_KEY_ALL_FLAG_OFF 6
|
||||
/* Delete Stored Key */
|
||||
|
||||
/* Change Local Name */
|
||||
BOOLEAN btsnd_hcic_change_name(BD_NAME name);
|
||||
|
||||
#define HCIC_PARAM_SIZE_CHANGE_NAME BD_NAME_LEN
|
||||
|
||||
#define HCI_CHANGE_NAME_NAME_OFF 0
|
||||
/* Change Local Name */
|
||||
|
||||
|
||||
#define HCIC_PARAM_SIZE_READ_CMD 0
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_PARAM1 1
|
||||
|
||||
#define HCIC_WRITE_PARAM1_PARAM_OFF 0
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_PARAM2 2
|
||||
|
||||
#define HCIC_WRITE_PARAM2_PARAM_OFF 0
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_PARAM3 3
|
||||
|
||||
#define HCIC_WRITE_PARAM3_PARAM_OFF 0
|
||||
|
||||
#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
|
||||
|
||||
BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
|
||||
BOOLEAN btsnd_hcic_write_auto_accept(UINT8 flag); /* Write Auto Accept */
|
||||
BOOLEAN btsnd_hcic_read_name (void); /* Read Local Name */
|
||||
BOOLEAN btsnd_hcic_write_page_tout(UINT16 timeout); /* Write Page Timout */
|
||||
BOOLEAN btsnd_hcic_write_scan_enable(UINT8 flag); /* Write Scan Enable */
|
||||
BOOLEAN btsnd_hcic_write_pagescan_cfg(UINT16 interval,
|
||||
UINT16 window); /* Write Page Scan Activity */
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_PAGESCAN_CFG 4
|
||||
|
||||
#define HCI_SCAN_CFG_INTERVAL_OFF 0
|
||||
#define HCI_SCAN_CFG_WINDOW_OFF 2
|
||||
/* Write Page Scan Activity */
|
||||
|
||||
/* Write Inquiry Scan Activity */
|
||||
BOOLEAN btsnd_hcic_write_inqscan_cfg(UINT16 interval, UINT16 window);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_INQSCAN_CFG 4
|
||||
|
||||
#define HCI_SCAN_CFG_INTERVAL_OFF 0
|
||||
#define HCI_SCAN_CFG_WINDOW_OFF 2
|
||||
/* Write Inquiry Scan Activity */
|
||||
|
||||
BOOLEAN btsnd_hcic_write_auth_enable(UINT8 flag); /* Write Authentication Enable */
|
||||
BOOLEAN btsnd_hcic_write_dev_class(DEV_CLASS dev); /* Write Class of Device */
|
||||
BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice Settings */
|
||||
|
||||
/* Host Controller to Host flow control */
|
||||
#define HCI_HOST_FLOW_CTRL_OFF 0
|
||||
#define HCI_HOST_FLOW_CTRL_ACL_ON 1
|
||||
#define HCI_HOST_FLOW_CTRL_SCO_ON 2
|
||||
#define HCI_HOST_FLOW_CTRL_BOTH_ON 3
|
||||
|
||||
BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
|
||||
UINT16 timeout); /* Write Retransmit Timout */
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
|
||||
|
||||
#define HCI_FLUSH_TOUT_HANDLE_OFF 0
|
||||
#define HCI_FLUSH_TOUT_TOUT_OFF 2
|
||||
|
||||
BOOLEAN btsnd_hcic_read_tx_power(UINT16 handle, UINT8 type); /* Read Tx Power */
|
||||
|
||||
#define HCIC_PARAM_SIZE_READ_TX_POWER 3
|
||||
|
||||
#define HCI_READ_TX_POWER_HANDLE_OFF 0
|
||||
#define HCI_READ_TX_POWER_TYPE_OFF 2
|
||||
|
||||
/* Read transmit power level parameter */
|
||||
#define HCI_READ_CURRENT 0x00
|
||||
#define HCI_READ_MAXIMUM 0x01
|
||||
|
||||
BOOLEAN btsnd_hcic_host_num_xmitted_pkts (UINT8 num_handles,
|
||||
UINT16 *handle,
|
||||
UINT16 *num_pkts); /* Set Host Buffer Size */
|
||||
|
||||
#define HCIC_PARAM_SIZE_NUM_PKTS_DONE_SIZE sizeof(btmsg_hcic_num_pkts_done_t)
|
||||
|
||||
#define MAX_DATA_HANDLES 10
|
||||
|
||||
#define HCI_PKTS_DONE_NUM_HANDLES_OFF 0
|
||||
#define HCI_PKTS_DONE_HANDLE_OFF 1
|
||||
#define HCI_PKTS_DONE_NUM_PKTS_OFF 3
|
||||
|
||||
/* Write Link Supervision Timeout */
|
||||
BOOLEAN btsnd_hcic_write_link_super_tout(UINT8 local_controller_id, UINT16 handle, UINT16 timeout);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_LINK_SUPER_TOUT 4
|
||||
|
||||
#define HCI_LINK_SUPER_TOUT_HANDLE_OFF 0
|
||||
#define HCI_LINK_SUPER_TOUT_TOUT_OFF 2
|
||||
/* Write Link Supervision Timeout */
|
||||
|
||||
BOOLEAN btsnd_hcic_write_cur_iac_lap (UINT8 num_cur_iac,
|
||||
LAP *const iac_lap); /* Write Current IAC LAP */
|
||||
|
||||
#define MAX_IAC_LAPS 0x40
|
||||
|
||||
#define HCI_WRITE_IAC_LAP_NUM_OFF 0
|
||||
#define HCI_WRITE_IAC_LAP_LAP_OFF 1
|
||||
/* Write Current IAC LAP */
|
||||
|
||||
BOOLEAN btsnd_hcic_get_link_quality (UINT16 handle); /* Get Link Quality */
|
||||
BOOLEAN btsnd_hcic_read_rssi (UINT16 handle); /* Read RSSI */
|
||||
BOOLEAN btsnd_hcic_enable_test_mode (void); /* Enable Device Under Test Mode */
|
||||
BOOLEAN btsnd_hcic_write_pagescan_type(UINT8 type); /* Write Page Scan Type */
|
||||
BOOLEAN btsnd_hcic_write_inqscan_type(UINT8 type); /* Write Inquiry Scan Type */
|
||||
BOOLEAN btsnd_hcic_write_inquiry_mode(UINT8 type); /* Write Inquiry Mode */
|
||||
|
||||
#define HCI_DATA_HANDLE_MASK 0x0FFF
|
||||
|
||||
#define HCID_GET_HANDLE_EVENT(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset) + \
|
||||
(*((UINT8 *)((p) + 1) + p->offset + 1) << 8)))
|
||||
|
||||
#define HCID_GET_HANDLE(u16) (UINT16)((u16) & HCI_DATA_HANDLE_MASK)
|
||||
|
||||
#define HCI_DATA_EVENT_MASK 3
|
||||
#define HCI_DATA_EVENT_OFFSET 12
|
||||
#define HCID_GET_EVENT(u16) (UINT8)(((u16) >> HCI_DATA_EVENT_OFFSET) & HCI_DATA_EVENT_MASK)
|
||||
|
||||
#define HCI_DATA_BCAST_MASK 3
|
||||
#define HCI_DATA_BCAST_OFFSET 10
|
||||
#define HCID_GET_BCAST(u16) (UINT8)(((u16) >> HCI_DATA_BCAST_OFFSET) & HCI_DATA_BCAST_MASK)
|
||||
|
||||
#define HCID_GET_ACL_LEN(p) (UINT16)((*((UINT8 *)((p) + 1) + p->offset + 2) + \
|
||||
(*((UINT8 *)((p) + 1) + p->offset + 3) << 8)))
|
||||
|
||||
#define HCID_HEADER_SIZE 4
|
||||
|
||||
#define HCID_GET_SCO_LEN(p) (*((UINT8 *)((p) + 1) + p->offset + 2))
|
||||
|
||||
void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode,
|
||||
UINT8 len, UINT8 *p_data,
|
||||
void *p_cmd_cplt_cback);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
/********************************************************************************
|
||||
** BLE Commands
|
||||
** Note: "local_controller_id" is for transport, not counted in HCI message size
|
||||
*********************************************************************************/
|
||||
#define HCIC_BLE_RAND_DI_SIZE 8
|
||||
#define HCIC_BLE_ENCRYT_KEY_SIZE 16
|
||||
#define HCIC_BLE_IRK_SIZE 16
|
||||
|
||||
#define HCIC_PARAM_SIZE_SET_USED_FEAT_CMD 8
|
||||
#define HCIC_PARAM_SIZE_WRITE_RANDOM_ADDR_CMD 6
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_PARAMS 15
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_RSP 31
|
||||
#define HCIC_PARAM_SIZE_WRITE_ADV_ENABLE 1
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_PARAM 7
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_SCAN_ENABLE 2
|
||||
#define HCIC_PARAM_SIZE_BLE_CREATE_LL_CONN 25
|
||||
#define HCIC_PARAM_SIZE_BLE_CREATE_CONN_CANCEL 0
|
||||
#define HCIC_PARAM_SIZE_CLEAR_WHITE_LIST 0
|
||||
#define HCIC_PARAM_SIZE_ADD_WHITE_LIST 7
|
||||
#define HCIC_PARAM_SIZE_REMOVE_WHITE_LIST 7
|
||||
#define HCIC_PARAM_SIZE_BLE_UPD_LL_CONN_PARAMS 14
|
||||
#define HCIC_PARAM_SIZE_SET_HOST_CHNL_CLASS 5
|
||||
#define HCIC_PARAM_SIZE_READ_CHNL_MAP 2
|
||||
#define HCIC_PARAM_SIZE_BLE_READ_REMOTE_FEAT 2
|
||||
#define HCIC_PARAM_SIZE_BLE_ENCRYPT 32
|
||||
#define HCIC_PARAM_SIZE_BLE_RAND 0
|
||||
#define HCIC_PARAM_SIZE_WRITE_LE_HOST_SUPPORTED 2
|
||||
|
||||
#define HCIC_BLE_RAND_DI_SIZE 8
|
||||
#define HCIC_BLE_ENCRYT_KEY_SIZE 16
|
||||
#define HCIC_PARAM_SIZE_BLE_START_ENC (4 + HCIC_BLE_RAND_DI_SIZE + HCIC_BLE_ENCRYT_KEY_SIZE)
|
||||
#define HCIC_PARAM_SIZE_LTK_REQ_REPLY (2 + HCIC_BLE_ENCRYT_KEY_SIZE)
|
||||
#define HCIC_PARAM_SIZE_LTK_REQ_NEG_REPLY 2
|
||||
#define HCIC_BLE_CHNL_MAP_SIZE 5
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA 31
|
||||
|
||||
#define HCIC_PARAM_SIZE_BLE_ADD_DEV_RESOLVING_LIST (7 + HCIC_BLE_IRK_SIZE * 2)
|
||||
#define HCIC_PARAM_SIZE_BLE_RM_DEV_RESOLVING_LIST 7
|
||||
#define HCIC_PARAM_SIZE_BLE_CLEAR_RESOLVING_LIST 0
|
||||
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVING_LIST_SIZE 0
|
||||
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_PEER 7
|
||||
#define HCIC_PARAM_SIZE_BLE_READ_RESOLVABLE_ADDR_LOCAL 7
|
||||
#define HCIC_PARAM_SIZE_BLE_SET_ADDR_RESOLUTION_ENABLE 1
|
||||
#define HCIC_PARAM_SIZE_BLE_SET_RAND_PRIV_ADDR_TIMOUT 2
|
||||
#define HCIC_PARAM_SIZE_BLE_SET_DATA_LENGTH 6
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM 11
|
||||
|
||||
/* ULP HCI command */
|
||||
BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_buffer_size (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_local_spt_feat (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_local_used_feat (UINT8 feat_set[8]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_random_addr (BD_ADDR random_addr);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_write_adv_params (UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
UINT8 adv_type, UINT8 addr_type_own,
|
||||
UINT8 addr_type_dir, BD_ADDR direct_bda,
|
||||
UINT8 channel_map, UINT8 adv_filter_policy);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_adv_chnl_tx_power (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_rsp_data (UINT8 data_len, UINT8 *p_scan_rsp);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_adv_enable (UINT8 adv_enable);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_params (UINT8 scan_type,
|
||||
UINT16 scan_int, UINT16 scan_win,
|
||||
UINT8 addr_type, UINT8 scan_filter_policy);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_scan_enable (UINT8 scan_enable, UINT8 duplicate);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_create_ll_conn (UINT16 scan_int, UINT16 scan_win,
|
||||
UINT8 init_filter_policy, UINT8 addr_type_peer, BD_ADDR bda_peer, UINT8 addr_type_own,
|
||||
UINT16 conn_int_min, UINT16 conn_int_max, UINT16 conn_latency, UINT16 conn_timeout,
|
||||
UINT16 min_ce_len, UINT16 max_ce_len);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_create_conn_cancel (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_white_list_size (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_clear_white_list (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_add_white_list (UINT8 addr_type, BD_ADDR bda);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_remove_from_white_list (UINT8 addr_type, BD_ADDR bda);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_upd_ll_conn_params (UINT16 handle, UINT16 conn_int_min, UINT16 conn_int_max,
|
||||
UINT16 conn_latency, UINT16 conn_timeout, UINT16 min_len, UINT16 max_len);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_host_chnl_class (UINT8 chnl_map[HCIC_BLE_CHNL_MAP_SIZE]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_chnl_map (UINT16 handle);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_remote_feat ( UINT16 handle);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_encrypt (UINT8 *key, UINT8 key_len, UINT8 *plain_text, UINT8 pt_len, void *p_cmd_cplt_cback);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_rand (void *p_cmd_cplt_cback);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_start_enc ( UINT16 handle,
|
||||
UINT8 rand[HCIC_BLE_RAND_DI_SIZE],
|
||||
UINT16 ediv, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_ltk_req_reply (UINT16 handle, UINT8 ltk[HCIC_BLE_ENCRYT_KEY_SIZE]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_ltk_req_neg_reply (UINT16 handle);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_supported_states (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_write_host_supported (UINT8 le_host_spt, UINT8 simul_le_host_spt);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_host_supported (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_receiver_test(UINT8 rx_freq);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len,
|
||||
UINT8 payload);
|
||||
BOOLEAN btsnd_hcic_ble_test_end(void);
|
||||
|
||||
#if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
|
||||
|
||||
#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_REPLY 14
|
||||
BOOLEAN btsnd_hcic_ble_rc_param_req_reply(UINT16 handle,
|
||||
UINT16 conn_int_min, UINT16 conn_int_max,
|
||||
UINT16 conn_latency, UINT16 conn_timeout,
|
||||
UINT16 min_ce_len, UINT16 max_ce_len);
|
||||
|
||||
#define HCIC_PARAM_SIZE_BLE_RC_PARAM_REQ_NEG_REPLY 3
|
||||
BOOLEAN btsnd_hcic_ble_rc_param_req_neg_reply(UINT16 handle, UINT8 reason);
|
||||
|
||||
#endif /* BLE_LLT_INCLUDED */
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_data_length(UINT16 conn_handle, UINT16 tx_octets,
|
||||
UINT16 tx_time);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_add_device_resolving_list (UINT8 addr_type_peer,
|
||||
BD_ADDR bda_peer,
|
||||
UINT8 irk_peer[HCIC_BLE_IRK_SIZE],
|
||||
UINT8 irk_local[HCIC_BLE_IRK_SIZE]);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_rm_device_resolving_list (UINT8 addr_type_peer,
|
||||
BD_ADDR bda_peer);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_clear_resolving_list (void);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_resolvable_addr_peer (UINT8 addr_type_peer,
|
||||
BD_ADDR bda_peer);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_resolvable_addr_local (UINT8 addr_type_peer,
|
||||
BD_ADDR bda_peer);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_addr_resolution_enable (UINT8 addr_resolution_enable);
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_rand_priv_addr_timeout (UINT16 rpa_timout);
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
BOOLEAN btsnd_hcic_read_authenticated_payload_tout(UINT16 handle);
|
||||
|
||||
BOOLEAN btsnd_hcic_write_authenticated_payload_tout(UINT16 handle,
|
||||
UINT16 timeout);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT 4
|
||||
|
||||
#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF 0
|
||||
#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_TOUT_OFF 2
|
||||
|
||||
#endif
|
163
tools/sdk/include/bluedroid/stack/hiddefs.h
Normal file
163
tools/sdk/include/bluedroid/stack/hiddefs.h
Normal file
@ -0,0 +1,163 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file contains HID protocol definitions
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HIDDEFS_H
|
||||
#define HIDDEFS_H
|
||||
#include "common/bt_target.h"
|
||||
#if (HID_HOST_INCLUDED == TRUE)
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#include "stack/sdp_api.h"
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
/*
|
||||
** tHID_STATUS: HID result codes, returned by HID and device and host functions.
|
||||
*/
|
||||
enum {
|
||||
HID_SUCCESS,
|
||||
HID_ERR_NOT_REGISTERED,
|
||||
HID_ERR_ALREADY_REGISTERED,
|
||||
HID_ERR_NO_RESOURCES,
|
||||
HID_ERR_NO_CONNECTION,
|
||||
HID_ERR_INVALID_PARAM,
|
||||
HID_ERR_UNSUPPORTED,
|
||||
HID_ERR_UNKNOWN_COMMAND,
|
||||
HID_ERR_CONGESTED,
|
||||
HID_ERR_CONN_IN_PROCESS,
|
||||
HID_ERR_ALREADY_CONN,
|
||||
HID_ERR_DISCONNECTING,
|
||||
HID_ERR_SET_CONNABLE_FAIL,
|
||||
/* Device specific error codes */
|
||||
HID_ERR_HOST_UNKNOWN,
|
||||
HID_ERR_L2CAP_FAILED,
|
||||
HID_ERR_AUTH_FAILED,
|
||||
HID_ERR_SDP_BUSY,
|
||||
HID_ERR_GATT,
|
||||
|
||||
HID_ERR_INVALID = 0xFF
|
||||
};
|
||||
|
||||
typedef UINT8 tHID_STATUS;
|
||||
|
||||
#define HID_L2CAP_CONN_FAIL (0x0100) /* Connection Attempt was made but failed */
|
||||
#define HID_L2CAP_REQ_FAIL (0x0200) /* L2CAP_ConnectReq API failed */
|
||||
#define HID_L2CAP_CFG_FAIL (0x0400) /* L2CAP Configuration was rejected by peer */
|
||||
|
||||
|
||||
|
||||
/* Define the HID transaction types
|
||||
*/
|
||||
#define HID_TRANS_HANDSHAKE (0)
|
||||
#define HID_TRANS_CONTROL (1)
|
||||
#define HID_TRANS_GET_REPORT (4)
|
||||
#define HID_TRANS_SET_REPORT (5)
|
||||
#define HID_TRANS_GET_PROTOCOL (6)
|
||||
#define HID_TRANS_SET_PROTOCOL (7)
|
||||
#define HID_TRANS_GET_IDLE (8)
|
||||
#define HID_TRANS_SET_IDLE (9)
|
||||
#define HID_TRANS_DATA (10)
|
||||
#define HID_TRANS_DATAC (11)
|
||||
|
||||
#define HID_GET_TRANS_FROM_HDR(x) ((x >> 4) & 0x0f)
|
||||
#define HID_GET_PARAM_FROM_HDR(x) (x & 0x0f)
|
||||
#define HID_BUILD_HDR(t,p) (UINT8)((t << 4) | (p & 0x0f))
|
||||
|
||||
|
||||
/* Parameters for Handshake
|
||||
*/
|
||||
#define HID_PAR_HANDSHAKE_RSP_SUCCESS (0)
|
||||
#define HID_PAR_HANDSHAKE_RSP_NOT_READY (1)
|
||||
#define HID_PAR_HANDSHAKE_RSP_ERR_INVALID_REP_ID (2)
|
||||
#define HID_PAR_HANDSHAKE_RSP_ERR_UNSUPPORTED_REQ (3)
|
||||
#define HID_PAR_HANDSHAKE_RSP_ERR_INVALID_PARAM (4)
|
||||
#define HID_PAR_HANDSHAKE_RSP_ERR_UNKNOWN (14)
|
||||
#define HID_PAR_HANDSHAKE_RSP_ERR_FATAL (15)
|
||||
|
||||
|
||||
/* Parameters for Control
|
||||
*/
|
||||
#define HID_PAR_CONTROL_NOP (0)
|
||||
#define HID_PAR_CONTROL_HARD_RESET (1)
|
||||
#define HID_PAR_CONTROL_SOFT_RESET (2)
|
||||
#define HID_PAR_CONTROL_SUSPEND (3)
|
||||
#define HID_PAR_CONTROL_EXIT_SUSPEND (4)
|
||||
#define HID_PAR_CONTROL_VIRTUAL_CABLE_UNPLUG (5)
|
||||
|
||||
|
||||
/* Different report types in get, set, data
|
||||
*/
|
||||
#define HID_PAR_REP_TYPE_MASK (0x03)
|
||||
#define HID_PAR_REP_TYPE_OTHER (0x00)
|
||||
#define HID_PAR_REP_TYPE_INPUT (0x01)
|
||||
#define HID_PAR_REP_TYPE_OUTPUT (0x02)
|
||||
#define HID_PAR_REP_TYPE_FEATURE (0x03)
|
||||
|
||||
/* Parameters for Get Report
|
||||
*/
|
||||
|
||||
/* Buffer size in two bytes after Report ID */
|
||||
#define HID_PAR_GET_REP_BUFSIZE_FOLLOWS (0x08)
|
||||
|
||||
|
||||
/* Parameters for Protocol Type
|
||||
*/
|
||||
#define HID_PAR_PROTOCOL_MASK (0x01)
|
||||
#define HID_PAR_PROTOCOL_REPORT (0x01)
|
||||
#define HID_PAR_PROTOCOL_BOOT_MODE (0x00)
|
||||
|
||||
#define HID_PAR_REP_TYPE_MASK (0x03)
|
||||
|
||||
/* Descriptor types in the SDP record
|
||||
*/
|
||||
#define HID_SDP_DESCRIPTOR_REPORT (0x22)
|
||||
#define HID_SDP_DESCRIPTOR_PHYSICAL (0x23)
|
||||
|
||||
typedef struct desc_info {
|
||||
UINT16 dl_len;
|
||||
UINT8 *dsc_list;
|
||||
} tHID_DEV_DSCP_INFO;
|
||||
|
||||
#define HID_SSR_PARAM_INVALID 0xffff
|
||||
|
||||
typedef struct sdp_info {
|
||||
char svc_name[HID_MAX_SVC_NAME_LEN]; /*Service Name */
|
||||
char svc_descr[HID_MAX_SVC_DESCR_LEN]; /*Service Description*/
|
||||
char prov_name[HID_MAX_PROV_NAME_LEN]; /*Provider Name.*/
|
||||
UINT16 rel_num; /*Release Number */
|
||||
UINT16 hpars_ver; /*HID Parser Version.*/
|
||||
UINT16 ssr_max_latency; /* HIDSSRHostMaxLatency value, if HID_SSR_PARAM_INVALID not used*/
|
||||
UINT16 ssr_min_tout; /* HIDSSRHostMinTimeout value, if HID_SSR_PARAM_INVALID not used* */
|
||||
UINT8 sub_class; /*Device Subclass.*/
|
||||
UINT8 ctry_code; /*Country Code.*/
|
||||
UINT16 sup_timeout;/* Supervisory Timeout */
|
||||
|
||||
tHID_DEV_DSCP_INFO dscp_info; /* Descriptor list and Report list to be set in the SDP record.
|
||||
This parameter is used if HID_DEV_USE_GLB_SDP_REC is set to FALSE.*/
|
||||
#if(SDP_INCLUDED == TRUE)
|
||||
tSDP_DISC_REC *p_sdp_layer_rec;
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
} tHID_DEV_SDP_INFO;
|
||||
|
||||
#endif ///HID_HOST_INCLUDED == TRUE
|
||||
#endif
|
||||
|
238
tools/sdk/include/bluedroid/stack/hidh_api.h
Normal file
238
tools/sdk/include/bluedroid/stack/hidh_api.h
Normal file
@ -0,0 +1,238 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 HIDH_API_H
|
||||
#define HIDH_API_H
|
||||
|
||||
#include "stack/hiddefs.h"
|
||||
#include "stack/sdp_api.h"
|
||||
|
||||
#if (HID_HOST_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
enum {
|
||||
HID_SDP_NO_SERV_UUID = (SDP_ILLEGAL_PARAMETER + 1),
|
||||
HID_SDP_MANDATORY_MISSING
|
||||
};
|
||||
|
||||
/* Attributes mask values to be used in HID_HostAddDev API */
|
||||
#define HID_VIRTUAL_CABLE 0x0001
|
||||
#define HID_NORMALLY_CONNECTABLE 0x0002
|
||||
#define HID_RECONN_INIT 0x0004
|
||||
#define HID_SDP_DISABLE 0x0008
|
||||
#define HID_BATTERY_POWER 0x0010
|
||||
#define HID_REMOTE_WAKE 0x0020
|
||||
#define HID_SUP_TOUT_AVLBL 0x0040
|
||||
#define HID_SSR_MAX_LATENCY 0x0080
|
||||
#define HID_SSR_MIN_TOUT 0x0100
|
||||
|
||||
#define HID_SEC_REQUIRED 0x8000
|
||||
#define HID_ATTR_MASK_IGNORE 0
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
typedef void (tHID_HOST_SDP_CALLBACK) (UINT16 result, UINT16 attr_mask,
|
||||
tHID_DEV_SDP_INFO *sdp_rec );
|
||||
|
||||
/* HID-HOST returns the events in the following table to the application via tHID_HOST_DEV_CALLBACK
|
||||
HID_HDEV_EVT_OPEN Connected to device with Interrupt and Control Channels in OPEN state.
|
||||
Data = NA
|
||||
HID_HDEV_EVT_CLOSE Connection with device is closed. Data=reason code.
|
||||
HID_HDEV_EVT_RETRYING Lost connection is being re-connected.
|
||||
Data=Retrial number
|
||||
HID_HDEV_EVT_IN_REPORT Device sent an input report Data=Report Type pdata= pointer to BT_HDR
|
||||
(GKI buffer having report data.)
|
||||
HID_HDEV_EVT_HANDSHAKE Device sent SET_REPORT Data=Result-code pdata=NA.
|
||||
HID_HDEV_EVT_VC_UNPLUG Device sent Virtual Unplug Data=NA. pdata=NA.
|
||||
*/
|
||||
|
||||
enum {
|
||||
HID_HDEV_EVT_OPEN,
|
||||
HID_HDEV_EVT_CLOSE,
|
||||
HID_HDEV_EVT_RETRYING,
|
||||
HID_HDEV_EVT_INTR_DATA,
|
||||
HID_HDEV_EVT_INTR_DATC,
|
||||
HID_HDEV_EVT_CTRL_DATA,
|
||||
HID_HDEV_EVT_CTRL_DATC,
|
||||
HID_HDEV_EVT_HANDSHAKE,
|
||||
HID_HDEV_EVT_VC_UNPLUG
|
||||
};
|
||||
typedef void (tHID_HOST_DEV_CALLBACK) (UINT8 dev_handle,
|
||||
BD_ADDR addr,
|
||||
UINT8 event, /* Event from HID-DEVICE. */
|
||||
UINT32 data, /* Integer data corresponding to the event.*/
|
||||
BT_HDR *p_buf ); /* Pointer data corresponding to the event. */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostGetSDPRecord
|
||||
**
|
||||
** Description This function reads the device SDP record.
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostGetSDPRecord (BD_ADDR addr,
|
||||
tSDP_DISCOVERY_DB *p_db,
|
||||
UINT32 db_len,
|
||||
tHID_HOST_SDP_CALLBACK *sdp_cback );
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostRegister
|
||||
**
|
||||
** Description This function registers HID-Host with lower layers.
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostRegister (tHID_HOST_DEV_CALLBACK *dev_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostDeregister
|
||||
**
|
||||
** Description This function is called when the host is about power down.
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostDeregister(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostAddDev
|
||||
**
|
||||
** Description This is called so HID-host may manage this device.
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostAddDev (BD_ADDR addr, UINT16 attr_mask,
|
||||
UINT8 *handle );
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostRemoveDev
|
||||
**
|
||||
** Description This removes the device from list devices that host has to manage.
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostRemoveDev (UINT8 dev_handle );
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostOpenDev
|
||||
**
|
||||
** Description This function is called when the user wants to initiate a
|
||||
** connection attempt to a device.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostOpenDev (UINT8 dev_handle );
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostWriteDev
|
||||
**
|
||||
** Description This function is called when the host has a report to send.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostWriteDev(UINT8 dev_handle, UINT8 t_type,
|
||||
UINT8 param, UINT16 data,
|
||||
UINT8 report_id, BT_HDR *pbuf);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostCloseDev
|
||||
**
|
||||
** Description This function disconnects the device.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostCloseDev(UINT8 dev_handle );
|
||||
|
||||
/*******************************************************************************
|
||||
** Function HID_HostInit
|
||||
**
|
||||
** Description This function initializes the control block and trace variable
|
||||
**
|
||||
** Returns void
|
||||
*******************************************************************************/
|
||||
extern void HID_HostInit(void);
|
||||
|
||||
/*******************************************************************************
|
||||
** Function HID_HostSetSecurityLevel
|
||||
**
|
||||
** Description This function sets the security level for the devices which
|
||||
** are marked by application as requiring security
|
||||
**
|
||||
** Returns tHID_STATUS
|
||||
*******************************************************************************/
|
||||
extern tHID_STATUS HID_HostSetSecurityLevel( char serv_name[], UINT8 sec_lvl );
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function hid_known_hid_device
|
||||
**
|
||||
** Description This function checks if this device is of type HID Device
|
||||
**
|
||||
** Returns TRUE if device exists else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN hid_known_hid_device (BD_ADDR bd_addr);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function HID_HostSetTraceLevel
|
||||
**
|
||||
** Description This function sets the trace level for HID Host. If called with
|
||||
** a value of 0xFF, it simply reads the current trace level.
|
||||
**
|
||||
** Returns the new (current) trace level
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 HID_HostSetTraceLevel (UINT8 new_level);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///HID_HOST_INCLUDED == TRUE
|
||||
|
||||
#endif /* HIDH_API_H */
|
1237
tools/sdk/include/bluedroid/stack/l2c_api.h
Normal file
1237
tools/sdk/include/bluedroid/stack/l2c_api.h
Normal file
File diff suppressed because it is too large
Load Diff
80
tools/sdk/include/bluedroid/stack/l2cap_client.h
Normal file
80
tools/sdk/include/bluedroid/stack/l2cap_client.h
Normal file
@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 Google, Inc.
|
||||
*
|
||||
* 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 _L2CAP_CLIENT_H_
|
||||
#define _L2CAP_CLIENT_H_
|
||||
#if (defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
|
||||
|
||||
//#include <hardware/bluetooth.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct buffer_t buffer_t;
|
||||
typedef struct l2cap_client_t l2cap_client_t;
|
||||
|
||||
typedef struct {
|
||||
void (*connected)(l2cap_client_t *client, void *context);
|
||||
void (*disconnected)(l2cap_client_t *client, void *context);
|
||||
void (*read_ready)(l2cap_client_t *client, buffer_t *packet, void *context);
|
||||
void (*write_ready)(l2cap_client_t *client, void *context);
|
||||
} l2cap_client_callbacks_t;
|
||||
|
||||
// Returns a new buffer with enough space for |size| bytes of L2CAP payload.
|
||||
// |size| must be greater than zero. This function returns NULL if the buffer
|
||||
// could not be allocated. The returned buffer must be freed with |buffer_free|
|
||||
// when it is no longer needed.
|
||||
buffer_t *l2cap_buffer_new(size_t size);
|
||||
|
||||
// Creates and returns a new L2CAP client object. |callbacks| must not be NULL and
|
||||
// must specify a set of functions that should be called back when events occur
|
||||
// on the L2CAP connection. |context| may be NULL and will be passed as the argument
|
||||
// to all callbacks in |l2cap_client_callbacks_t|. The returned object must be freed
|
||||
// with |l2cap_client_free|.
|
||||
l2cap_client_t *l2cap_client_new(const l2cap_client_callbacks_t *callbacks, void *context);
|
||||
|
||||
// Frees the L2CAP client object allocated with |l2cap_client_new|. |client| may be NULL.
|
||||
void l2cap_client_free(l2cap_client_t *client);
|
||||
|
||||
// Attempts to connect the |client| to a peer device specified by |remote_bdaddr|
|
||||
// using the |psm| protocol specifier. This function returns true if the connect
|
||||
// operation could be started and will indicate completion with either a 'connected'
|
||||
// callback (success) or a 'disconnected' callback (failure).
|
||||
//
|
||||
// This function must not be called while a connect operation is in progress or
|
||||
// while |l2cap_client_is_connected|. |client| and |remote_bdaddr| must not be NULL.
|
||||
// |psm| must be greater than zero.
|
||||
bool l2cap_client_connect(l2cap_client_t *client, const bt_bdaddr_t *remote_bdaddr, uint16_t psm);
|
||||
|
||||
// Disconnects a connected |client|. This function is asynchronous and idempotent. It
|
||||
// will indicate completion with a 'disconnected' callback. |client| must not be NULL.
|
||||
void l2cap_client_disconnect(l2cap_client_t *client);
|
||||
|
||||
// Returns true if |client| is connected and is ready to accept data written to it.
|
||||
// |client| must not be NULL.
|
||||
bool l2cap_client_is_connected(const l2cap_client_t *client);
|
||||
|
||||
// Writes data contained in |packet| to a connected |client|. This function returns
|
||||
// true if the packet was successfully queued for delivery, false if the client cannot
|
||||
// accept more data at this time. If this function returns false, the caller must wait
|
||||
// for the 'write_ready' callback to write additional data to the client. Neither
|
||||
// |client| nor |packet| may be NULL.
|
||||
bool l2cap_client_write(l2cap_client_t *client, buffer_t *packet);
|
||||
|
||||
#endif ///(defined(L2CAP_CLIENT_INCLUDED) && L2CAP_CLIENT_INCLUDED == TRUE)
|
||||
|
||||
#endif /*_L2CAP_CLIENT_H_*/
|
329
tools/sdk/include/bluedroid/stack/l2cdefs.h
Normal file
329
tools/sdk/include/bluedroid/stack/l2cdefs.h
Normal file
@ -0,0 +1,329 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 L2CDEFS_H
|
||||
#define L2CDEFS_H
|
||||
|
||||
/* L2CAP command codes
|
||||
*/
|
||||
#define L2CAP_CMD_REJECT 0x01
|
||||
#define L2CAP_CMD_CONN_REQ 0x02
|
||||
#define L2CAP_CMD_CONN_RSP 0x03
|
||||
#define L2CAP_CMD_CONFIG_REQ 0x04
|
||||
#define L2CAP_CMD_CONFIG_RSP 0x05
|
||||
#define L2CAP_CMD_DISC_REQ 0x06
|
||||
#define L2CAP_CMD_DISC_RSP 0x07
|
||||
#define L2CAP_CMD_ECHO_REQ 0x08
|
||||
#define L2CAP_CMD_ECHO_RSP 0x09
|
||||
#define L2CAP_CMD_INFO_REQ 0x0A
|
||||
#define L2CAP_CMD_INFO_RSP 0x0B
|
||||
#define L2CAP_CMD_AMP_CONN_REQ 0x0C
|
||||
#define L2CAP_CMD_AMP_CONN_RSP 0x0D
|
||||
#define L2CAP_CMD_AMP_MOVE_REQ 0x0E
|
||||
#define L2CAP_CMD_AMP_MOVE_RSP 0x0F
|
||||
#define L2CAP_CMD_AMP_MOVE_CFM 0x10
|
||||
#define L2CAP_CMD_AMP_MOVE_CFM_RSP 0x11
|
||||
|
||||
#define L2CAP_CMD_BLE_UPDATE_REQ 0x12
|
||||
#define L2CAP_CMD_BLE_UPDATE_RSP 0x13
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ 0x14
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES 0x15
|
||||
#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT 0x16
|
||||
|
||||
|
||||
|
||||
/* Define some packet and header lengths
|
||||
*/
|
||||
#define L2CAP_PKT_OVERHEAD 4 /* Length and CID */
|
||||
#define L2CAP_CMD_OVERHEAD 4 /* Cmd code, Id and length */
|
||||
#define L2CAP_CMD_REJECT_LEN 2 /* Reason (data is optional) */
|
||||
#define L2CAP_CONN_REQ_LEN 4 /* PSM and source CID */
|
||||
#define L2CAP_CONN_RSP_LEN 8 /* Dest CID, source CID, reason, status */
|
||||
#define L2CAP_CONFIG_REQ_LEN 4 /* Dest CID, flags (data is optional) */
|
||||
#define L2CAP_CONFIG_RSP_LEN 6 /* Dest CID, flags, result,data optional*/
|
||||
#define L2CAP_DISC_REQ_LEN 4 /* Dest CID, source CID */
|
||||
#define L2CAP_DISC_RSP_LEN 4 /* Dest CID, source CID */
|
||||
#define L2CAP_ECHO_REQ_LEN 0 /* Data is optional */
|
||||
#define L2CAP_ECHO_RSP_LEN 0 /* Data is optional */
|
||||
#define L2CAP_INFO_REQ_LEN 2 /* Info type */
|
||||
#define L2CAP_INFO_RSP_LEN 4 /* Info type, result (data is optional) */
|
||||
#define L2CAP_BCST_OVERHEAD 2 /* Additional broadcast packet overhead */
|
||||
#define L2CAP_UCD_OVERHEAD 2 /* Additional connectionless packet overhead */
|
||||
|
||||
#define L2CAP_AMP_CONN_REQ_LEN 5 /* PSM, CID, and remote controller ID */
|
||||
#define L2CAP_AMP_MOVE_REQ_LEN 3 /* CID and remote controller ID */
|
||||
#define L2CAP_AMP_MOVE_RSP_LEN 4 /* CID and result */
|
||||
#define L2CAP_AMP_MOVE_CFM_LEN 4 /* CID and result */
|
||||
#define L2CAP_AMP_MOVE_CFM_RSP_LEN 2 /* CID */
|
||||
|
||||
#define L2CAP_CMD_BLE_UPD_REQ_LEN 8 /* Min and max interval, latency, tout */
|
||||
#define L2CAP_CMD_BLE_UPD_RSP_LEN 2 /* Result */
|
||||
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_REQ_LEN 10 /* LE_PSM, SCID, MTU, MPS, Init Credit */
|
||||
#define L2CAP_CMD_BLE_CREDIT_BASED_CONN_RES_LEN 10 /* DCID, MTU, MPS, Init credit, Result */
|
||||
#define L2CAP_CMD_BLE_FLOW_CTRL_CREDIT_LEN 4 /* CID, Credit */
|
||||
|
||||
|
||||
|
||||
/* Define the packet boundary flags
|
||||
*/
|
||||
#if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
|
||||
#define L2CAP_PKT_START_FLUSHABLE 2
|
||||
#define L2CAP_PKT_START_NON_FLUSHABLE 0
|
||||
#endif
|
||||
#define L2CAP_COMPLETE_AMP_PKT 3 /* complete L2CAP packet on AMP HCI */
|
||||
#define L2CAP_PKT_START 2
|
||||
#define L2CAP_PKT_CONTINUE 1
|
||||
#define L2CAP_MASK_FLAG 0x0FFF
|
||||
#define L2CAP_PKT_TYPE_SHIFT 12
|
||||
#define L2CAP_PKT_TYPE_MASK 3
|
||||
|
||||
|
||||
/* Define the L2CAP connection result codes
|
||||
*/
|
||||
#define L2CAP_CONN_OK 0
|
||||
#define L2CAP_CONN_PENDING 1
|
||||
#define L2CAP_CONN_NO_PSM 2
|
||||
#define L2CAP_CONN_SECURITY_BLOCK 3
|
||||
#define L2CAP_CONN_NO_RESOURCES 4
|
||||
#define L2CAP_CONN_BAD_CTLR_ID 5 /* AMP related */
|
||||
#define L2CAP_CONN_TIMEOUT 0xEEEE
|
||||
#define L2CAP_CONN_AMP_FAILED 254
|
||||
#define L2CAP_CONN_NO_LINK 255 /* Add a couple of our own for internal use */
|
||||
#define L2CAP_CONN_CANCEL 256 /* L2CAP connection cancelled */
|
||||
|
||||
|
||||
/* Define L2CAP Move Channel Response result codes
|
||||
*/
|
||||
#define L2CAP_MOVE_OK 0
|
||||
#define L2CAP_MOVE_PENDING 1
|
||||
#define L2CAP_MOVE_CTRL_ID_NOT_SUPPORT 2
|
||||
#define L2CAP_MOVE_SAME_CTRLR_ID 3
|
||||
#define L2CAP_MOVE_CONFIG_NOT_SUPPORTED 4
|
||||
#define L2CAP_MOVE_CHAN_COLLISION 5
|
||||
#define L2CAP_MOVE_NOT_ALLOWED 6
|
||||
|
||||
|
||||
/* Define L2CAP Move Channel Confirmation result codes
|
||||
*/
|
||||
#define L2CAP_MOVE_CFM_OK 0
|
||||
#define L2CAP_MOVE_CFM_REFUSED 1
|
||||
|
||||
|
||||
/* Define the L2CAP command reject reason codes
|
||||
*/
|
||||
#define L2CAP_CMD_REJ_NOT_UNDERSTOOD 0
|
||||
#define L2CAP_CMD_REJ_MTU_EXCEEDED 1
|
||||
#define L2CAP_CMD_REJ_INVALID_CID 2
|
||||
|
||||
|
||||
/* L2CAP Predefined CIDs
|
||||
*/
|
||||
#define L2CAP_SIGNALLING_CID 1
|
||||
#define L2CAP_CONNECTIONLESS_CID 2
|
||||
#define L2CAP_AMP_CID 3
|
||||
#define L2CAP_ATT_CID 4
|
||||
#define L2CAP_BLE_SIGNALLING_CID 5
|
||||
#define L2CAP_SMP_CID 6
|
||||
#define L2CAP_SMP_BR_CID 7
|
||||
#define L2CAP_AMP_TEST_CID 0x003F
|
||||
#define L2CAP_BASE_APPL_CID 0x0040
|
||||
#define L2CAP_BLE_CONN_MAX_CID 0x007F
|
||||
|
||||
/* Fixed Channels mask bits */
|
||||
|
||||
/* Signal channel supported (Mandatory) */
|
||||
#define L2CAP_FIXED_CHNL_SIG_BIT (1 << L2CAP_SIGNALLING_CID)
|
||||
|
||||
/* Connectionless reception */
|
||||
#define L2CAP_FIXED_CHNL_CNCTLESS_BIT (1 << L2CAP_CONNECTIONLESS_CID)
|
||||
|
||||
/* AMP Manager supported */
|
||||
#define L2CAP_FIXED_CHNL_AMP_BIT (1 << L2CAP_AMP_CID)
|
||||
|
||||
/* Attribute protocol supported */
|
||||
#define L2CAP_FIXED_CHNL_ATT_BIT (1 << L2CAP_ATT_CID)
|
||||
|
||||
/* BLE Signalling supported */
|
||||
#define L2CAP_FIXED_CHNL_BLE_SIG_BIT (1 << L2CAP_BLE_SIGNALLING_CID)
|
||||
|
||||
/* BLE Security Mgr supported */
|
||||
#define L2CAP_FIXED_CHNL_SMP_BIT (1 << L2CAP_SMP_CID)
|
||||
|
||||
/* Security Mgr over BR supported */
|
||||
#define L2CAP_FIXED_CHNL_SMP_BR_BIT (1 << L2CAP_SMP_BR_CID)
|
||||
|
||||
|
||||
|
||||
/* Define the L2CAP configuration result codes
|
||||
*/
|
||||
#define L2CAP_CFG_OK 0
|
||||
#define L2CAP_CFG_UNACCEPTABLE_PARAMS 1
|
||||
#define L2CAP_CFG_FAILED_NO_REASON 2
|
||||
#define L2CAP_CFG_UNKNOWN_OPTIONS 3
|
||||
#define L2CAP_CFG_PENDING 4
|
||||
#define L2CAP_CFG_FLOW_SPEC_REJECTED 5
|
||||
|
||||
|
||||
/* Define the L2CAP configuration option types
|
||||
*/
|
||||
#define L2CAP_CFG_TYPE_MTU 0x01
|
||||
#define L2CAP_CFG_TYPE_FLUSH_TOUT 0x02
|
||||
#define L2CAP_CFG_TYPE_QOS 0x03
|
||||
#define L2CAP_CFG_TYPE_FCR 0x04
|
||||
#define L2CAP_CFG_TYPE_FCS 0x05
|
||||
#define L2CAP_CFG_TYPE_EXT_FLOW 0x06
|
||||
#define L2CAP_CFG_TYPE_EXT_WIN_SIZE 0x07
|
||||
|
||||
#define L2CAP_CFG_MTU_OPTION_LEN 2 /* MTU option length */
|
||||
#define L2CAP_CFG_FLUSH_OPTION_LEN 2 /* Flush option len */
|
||||
#define L2CAP_CFG_QOS_OPTION_LEN 22 /* QOS option length */
|
||||
#define L2CAP_CFG_FCR_OPTION_LEN 9 /* FCR option length */
|
||||
#define L2CAP_CFG_FCS_OPTION_LEN 1 /* FCR option length */
|
||||
#define L2CAP_CFG_EXT_FLOW_OPTION_LEN 16 /* Extended Flow Spec */
|
||||
#define L2CAP_CFG_EXT_WIN_SIZE_LEN 2 /* Ext window size length */
|
||||
#define L2CAP_CFG_OPTION_OVERHEAD 2 /* Type and length */
|
||||
|
||||
/* Configuration Cmd/Rsp Flags mask
|
||||
*/
|
||||
#define L2CAP_CFG_FLAGS_MASK_CONT 0x0001 /* Flags mask: Continuation */
|
||||
|
||||
/* FCS Check Option values
|
||||
*/
|
||||
#define L2CAP_CFG_FCS_BYPASS 0 /* Bypass the FCS in streaming or ERTM modes */
|
||||
#define L2CAP_CFG_FCS_USE 1 /* Use the FCS in streaming or ERTM modes [default] */
|
||||
|
||||
/* Default values for configuration
|
||||
*/
|
||||
#define L2CAP_NO_AUTOMATIC_FLUSH 0xFFFF
|
||||
#define L2CAP_NO_RETRANSMISSION 0x0001
|
||||
|
||||
#define L2CAP_DEFAULT_MTU (672)
|
||||
#define L2CAP_DEFAULT_FLUSH_TO L2CAP_NO_AUTOMATIC_FLUSH
|
||||
#define L2CAP_DEFAULT_SERV_TYPE 1
|
||||
#define L2CAP_DEFAULT_TOKEN_RATE 0
|
||||
#define L2CAP_DEFAULT_BUCKET_SIZE 0
|
||||
#define L2CAP_DEFAULT_PEAK_BANDWIDTH 0
|
||||
#define L2CAP_DEFAULT_LATENCY 0xFFFFFFFF
|
||||
#define L2CAP_DEFAULT_DELAY 0xFFFFFFFF
|
||||
#define L2CAP_DEFAULT_FCS L2CAP_CFG_FCS_USE
|
||||
|
||||
|
||||
/* Define the L2CAP disconnect result codes
|
||||
*/
|
||||
#define L2CAP_DISC_OK 0
|
||||
#define L2CAP_DISC_TIMEOUT 0xEEEE
|
||||
|
||||
/* Define the L2CAP info resp result codes
|
||||
*/
|
||||
#define L2CAP_INFO_RESP_RESULT_SUCCESS 0
|
||||
#define L2CAP_INFO_RESP_RESULT_NOT_SUPPORTED 1
|
||||
|
||||
/* Define the info-type fields of information request & response
|
||||
*/
|
||||
#define L2CAP_CONNLESS_MTU_INFO_TYPE 0x0001
|
||||
#define L2CAP_EXTENDED_FEATURES_INFO_TYPE 0x0002 /* Used in Information Req/Response */
|
||||
#define L2CAP_FIXED_CHANNELS_INFO_TYPE 0x0003 /* Used in AMP */
|
||||
|
||||
#define L2CAP_CONNLESS_MTU_INFO_SIZE 2 /* Connectionless MTU size */
|
||||
#define L2CAP_EXTENDED_FEATURES_ARRAY_SIZE 4 /* Extended features array size */
|
||||
#define L2CAP_FIXED_CHNL_ARRAY_SIZE 8 /* Fixed channel array size */
|
||||
|
||||
/* Extended features mask bits
|
||||
*/
|
||||
#define L2CAP_EXTFEA_RTRANS 0x00000001 /* Retransmission Mode (Not Supported) */
|
||||
#define L2CAP_EXTFEA_FC 0x00000002 /* Flow Control Mode (Not Supported) */
|
||||
#define L2CAP_EXTFEA_QOS 0x00000004
|
||||
#define L2CAP_EXTFEA_ENH_RETRANS 0x00000008 /* Enhanced retransmission mode */
|
||||
#define L2CAP_EXTFEA_STREAM_MODE 0x00000010 /* Streaming Mode */
|
||||
#define L2CAP_EXTFEA_NO_CRC 0x00000020 /* Optional FCS (if set No FCS desired) */
|
||||
#define L2CAP_EXTFEA_EXT_FLOW_SPEC 0x00000040 /* Extended flow spec */
|
||||
#define L2CAP_EXTFEA_FIXED_CHNLS 0x00000080 /* Fixed channels */
|
||||
#define L2CAP_EXTFEA_EXT_WINDOW 0x00000100 /* Extended Window Size */
|
||||
#define L2CAP_EXTFEA_UCD_RECEPTION 0x00000200 /* Unicast Connectionless Data Reception */
|
||||
|
||||
/* Mask for locally supported features used in Information Response (default to none) */
|
||||
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
|
||||
#define L2CAP_EXTFEA_SUPPORTED_MASK 0
|
||||
#endif
|
||||
|
||||
/* Mask for LE supported features used in Information Response (default to none) */
|
||||
#ifndef L2CAP_BLE_EXTFEA_MASK
|
||||
#define L2CAP_BLE_EXTFEA_MASK 0
|
||||
#endif
|
||||
|
||||
/* Define a value that tells L2CAP to use the default HCI ACL buffer size */
|
||||
#define L2CAP_INVALID_ERM_BUF_SIZE 0
|
||||
|
||||
/* Define a value that tells L2CAP to use the default MPS */
|
||||
#define L2CAP_DEFAULT_ERM_MPS 0x0000
|
||||
|
||||
#define L2CAP_FCR_OVERHEAD 2 /* Control word */
|
||||
#define L2CAP_FCS_LEN 2 /* FCS takes 2 bytes */
|
||||
#define L2CAP_SDU_LEN_OVERHEAD 2 /* SDU length field is 2 bytes */
|
||||
#define L2CAP_SDU_LEN_OFFSET 2 /* SDU length offset is 2 bytes */
|
||||
#define L2CAP_EXT_CONTROL_OVERHEAD 4 /* Extended Control Field */
|
||||
#define L2CAP_MAX_HEADER_FCS (L2CAP_PKT_OVERHEAD + L2CAP_EXT_CONTROL_OVERHEAD + L2CAP_SDU_LEN_OVERHEAD + L2CAP_FCS_LEN)
|
||||
/* length(2), channel(2), control(4), SDU length(2) FCS(2) */
|
||||
/* To optimize this, it must be a multiplum of the L2CAP PDU length AND match the 3DH5 air
|
||||
* including the l2cap headers in each packet - to match the latter - the -5 is added
|
||||
*/
|
||||
#define L2CAP_MAX_SDU_LENGTH (8080 + 26 - (L2CAP_MIN_OFFSET + 6))
|
||||
#define L2CAP_MAX_BUF_SIZE (10240 + 24)
|
||||
|
||||
/* Part of L2CAP_MIN_OFFSET that is not part of L2CAP
|
||||
*/
|
||||
#define L2CAP_OFFSET_WO_L2HDR (L2CAP_MIN_OFFSET-(L2CAP_PKT_OVERHEAD+L2CAP_FCR_OVERHEAD))
|
||||
|
||||
/* SAR bits in the control word
|
||||
*/
|
||||
#define L2CAP_FCR_UNSEG_SDU 0x0000 /* Control word to begin with for unsegmented PDU*/
|
||||
#define L2CAP_FCR_START_SDU 0x4000 /* ...for Starting PDU of a semented SDU */
|
||||
#define L2CAP_FCR_END_SDU 0x8000 /* ...for ending PDU of a segmented SDU */
|
||||
#define L2CAP_FCR_CONT_SDU 0xc000 /* ...for continuation PDU of a segmented SDU */
|
||||
|
||||
/* Supervisory frame types
|
||||
*/
|
||||
#define L2CAP_FCR_SUP_RR 0x0000 /* Supervisory frame - RR */
|
||||
#define L2CAP_FCR_SUP_REJ 0x0001 /* Supervisory frame - REJ */
|
||||
#define L2CAP_FCR_SUP_RNR 0x0002 /* Supervisory frame - RNR */
|
||||
#define L2CAP_FCR_SUP_SREJ 0x0003 /* Supervisory frame - SREJ */
|
||||
|
||||
#define L2CAP_FCR_SAR_BITS 0xC000 /* Mask to get the SAR bits from control word */
|
||||
#define L2CAP_FCR_SAR_BITS_SHIFT 14 /* Bits to shift right to get the SAR bits from ctrl-word */
|
||||
|
||||
#define L2CAP_FCR_S_FRAME_BIT 0x0001 /* Mask to check if a PDU is S-frame */
|
||||
#define L2CAP_FCR_REQ_SEQ_BITS 0x3F00 /* Mask to get the req-seq from control word */
|
||||
#define L2CAP_FCR_REQ_SEQ_BITS_SHIFT 8 /* Bits to shift right to get the req-seq from ctrl-word */
|
||||
#define L2CAP_FCR_TX_SEQ_BITS 0x007E /* Mask on get the tx-seq from control word */
|
||||
#define L2CAP_FCR_TX_SEQ_BITS_SHIFT 1 /* Bits to shift right to get the tx-seq from ctrl-word */
|
||||
|
||||
#define L2CAP_FCR_F_BIT 0x0080 /* F-bit in the control word (Sup and I frames) */
|
||||
#define L2CAP_FCR_P_BIT 0x0010 /* P-bit in the control word (Sup frames only) */
|
||||
|
||||
#define L2CAP_FCR_F_BIT_SHIFT 7
|
||||
#define L2CAP_FCR_P_BIT_SHIFT 4
|
||||
|
||||
#define L2CAP_FCR_SEG_BITS 0xC000 /* Mask to get the segmentation bits from ctrl-word */
|
||||
#define L2CAP_FCR_SUP_SHIFT 2 /* Bits to shift right to get the S-bits from ctrl-word */
|
||||
#define L2CAP_FCR_SUP_BITS 0x000C /* Mask to get the supervisory bits from ctrl-word */
|
||||
|
||||
#define L2CAP_FCR_INIT_CRC 0 /* Initial state of the CRC register */
|
||||
#define L2CAP_FCR_SEQ_MODULO 0x3F /* Mask for sequence numbers (range 0 - 63) */
|
||||
|
||||
#endif
|
657
tools/sdk/include/bluedroid/stack/port_api.h
Normal file
657
tools/sdk/include/bluedroid/stack/port_api.h
Normal file
@ -0,0 +1,657 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains the PORT API definitions
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef PORT_API_H
|
||||
#define PORT_API_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and Types
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
** Define port settings structure send from the application in the
|
||||
** set settings request, or to the application in the set settings indication.
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
#define PORT_BAUD_RATE_2400 0x00
|
||||
#define PORT_BAUD_RATE_4800 0x01
|
||||
#define PORT_BAUD_RATE_7200 0x02
|
||||
#define PORT_BAUD_RATE_9600 0x03
|
||||
#define PORT_BAUD_RATE_19200 0x04
|
||||
#define PORT_BAUD_RATE_38400 0x05
|
||||
#define PORT_BAUD_RATE_57600 0x06
|
||||
#define PORT_BAUD_RATE_115200 0x07
|
||||
#define PORT_BAUD_RATE_230400 0x08
|
||||
|
||||
UINT8 baud_rate;
|
||||
|
||||
#define PORT_5_BITS 0x00
|
||||
#define PORT_6_BITS 0x01
|
||||
#define PORT_7_BITS 0x02
|
||||
#define PORT_8_BITS 0x03
|
||||
|
||||
UINT8 byte_size;
|
||||
|
||||
#define PORT_ONESTOPBIT 0x00
|
||||
#define PORT_ONE5STOPBITS 0x01
|
||||
UINT8 stop_bits;
|
||||
|
||||
#define PORT_PARITY_NO 0x00
|
||||
#define PORT_PARITY_YES 0x01
|
||||
UINT8 parity;
|
||||
|
||||
#define PORT_ODD_PARITY 0x00
|
||||
#define PORT_EVEN_PARITY 0x01
|
||||
#define PORT_MARK_PARITY 0x02
|
||||
#define PORT_SPACE_PARITY 0x03
|
||||
|
||||
UINT8 parity_type;
|
||||
|
||||
#define PORT_FC_OFF 0x00
|
||||
#define PORT_FC_XONXOFF_ON_INPUT 0x01
|
||||
#define PORT_FC_XONXOFF_ON_OUTPUT 0x02
|
||||
#define PORT_FC_CTS_ON_INPUT 0x04
|
||||
#define PORT_FC_CTS_ON_OUTPUT 0x08
|
||||
#define PORT_FC_DSR_ON_INPUT 0x10
|
||||
#define PORT_FC_DSR_ON_OUTPUT 0x20
|
||||
|
||||
UINT8 fc_type;
|
||||
|
||||
UINT8 rx_char1;
|
||||
|
||||
#define PORT_XON_DC1 0x11
|
||||
UINT8 xon_char;
|
||||
|
||||
#define PORT_XOFF_DC3 0x13
|
||||
UINT8 xoff_char;
|
||||
|
||||
} tPORT_STATE;
|
||||
|
||||
|
||||
/*
|
||||
** Define the callback function prototypes. Parameters are specific
|
||||
** to each event and are described bellow
|
||||
*/
|
||||
typedef int (tPORT_DATA_CALLBACK) (UINT16 port_handle, void *p_data, UINT16 len);
|
||||
|
||||
#define DATA_CO_CALLBACK_TYPE_INCOMING 1
|
||||
#define DATA_CO_CALLBACK_TYPE_OUTGOING_SIZE 2
|
||||
#define DATA_CO_CALLBACK_TYPE_OUTGOING 3
|
||||
typedef int (tPORT_DATA_CO_CALLBACK) (UINT16 port_handle, UINT8 *p_buf, UINT16 len, int type);
|
||||
|
||||
typedef void (tPORT_CALLBACK) (UINT32 code, UINT16 port_handle);
|
||||
|
||||
/*
|
||||
** Define events that registered application can receive in the callback
|
||||
*/
|
||||
|
||||
#define PORT_EV_RXCHAR 0x00000001 /* Any Character received */
|
||||
#define PORT_EV_RXFLAG 0x00000002 /* Received certain character */
|
||||
#define PORT_EV_TXEMPTY 0x00000004 /* Transmitt Queue Empty */
|
||||
#define PORT_EV_CTS 0x00000008 /* CTS changed state */
|
||||
#define PORT_EV_DSR 0x00000010 /* DSR changed state */
|
||||
#define PORT_EV_RLSD 0x00000020 /* RLSD changed state */
|
||||
#define PORT_EV_BREAK 0x00000040 /* BREAK received */
|
||||
#define PORT_EV_ERR 0x00000080 /* Line status error occurred */
|
||||
#define PORT_EV_RING 0x00000100 /* Ring signal detected */
|
||||
#define PORT_EV_CTSS 0x00000400 /* CTS state */
|
||||
#define PORT_EV_DSRS 0x00000800 /* DSR state */
|
||||
#define PORT_EV_RLSDS 0x00001000 /* RLSD state */
|
||||
#define PORT_EV_OVERRUN 0x00002000 /* receiver buffer overrun */
|
||||
#define PORT_EV_TXCHAR 0x00004000 /* Any character transmitted */
|
||||
|
||||
#define PORT_EV_CONNECTED 0x00000200 /* RFCOMM connection established */
|
||||
#define PORT_EV_CONNECT_ERR 0x00008000 /* Was not able to establish connection */
|
||||
/* or disconnected */
|
||||
#define PORT_EV_FC 0x00010000 /* data flow enabled flag changed by remote */
|
||||
#define PORT_EV_FCS 0x00020000 /* data flow enable status true = enabled */
|
||||
|
||||
/*
|
||||
** To register for events application should provide bitmask with
|
||||
** corresponding bit set
|
||||
*/
|
||||
|
||||
#define PORT_MASK_ALL (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_CTS | \
|
||||
PORT_EV_DSR | PORT_EV_RLSD | PORT_EV_BREAK | \
|
||||
PORT_EV_ERR | PORT_EV_RING | PORT_EV_CONNECT_ERR | \
|
||||
PORT_EV_DSRS | PORT_EV_CTSS | PORT_EV_RLSDS | \
|
||||
PORT_EV_RXFLAG | PORT_EV_TXCHAR | PORT_EV_OVERRUN | \
|
||||
PORT_EV_FC | PORT_EV_FCS | PORT_EV_CONNECTED)
|
||||
|
||||
|
||||
/*
|
||||
** Define port result codes
|
||||
*/
|
||||
#define PORT_SUCCESS 0
|
||||
|
||||
#define PORT_ERR_BASE 0
|
||||
|
||||
#define PORT_UNKNOWN_ERROR (PORT_ERR_BASE + 1)
|
||||
#define PORT_ALREADY_OPENED (PORT_ERR_BASE + 2)
|
||||
#define PORT_CMD_PENDING (PORT_ERR_BASE + 3)
|
||||
#define PORT_APP_NOT_REGISTERED (PORT_ERR_BASE + 4)
|
||||
#define PORT_NO_MEM (PORT_ERR_BASE + 5)
|
||||
#define PORT_NO_RESOURCES (PORT_ERR_BASE + 6)
|
||||
#define PORT_BAD_BD_ADDR (PORT_ERR_BASE + 7)
|
||||
#define PORT_BAD_HANDLE (PORT_ERR_BASE + 9)
|
||||
#define PORT_NOT_OPENED (PORT_ERR_BASE + 10)
|
||||
#define PORT_LINE_ERR (PORT_ERR_BASE + 11)
|
||||
#define PORT_START_FAILED (PORT_ERR_BASE + 12)
|
||||
#define PORT_PAR_NEG_FAILED (PORT_ERR_BASE + 13)
|
||||
#define PORT_PORT_NEG_FAILED (PORT_ERR_BASE + 14)
|
||||
#define PORT_SEC_FAILED (PORT_ERR_BASE + 15)
|
||||
#define PORT_PEER_CONNECTION_FAILED (PORT_ERR_BASE + 16)
|
||||
#define PORT_PEER_FAILED (PORT_ERR_BASE + 17)
|
||||
#define PORT_PEER_TIMEOUT (PORT_ERR_BASE + 18)
|
||||
#define PORT_CLOSED (PORT_ERR_BASE + 19)
|
||||
#define PORT_TX_FULL (PORT_ERR_BASE + 20)
|
||||
#define PORT_LOCAL_CLOSED (PORT_ERR_BASE + 21)
|
||||
#define PORT_LOCAL_TIMEOUT (PORT_ERR_BASE + 22)
|
||||
#define PORT_TX_QUEUE_DISABLED (PORT_ERR_BASE + 23)
|
||||
#define PORT_PAGE_TIMEOUT (PORT_ERR_BASE + 24)
|
||||
#define PORT_INVALID_SCN (PORT_ERR_BASE + 25)
|
||||
|
||||
#define PORT_ERR_MAX (PORT_ERR_BASE + 26)
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_CreateConnection
|
||||
**
|
||||
** Description RFCOMM_CreateConnection function is used from the application
|
||||
** to establish serial port connection to the peer device,
|
||||
** or allow RFCOMM to accept a connection from the peer
|
||||
** application.
|
||||
**
|
||||
** Parameters: scn - Service Channel Number as registered with
|
||||
** the SDP (server) or obtained using SDP from
|
||||
** the peer device (client).
|
||||
** is_server - TRUE if requesting application is a server
|
||||
** mtu - Maximum frame size the application can accept
|
||||
** bd_addr - BD_ADDR of the peer (client)
|
||||
** mask - specifies events to be enabled. A value
|
||||
** of zero disables all events.
|
||||
** p_handle - OUT pointer to the handle.
|
||||
** p_mgmt_cb - pointer to callback function to receive
|
||||
** connection up/down events.
|
||||
** Notes:
|
||||
**
|
||||
** Server can call this function with the same scn parameter multiple times if
|
||||
** it is ready to accept multiple simulteneous connections.
|
||||
**
|
||||
** DLCI for the connection is (scn * 2 + 1) if client originates connection on
|
||||
** existing none initiator multiplexer channel. Otherwise it is (scn * 2).
|
||||
** For the server DLCI can be changed later if client will be calling it using
|
||||
** (scn * 2 + 1) dlci.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int RFCOMM_CreateConnection (UINT16 uuid, UINT8 scn,
|
||||
BOOLEAN is_server, UINT16 mtu,
|
||||
BD_ADDR bd_addr, UINT16 *p_handle,
|
||||
tPORT_CALLBACK *p_mgmt_cb);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_RemoveConnection
|
||||
**
|
||||
** Description This function is called to close the specified connection.
|
||||
**
|
||||
** Parameters: handle - Handle of the port returned in the Open
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int RFCOMM_RemoveConnection (UINT16 handle);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_RemoveServer
|
||||
**
|
||||
** Description This function is called to close the server port.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int RFCOMM_RemoveServer (UINT16 handle);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetEventCallback
|
||||
**
|
||||
** Description Set event callback the specified connection.
|
||||
**
|
||||
** Parameters: handle - Handle of the port returned in the Open
|
||||
** p_callback - address of the callback function which should
|
||||
** be called from the RFCOMM when an event
|
||||
** specified in the mask occurs.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_SetEventCallback (UINT16 port_handle,
|
||||
tPORT_CALLBACK *p_port_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_ClearKeepHandleFlag
|
||||
**
|
||||
** Description This function is called to clear the keep handle flag
|
||||
** which will cause not to keep the port handle open when closed
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
**
|
||||
*******************************************************************************/
|
||||
int PORT_ClearKeepHandleFlag (UINT16 port_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetEventCallback
|
||||
**
|
||||
** Description Set event data callback the specified connection.
|
||||
**
|
||||
** Parameters: handle - Handle of the port returned in the Open
|
||||
** p_callback - address of the callback function which should
|
||||
** be called from the RFCOMM when a data
|
||||
** packet is received.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_SetDataCallback (UINT16 port_handle,
|
||||
tPORT_DATA_CALLBACK *p_cb);
|
||||
|
||||
extern int PORT_SetDataCOCallback (UINT16 port_handle, tPORT_DATA_CO_CALLBACK *p_port_cb);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetEventMask
|
||||
**
|
||||
** Description This function is called to close the specified connection.
|
||||
**
|
||||
** Parameters: handle - Handle of the port returned in the Open
|
||||
** mask - specifies events to be enabled. A value
|
||||
** of zero disables all events.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_SetEventMask (UINT16 port_handle, UINT32 mask);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_CheckConnection
|
||||
**
|
||||
** Description This function returns PORT_SUCCESS if connection referenced
|
||||
** by handle is up and running
|
||||
**
|
||||
** Parameters: handle - Handle of the port returned in the Open
|
||||
** bd_addr - OUT bd_addr of the peer
|
||||
** p_lcid - OUT L2CAP's LCID
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr,
|
||||
UINT16 *p_lcid);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_IsOpening
|
||||
**
|
||||
** Description This function returns TRUE if there is any RFCOMM connection
|
||||
** opening in process.
|
||||
**
|
||||
** Parameters: TRUE if any connection opening is found
|
||||
** bd_addr - bd_addr of the peer
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN PORT_IsOpening (BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetState
|
||||
**
|
||||
** Description This function configures connection according to the
|
||||
** specifications in the tPORT_STATE structure.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_settings - Pointer to a tPORT_STATE structure containing
|
||||
** configuration information for the connection.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_SetState (UINT16 handle, tPORT_STATE *p_settings);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_GetRxQueueCnt
|
||||
**
|
||||
** Description This function return number of buffers on the rx queue.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_rx_queue_count - Pointer to return queue count in.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_GetRxQueueCnt (UINT16 handle, UINT16 *p_rx_queue_count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_GetState
|
||||
**
|
||||
** Description This function is called to fill tPORT_STATE structure
|
||||
** with the current control settings for the port
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_settings - Pointer to a tPORT_STATE structure in which
|
||||
** configuration information is returned.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_GetState (UINT16 handle, tPORT_STATE *p_settings);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_Control
|
||||
**
|
||||
** Description This function directs a specified connection to pass control
|
||||
** control information to the peer device.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** signal - specify the function to be passed
|
||||
**
|
||||
*******************************************************************************/
|
||||
#define PORT_SET_DTRDSR 0x01
|
||||
#define PORT_CLR_DTRDSR 0x02
|
||||
#define PORT_SET_CTSRTS 0x03
|
||||
#define PORT_CLR_CTSRTS 0x04
|
||||
#define PORT_SET_RI 0x05 /* DCE only */
|
||||
#define PORT_CLR_RI 0x06 /* DCE only */
|
||||
#define PORT_SET_DCD 0x07 /* DCE only */
|
||||
#define PORT_CLR_DCD 0x08 /* DCE only */
|
||||
#define PORT_BREAK 0x09 /* Break event */
|
||||
|
||||
extern int PORT_Control (UINT16 handle, UINT8 signal);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_FlowControl
|
||||
**
|
||||
** Description This function directs a specified connection to pass
|
||||
** flow control message to the peer device. Enable flag passed
|
||||
** shows if port can accept more data.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** enable - enables data flow
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_FlowControl (UINT16 handle, BOOLEAN enable);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_GetModemStatus
|
||||
**
|
||||
** Description This function retrieves modem control signals. Normally
|
||||
** application will call this function after a callback
|
||||
** function is called with notification that one of signals
|
||||
** has been changed.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** callback.
|
||||
** p_signal - specify the pointer to control signals info
|
||||
**
|
||||
*******************************************************************************/
|
||||
#define PORT_DTRDSR_ON 0x01
|
||||
#define PORT_CTSRTS_ON 0x02
|
||||
#define PORT_RING_ON 0x04
|
||||
#define PORT_DCD_ON 0x08
|
||||
|
||||
/*
|
||||
** Define default initial local modem signals state set after connection established
|
||||
*/
|
||||
#define PORT_OBEX_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
|
||||
#define PORT_SPP_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
|
||||
#define PORT_PPP_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON)
|
||||
#define PORT_DUN_DEFAULT_SIGNAL_STATE (PORT_DTRDSR_ON | PORT_CTSRTS_ON)
|
||||
|
||||
extern int PORT_GetModemStatus (UINT16 handle, UINT8 *p_control_signal);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_ClearError
|
||||
**
|
||||
** Description This function retreives information about a communications
|
||||
** error and reports current status of a connection. The
|
||||
** function should be called when an error occures to clear
|
||||
** the connection error flag and to enable additional read
|
||||
** and write operations.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_errors - pointer of the variable to receive error codes
|
||||
** p_status - pointer to the tPORT_STATUS structur to receive
|
||||
** connection status
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
#define PORT_ERR_BREAK 0x01 /* Break condition occured on the peer device */
|
||||
#define PORT_ERR_OVERRUN 0x02 /* Overrun is reported by peer device */
|
||||
#define PORT_ERR_FRAME 0x04 /* Framing error reported by peer device */
|
||||
#define PORT_ERR_RXOVER 0x08 /* Input queue overflow occured */
|
||||
#define PORT_ERR_TXFULL 0x10 /* Output queue overflow occured */
|
||||
|
||||
typedef struct {
|
||||
#define PORT_FLAG_CTS_HOLD 0x01 /* Tx is waiting for CTS signal */
|
||||
#define PORT_FLAG_DSR_HOLD 0x02 /* Tx is waiting for DSR signal */
|
||||
#define PORT_FLAG_RLSD_HOLD 0x04 /* Tx is waiting for RLSD signal */
|
||||
|
||||
UINT16 flags;
|
||||
UINT16 in_queue_size; /* Number of bytes in the input queue */
|
||||
UINT16 out_queue_size; /* Number of bytes in the output queue */
|
||||
UINT16 mtu_size; /* peer MTU size */
|
||||
} tPORT_STATUS;
|
||||
|
||||
|
||||
extern int PORT_ClearError (UINT16 handle, UINT16 *p_errors,
|
||||
tPORT_STATUS *p_status);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SendError
|
||||
**
|
||||
** Description This function send a communications error to the peer device
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** errors - receive error codes
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_SendError (UINT16 handle, UINT8 errors);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_GetQueueStatus
|
||||
**
|
||||
** Description This function reports current status of a connection.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_status - pointer to the tPORT_STATUS structur to receive
|
||||
** connection status
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_GetQueueStatus (UINT16 handle, tPORT_STATUS *p_status);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_Purge
|
||||
**
|
||||
** Description This function discards all the data from the output or
|
||||
** input queues of the specified connection.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** purge_flags - specify the action to take.
|
||||
**
|
||||
*******************************************************************************/
|
||||
#define PORT_PURGE_TXCLEAR 0x01
|
||||
#define PORT_PURGE_RXCLEAR 0x02
|
||||
|
||||
extern int PORT_Purge (UINT16 handle, UINT8 purge_flags);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_Read
|
||||
**
|
||||
** Description This function returns the pointer to the buffer received
|
||||
** from the peer device. Normally application will call this
|
||||
** function after receiving PORT_EVT_RXCHAR event.
|
||||
** Application calling this function is responsible to free
|
||||
** buffer returned.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** callback.
|
||||
** pp_buf - pointer to address of buffer with data,
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_Read (UINT16 handle, BT_HDR **pp_buf);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_ReadData
|
||||
**
|
||||
** Description Normally application will call this function after receiving
|
||||
** PORT_EVT_RXCHAR event.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** callback.
|
||||
** p_data - Data area
|
||||
** max_len - Byte count requested
|
||||
** p_len - Byte count received
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_ReadData (UINT16 handle, char *p_data, UINT16 max_len,
|
||||
UINT16 *p_len);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_Write
|
||||
**
|
||||
** Description This function to send BT buffer to the peer device.
|
||||
** Application should not free the buffer.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_buf - pointer to the buffer with data,
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_Write (UINT16 handle, BT_HDR *p_buf);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_WriteData
|
||||
**
|
||||
** Description This function is called from the legacy application to
|
||||
** send data.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_data - Data area
|
||||
** max_len - Byte count to write
|
||||
** p_len - Bytes written
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_WriteData (UINT16 handle, char *p_data, UINT16 max_len,
|
||||
UINT16 *p_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_WriteDataCO
|
||||
**
|
||||
** Description Normally not GKI aware application will call this function
|
||||
** to send data to the port by callout functions.
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_WriteDataCO (UINT16 handle, int *p_len, int len, UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_Test
|
||||
**
|
||||
** Description Application can call this function to send RFCOMM Test frame
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** p_data - Data area
|
||||
** max_len - Byte count requested
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern int PORT_Test (UINT16 handle, UINT8 *p_data, UINT16 len);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_Init
|
||||
**
|
||||
** Description This function is called to initialize RFCOMM layer
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void RFCOMM_Init (void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetTraceLevel
|
||||
**
|
||||
** Description This function sets the trace level for RFCOMM. If called with
|
||||
** a value of 0xFF, it simply reads the current trace level.
|
||||
**
|
||||
** Returns the new (current) trace level
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 PORT_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_GetResultString
|
||||
**
|
||||
** Description This function returns the human-readable string for a given
|
||||
** result code.
|
||||
**
|
||||
** Returns a pointer to the human-readable string for the given
|
||||
** result. Note that the string returned must not be freed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern const char *PORT_GetResultString (const uint8_t result_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PORT_API_H */
|
31
tools/sdk/include/bluedroid/stack/port_ext.h
Normal file
31
tools/sdk/include/bluedroid/stack/port_ext.h
Normal file
@ -0,0 +1,31 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains external definitions of Port Emulation entity unit
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef PORTEXT_H
|
||||
#define PORTEXT_H
|
||||
|
||||
|
||||
/* Port emulation entity Entry Points */
|
||||
extern void rfcomm_process_timeout (TIMER_LIST_ENT *p_tle);
|
||||
#endif
|
70
tools/sdk/include/bluedroid/stack/profiles_api.h
Normal file
70
tools/sdk/include/bluedroid/stack/profiles_api.h
Normal file
@ -0,0 +1,70 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef PROFILES_API_H
|
||||
#define PROFILES_API_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/btm_api.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
#define BT_PASS 0 /* Used for general successful function returns */
|
||||
|
||||
/*** Port entity passes back 8 bit errors; will use upper byte offset ***/
|
||||
#define PORT_ERR_GRP 0x0000 /* base offset for port entity */
|
||||
#define GAP_ERR_GRP 0x0100 /* base offset for GAP profile */
|
||||
#define SPP_ERR_GRP 0x0200 /* base offset for serial port profile */
|
||||
#define HCRP_ERR_GRP 0x0300 /* base offset for HCRP */
|
||||
#define HCRPM_ERR_GRP 0x0400 /* base offset for HCRPM */
|
||||
|
||||
/* #define HSP2_ERR_GRP 0x0F00 */
|
||||
|
||||
/* security level definitions (tBT_SECURITY) */
|
||||
#define BT_USE_DEF_SECURITY 0
|
||||
#define BT_SEC_MODE_NONE BTM_SEC_MODE_NONE
|
||||
#define BT_SEC_MODE_SERVICE BTM_SEC_MODE_SERVICE
|
||||
#define BT_SEC_MODE_LINK BTM_SEC_MODE_LINK
|
||||
|
||||
/* security mask definitions (tBT_SECURITY) */
|
||||
/* The following definitions are OR'd together to form the security requirements */
|
||||
#define BT_SEC_IN_AUTHORIZE BTM_SEC_IN_AUTHORIZE /* Inbound call requires authorization */
|
||||
#define BT_SEC_IN_AUTHENTICATE BTM_SEC_IN_AUTHENTICATE /* Inbound call requires authentication */
|
||||
#define BT_SEC_IN_ENCRYPT BTM_SEC_IN_ENCRYPT /* Inbound call requires encryption */
|
||||
#define BT_SEC_OUT_AUTHORIZE BTM_SEC_OUT_AUTHORIZE /* Outbound call requires authorization */
|
||||
#define BT_SEC_OUT_AUTHENTICATE BTM_SEC_OUT_AUTHENTICATE /* Outbound call requires authentication */
|
||||
#define BT_SEC_OUT_ENCRYPT BTM_SEC_OUT_ENCRYPT /* Outbound call requires encryption */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
** Security Definitions
|
||||
** This following definitions are used to indicate the security
|
||||
** requirements for a service.
|
||||
*/
|
||||
typedef struct {
|
||||
UINT8 level;
|
||||
UINT8 mask;
|
||||
} tBT_SECURITY;
|
||||
|
||||
#endif /* PROFILES_API_H */
|
||||
|
248
tools/sdk/include/bluedroid/stack/rfcdefs.h
Normal file
248
tools/sdk/include/bluedroid/stack/rfcdefs.h
Normal file
@ -0,0 +1,248 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains definitions for the RFCOMM protocol
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef RFCDEFS_H
|
||||
#define RFCDEFS_H
|
||||
|
||||
#define PORT_MAX_RFC_PORTS 31
|
||||
|
||||
/*
|
||||
** If nothing is negotiated MTU should be 127
|
||||
*/
|
||||
#define RFCOMM_DEFAULT_MTU 127
|
||||
|
||||
/*
|
||||
** Define used by RFCOMM TS frame types
|
||||
*/
|
||||
#define RFCOMM_SABME 0x2F
|
||||
#define RFCOMM_UA 0x63
|
||||
#define RFCOMM_DM 0x0F
|
||||
#define RFCOMM_DISC 0x43
|
||||
#define RFCOMM_UIH 0xEF
|
||||
|
||||
/*
|
||||
** Defenitions for the TS control frames
|
||||
*/
|
||||
#define RFCOMM_CTRL_FRAME_LEN 3
|
||||
#define RFCOMM_MIN_OFFSET 5 /* ctrl 2 , len 1 or 2 bytes, credit 1 byte */
|
||||
#define RFCOMM_DATA_OVERHEAD (RFCOMM_MIN_OFFSET + 1) /* add 1 for checksum */
|
||||
|
||||
#define RFCOMM_EA 1
|
||||
#define RFCOMM_EA_MASK 0x01
|
||||
#define RFCOMM_CR_MASK 0x02
|
||||
#define RFCOMM_SHIFT_CR 1
|
||||
#define RFCOMM_SHIFT_DLCI 2
|
||||
#define RFCOMM_SHIFT_DLCI2 6
|
||||
#define RFCOMM_PF 0x10
|
||||
#define RFCOMM_PF_MASK 0x10
|
||||
#define RFCOMM_PF_OFFSET 4
|
||||
#define RFCOMM_SHIFT_LENGTH1 1
|
||||
#define RFCOMM_SHIFT_LENGTH2 7
|
||||
#define RFCOMM_SHIFT_MX_CTRL_TYPE 2
|
||||
|
||||
#define RFCOMM_INITIATOR_CMD 1
|
||||
#define RFCOMM_INITIATOR_RSP 0
|
||||
#define RFCOMM_RESPONDER_CMD 0
|
||||
#define RFCOMM_RESPONDER_RSP 1
|
||||
|
||||
#define RFCOMM_PARSE_CTRL_FIELD(ea, cr, dlci, p_data) \
|
||||
{ \
|
||||
ea = *p_data & RFCOMM_EA; \
|
||||
cr = (*p_data & RFCOMM_CR_MASK) >> RFCOMM_SHIFT_CR; \
|
||||
dlci = *p_data++ >> RFCOMM_SHIFT_DLCI; \
|
||||
if (!ea) dlci += *p_data++ << RFCOMM_SHIFT_DLCI2; \
|
||||
}
|
||||
|
||||
#define RFCOMM_FORMAT_CTRL_FIELD(p_data, ea, cr, dlci) \
|
||||
*p_data++ = ea | cr | (dlci << RFCOMM_SHIFT_DLCI)
|
||||
|
||||
#define RFCOMM_PARSE_TYPE_FIELD(type, pf, p_data) \
|
||||
{ \
|
||||
type = *p_data & ~RFCOMM_PF_MASK; \
|
||||
pf = (*p_data++ & RFCOMM_PF_MASK) >> RFCOMM_PF_OFFSET;\
|
||||
}
|
||||
|
||||
#define RFCOMM_FORMAT_TYPE_FIELD(p_data, type, pf) \
|
||||
*p_data++ = (type | (pf << RFCOMM_PF_OFFSET)) \
|
||||
{ \
|
||||
type = *p_data & ~RFCOMM_PF_MASK; \
|
||||
pf = (*p_data++ & RFCOMM_PF_MASK) >> RFCOMM_PF_OFFSET;\
|
||||
}
|
||||
|
||||
#define RFCOMM_PARSE_LEN_FIELD(ea, length, p_data) \
|
||||
{ \
|
||||
ea = (*p_data & RFCOMM_EA); \
|
||||
length = (*p_data++ >> RFCOMM_SHIFT_LENGTH1); \
|
||||
if (!ea) length += (*p_data++ << RFCOMM_SHIFT_LENGTH2); \
|
||||
}
|
||||
|
||||
#define RFCOMM_FRAME_IS_CMD(initiator, cr) \
|
||||
(( (initiator) && !(cr)) || (!(initiator) && (cr)))
|
||||
|
||||
#define RFCOMM_FRAME_IS_RSP(initiator, cr) \
|
||||
(( (initiator) && (cr)) || (!(initiator) && !(cr)))
|
||||
|
||||
#define RFCOMM_CR(initiator, is_command) \
|
||||
(( ( (initiator) && (is_command)) \
|
||||
|| (!(initiator) && !(is_command))) << 1)
|
||||
|
||||
#define RFCOMM_I_CR(is_command) ((is_command) ? 0x02 : 0x00)
|
||||
|
||||
#define RFCOMM_MAX_DLCI 61
|
||||
|
||||
#define RFCOMM_VALID_DLCI(dlci) \
|
||||
(((dlci) == 0) || (((dlci) >= 2) && ((dlci) <= RFCOMM_MAX_DLCI)))
|
||||
|
||||
|
||||
/* Port Negotiation (PN) */
|
||||
#define RFCOMM_PN_DLCI_MASK 0x3F
|
||||
|
||||
#define RFCOMM_PN_FRAM_TYPE_UIH 0x00
|
||||
#define RFCOMM_PN_FRAME_TYPE_MASK 0x0F
|
||||
|
||||
#define RFCOMM_PN_CONV_LAYER_MASK 0xF0
|
||||
#define RFCOMM_PN_CONV_LAYER_TYPE_1 0
|
||||
#define RFCOMM_PN_CONV_LAYER_CBFC_I 0xF0
|
||||
#define RFCOMM_PN_CONV_LAYER_CBFC_R 0xE0
|
||||
|
||||
#define RFCOMM_PN_PRIORITY_MASK 0x3F
|
||||
#define RFCOMM_PN_PRIORITY_0 0
|
||||
|
||||
#define RFCOMM_PN_K_MASK 0x07
|
||||
|
||||
#define RFCOMM_T1_DSEC 0 /* None negotiable in RFCOMM */
|
||||
#define RFCOMM_N2 0 /* Number of retransmissions */
|
||||
#define RFCOMM_K 0 /* Window size */
|
||||
#define RFCOMM_K_MAX 7 /* Max value of K for credit based flow control */
|
||||
|
||||
#define RFCOMM_MSC_FC 0x02 /* Flow control*/
|
||||
#define RFCOMM_MSC_RTC 0x04 /* Ready to communicate*/
|
||||
#define RFCOMM_MSC_RTR 0x08 /* Ready to receive*/
|
||||
#define RFCOMM_MSC_IC 0x40 /* Incomming call indicator*/
|
||||
#define RFCOMM_MSC_DV 0x80 /* Data Valid*/
|
||||
|
||||
#define RFCOMM_MSC_SHIFT_BREAK 4
|
||||
#define RFCOMM_MSC_BREAK_MASK 0xF0
|
||||
#define RFCOMM_MSC_BREAK_PRESENT_MASK 0x02
|
||||
|
||||
#define RFCOMM_BAUD_RATE_2400 0x00
|
||||
#define RFCOMM_BAUD_RATE_4800 0x01
|
||||
#define RFCOMM_BAUD_RATE_7200 0x02
|
||||
#define RFCOMM_BAUD_RATE_9600 0x03
|
||||
#define RFCOMM_BAUD_RATE_19200 0x04
|
||||
#define RFCOMM_BAUD_RATE_38400 0x05
|
||||
#define RFCOMM_BAUD_RATE_57600 0x06
|
||||
#define RFCOMM_BAUD_RATE_115200 0x07
|
||||
#define RFCOMM_BAUD_RATE_230400 0x08
|
||||
|
||||
#define RFCOMM_5_BITS 0x00
|
||||
#define RFCOMM_6_BITS 0x01
|
||||
#define RFCOMM_7_BITS 0x02
|
||||
#define RFCOMM_8_BITS 0x03
|
||||
|
||||
#define RFCOMM_RPN_BITS_MASK 0x03
|
||||
#define RFCOMM_RPN_BITS_SHIFT 0
|
||||
|
||||
#define RFCOMM_ONESTOPBIT 0x00
|
||||
#define RFCOMM_ONE5STOPBITS 0x01
|
||||
|
||||
#define RFCOMM_RPN_STOP_BITS_MASK 0x01
|
||||
#define RFCOMM_RPN_STOP_BITS_SHIFT 2
|
||||
|
||||
#define RFCOMM_PARITY_NO 0x00
|
||||
#define RFCOMM_PARITY_YES 0x01
|
||||
#define RFCOMM_RPN_PARITY_MASK 0x01
|
||||
#define RFCOMM_RPN_PARITY_SHIFT 3
|
||||
|
||||
#define RFCOMM_ODD_PARITY 0x00
|
||||
#define RFCOMM_EVEN_PARITY 0x01
|
||||
#define RFCOMM_MARK_PARITY 0x02
|
||||
#define RFCOMM_SPACE_PARITY 0x03
|
||||
|
||||
#define RFCOMM_RPN_PARITY_TYPE_MASK 0x03
|
||||
#define RFCOMM_RPN_PARITY_TYPE_SHIFT 4
|
||||
|
||||
#define RFCOMM_FC_OFF 0x00
|
||||
#define RFCOMM_FC_XONXOFF_ON_INPUT 0x01
|
||||
#define RFCOMM_FC_XONXOFF_ON_OUTPUT 0x02
|
||||
#define RFCOMM_FC_RTR_ON_INPUT 0x04
|
||||
#define RFCOMM_FC_RTR_ON_OUTPUT 0x08
|
||||
#define RFCOMM_FC_RTC_ON_INPUT 0x10
|
||||
#define RFCOMM_FC_RTC_ON_OUTPUT 0x20
|
||||
#define RFCOMM_FC_MASK 0x3F
|
||||
|
||||
#define RFCOMM_RPN_PM_BIT_RATE 0x0001
|
||||
#define RFCOMM_RPN_PM_DATA_BITS 0x0002
|
||||
#define RFCOMM_RPN_PM_STOP_BITS 0x0004
|
||||
#define RFCOMM_RPN_PM_PARITY 0x0008
|
||||
#define RFCOMM_RPN_PM_PARITY_TYPE 0x0010
|
||||
#define RFCOMM_RPN_PM_XON_CHAR 0x0020
|
||||
#define RFCOMM_RPN_PM_XOFF_CHAR 0x0040
|
||||
#define RFCOMM_RPN_PM_XONXOFF_ON_INPUT 0x0100
|
||||
#define RFCOMM_RPN_PM_XONXOFF_ON_OUTPUT 0x0200
|
||||
#define RFCOMM_RPN_PM_RTR_ON_INPUT 0x0400
|
||||
#define RFCOMM_RPN_PM_RTR_ON_OUTPUT 0x0800
|
||||
#define RFCOMM_RPN_PM_RTC_ON_INPUT 0x1000
|
||||
#define RFCOMM_RPN_PM_RTC_ON_OUTPUT 0x2000
|
||||
#define RFCOMM_RPN_PM_MASK 0x3F7F
|
||||
|
||||
#define RFCOMM_RLS_ERROR 0x01
|
||||
#define RFCOMM_RLS_OVERRUN 0x02
|
||||
#define RFCOMM_RLS_PARITY 0x04
|
||||
#define RFCOMM_RLS_FRAMING 0x08
|
||||
|
||||
/* Multiplexor channel uses DLCI 0 */
|
||||
#define RFCOMM_MX_DLCI 0
|
||||
|
||||
/*
|
||||
** Define RFCOMM Multiplexer message types
|
||||
*/
|
||||
#define RFCOMM_MX_PN 0x80
|
||||
#define RFCOMM_MX_PN_LEN 8
|
||||
|
||||
#define RFCOMM_MX_CLD 0xC0
|
||||
#define RFCOMM_MX_CLD_LEN 0
|
||||
|
||||
#define RFCOMM_MX_TEST 0x20
|
||||
|
||||
#define RFCOMM_MX_FCON 0xA0
|
||||
#define RFCOMM_MX_FCON_LEN 0
|
||||
|
||||
#define RFCOMM_MX_FCOFF 0x60
|
||||
#define RFCOMM_MX_FCOFF_LEN 0
|
||||
|
||||
#define RFCOMM_MX_MSC 0xE0
|
||||
#define RFCOMM_MX_MSC_LEN_NO_BREAK 2
|
||||
#define RFCOMM_MX_MSC_LEN_WITH_BREAK 3
|
||||
|
||||
#define RFCOMM_MX_NSC 0x10
|
||||
#define RFCOMM_MX_NSC_LEN 1
|
||||
|
||||
#define RFCOMM_MX_RPN 0x90
|
||||
#define RFCOMM_MX_RPN_REQ_LEN 1
|
||||
#define RFCOMM_MX_RPN_LEN 8
|
||||
|
||||
#define RFCOMM_MX_RLS 0x50
|
||||
#define RFCOMM_MX_RLS_LEN 2
|
||||
#endif
|
726
tools/sdk/include/bluedroid/stack/sdp_api.h
Normal file
726
tools/sdk/include/bluedroid/stack/sdp_api.h
Normal file
@ -0,0 +1,726 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 SDP_API_H
|
||||
#define SDP_API_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/sdpdefs.h"
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
/* Success code and error codes */
|
||||
#define SDP_SUCCESS 0x0000
|
||||
#define SDP_INVALID_VERSION 0x0001
|
||||
#define SDP_INVALID_SERV_REC_HDL 0x0002
|
||||
#define SDP_INVALID_REQ_SYNTAX 0x0003
|
||||
#define SDP_INVALID_PDU_SIZE 0x0004
|
||||
#define SDP_INVALID_CONT_STATE 0x0005
|
||||
#define SDP_NO_RESOURCES 0x0006
|
||||
#define SDP_DI_REG_FAILED 0x0007
|
||||
#define SDP_DI_DISC_FAILED 0x0008
|
||||
#define SDP_NO_DI_RECORD_FOUND 0x0009
|
||||
#define SDP_ERR_ATTR_NOT_PRESENT 0x000A
|
||||
#define SDP_ILLEGAL_PARAMETER 0x000B
|
||||
|
||||
#define SDP_NO_RECS_MATCH 0xFFF0
|
||||
#define SDP_CONN_FAILED 0xFFF1
|
||||
#define SDP_CFG_FAILED 0xFFF2
|
||||
#define SDP_GENERIC_ERROR 0xFFF3
|
||||
#define SDP_DB_FULL 0xFFF4
|
||||
#define SDP_INVALID_PDU 0xFFF5
|
||||
#define SDP_SECURITY_ERR 0xFFF6
|
||||
#define SDP_CONN_REJECTED 0xFFF7
|
||||
#define SDP_CANCEL 0xFFF8
|
||||
|
||||
/* Define the PSM that SDP uses */
|
||||
#define SDP_PSM 0x0001
|
||||
|
||||
/* Legacy #define to avoid code changes - SDP UUID is same as BT UUID */
|
||||
#define tSDP_UUID tBT_UUID
|
||||
|
||||
/* Masks for attr_value field of tSDP_DISC_ATTR */
|
||||
#define SDP_DISC_ATTR_LEN_MASK 0x0FFF
|
||||
#define SDP_DISC_ATTR_TYPE(len_type) (len_type >> 12)
|
||||
#define SDP_DISC_ATTR_LEN(len_type) (len_type & SDP_DISC_ATTR_LEN_MASK)
|
||||
|
||||
/* Maximum number of protocol list items (list_elem in tSDP_PROTOCOL_ELEM) */
|
||||
#define SDP_MAX_LIST_ELEMS 3
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Type Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
/* Define a callback function for when discovery is complete. */
|
||||
typedef void (tSDP_DISC_CMPL_CB) (UINT16 result);
|
||||
typedef void (tSDP_DISC_CMPL_CB2) (UINT16 result, void *user_data);
|
||||
|
||||
typedef struct {
|
||||
BD_ADDR peer_addr;
|
||||
UINT16 peer_mtu;
|
||||
} tSDP_DR_OPEN;
|
||||
|
||||
typedef struct {
|
||||
UINT8 *p_data;
|
||||
UINT16 data_len;
|
||||
} tSDP_DR_DATA;
|
||||
|
||||
typedef union {
|
||||
tSDP_DR_OPEN open;
|
||||
tSDP_DR_DATA data;
|
||||
} tSDP_DATA;
|
||||
|
||||
/* Define a callback function for when discovery result is received. */
|
||||
typedef void (tSDP_DISC_RES_CB) (UINT16 event, tSDP_DATA *p_data);
|
||||
|
||||
/* Define a structure to hold the discovered service information. */
|
||||
typedef struct {
|
||||
union {
|
||||
UINT8 u8; /* 8-bit integer */
|
||||
UINT16 u16; /* 16-bit integer */
|
||||
UINT32 u32; /* 32-bit integer */
|
||||
UINT8 array[4]; /* Variable length field */
|
||||
struct t_sdp_disc_attr *p_sub_attr; /* Addr of first sub-attr (list)*/
|
||||
} v;
|
||||
|
||||
} tSDP_DISC_ATVAL;
|
||||
|
||||
typedef struct t_sdp_disc_attr {
|
||||
struct t_sdp_disc_attr *p_next_attr; /* Addr of next linked attr */
|
||||
UINT16 attr_id; /* Attribute ID */
|
||||
UINT16 attr_len_type; /* Length and type fields */
|
||||
tSDP_DISC_ATVAL attr_value; /* Variable length entry data */
|
||||
} tSDP_DISC_ATTR;
|
||||
|
||||
typedef struct t_sdp_disc_rec {
|
||||
tSDP_DISC_ATTR *p_first_attr; /* First attribute of record */
|
||||
struct t_sdp_disc_rec *p_next_rec; /* Addr of next linked record */
|
||||
UINT32 time_read; /* The time the record was read */
|
||||
BD_ADDR remote_bd_addr; /* Remote BD address */
|
||||
} tSDP_DISC_REC;
|
||||
|
||||
typedef struct {
|
||||
UINT32 mem_size; /* Memory size of the DB */
|
||||
UINT32 mem_free; /* Memory still available */
|
||||
tSDP_DISC_REC *p_first_rec; /* Addr of first record in DB */
|
||||
UINT16 num_uuid_filters; /* Number of UUIds to filter */
|
||||
tSDP_UUID uuid_filters[SDP_MAX_UUID_FILTERS]; /* UUIDs to filter */
|
||||
UINT16 num_attr_filters; /* Number of attribute filters */
|
||||
UINT16 attr_filters[SDP_MAX_ATTR_FILTERS]; /* Attributes to filter */
|
||||
UINT8 *p_free_mem; /* Pointer to free memory */
|
||||
#if (SDP_RAW_DATA_INCLUDED == TRUE)
|
||||
UINT8 *raw_data; /* Received record from server. allocated/released by client */
|
||||
UINT32 raw_size; /* size of raw_data */
|
||||
UINT32 raw_used; /* length of raw_data used */
|
||||
#endif
|
||||
} tSDP_DISCOVERY_DB;
|
||||
|
||||
/* This structure is used to add protocol lists and find protocol elements */
|
||||
typedef struct {
|
||||
UINT16 protocol_uuid;
|
||||
UINT16 num_params;
|
||||
UINT16 params[SDP_MAX_PROTOCOL_PARAMS];
|
||||
} tSDP_PROTOCOL_ELEM;
|
||||
|
||||
typedef struct {
|
||||
UINT16 num_elems;
|
||||
tSDP_PROTOCOL_ELEM list_elem[SDP_MAX_LIST_ELEMS];
|
||||
} tSDP_PROTO_LIST_ELEM;
|
||||
|
||||
/* Device Identification (DI) data structure
|
||||
*/
|
||||
/* Used to set the DI record */
|
||||
typedef struct t_sdp_di_record {
|
||||
UINT16 vendor;
|
||||
UINT16 vendor_id_source;
|
||||
UINT16 product;
|
||||
UINT16 version;
|
||||
BOOLEAN primary_record;
|
||||
char client_executable_url[SDP_MAX_ATTR_LEN]; /* optional */
|
||||
char service_description[SDP_MAX_ATTR_LEN]; /* optional */
|
||||
char documentation_url[SDP_MAX_ATTR_LEN]; /* optional */
|
||||
} tSDP_DI_RECORD;
|
||||
|
||||
/* Used to get the DI record */
|
||||
typedef struct t_sdp_di_get_record {
|
||||
UINT16 spec_id;
|
||||
tSDP_DI_RECORD rec;
|
||||
} tSDP_DI_GET_RECORD;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* API into the SDP layer for service discovery. */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_InitDiscoveryDb
|
||||
**
|
||||
** Description This function is called to initialize a discovery database.
|
||||
**
|
||||
** Returns TRUE if successful, FALSE if one or more parameters are bad
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, UINT32 len,
|
||||
UINT16 num_uuid,
|
||||
tSDP_UUID *p_uuid_list,
|
||||
UINT16 num_attr,
|
||||
UINT16 *p_attr_list);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_CancelServiceSearch
|
||||
**
|
||||
** Description This function cancels an active query to an SDP server.
|
||||
**
|
||||
** Returns TRUE if discovery cancelled, FALSE if a matching activity is not found.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ServiceSearchRequest
|
||||
**
|
||||
** Description This function queries an SDP server for information.
|
||||
**
|
||||
** Returns TRUE if discovery started, FALSE if failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_ServiceSearchRequest (UINT8 *p_bd_addr,
|
||||
tSDP_DISCOVERY_DB *p_db,
|
||||
tSDP_DISC_CMPL_CB *p_cb);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ServiceSearchAttributeRequest
|
||||
**
|
||||
** Description This function queries an SDP server for information.
|
||||
**
|
||||
** The difference between this API function and the function
|
||||
** SDP_ServiceSearchRequest is that this one does a
|
||||
** combined ServiceSearchAttributeRequest SDP function.
|
||||
**
|
||||
** Returns TRUE if discovery started, FALSE if failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_ServiceSearchAttributeRequest (UINT8 *p_bd_addr,
|
||||
tSDP_DISCOVERY_DB *p_db,
|
||||
tSDP_DISC_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ServiceSearchAttributeRequest2
|
||||
**
|
||||
** Description This function queries an SDP server for information.
|
||||
**
|
||||
** The difference between this API function and the function
|
||||
** SDP_ServiceSearchRequest is that this one does a
|
||||
** combined ServiceSearchAttributeRequest SDP function with the
|
||||
** user data piggyback
|
||||
**
|
||||
** Returns TRUE if discovery started, FALSE if failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_ServiceSearchAttributeRequest2 (UINT8 *p_bd_addr,
|
||||
tSDP_DISCOVERY_DB *p_db,
|
||||
tSDP_DISC_CMPL_CB2 *p_cb, void *user_data);
|
||||
|
||||
/* API of utilities to find data in the local discovery database */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindAttributeInDb
|
||||
**
|
||||
** Description This function queries an SDP database for a specific attribute.
|
||||
** If the p_start_rec pointer is NULL, it looks from the beginning
|
||||
** of the database, else it continues from the next record after
|
||||
** p_start_rec.
|
||||
**
|
||||
** Returns Pointer to matching record, or NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSDP_DISC_REC *SDP_FindAttributeInDb (tSDP_DISCOVERY_DB *p_db,
|
||||
UINT16 attr_id,
|
||||
tSDP_DISC_REC *p_start_rec);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindAttributeInRec
|
||||
**
|
||||
** Description This function searches an SDP discovery record for a
|
||||
** specific attribute.
|
||||
**
|
||||
** Returns Pointer to matching attribute entry, or NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSDP_DISC_ATTR *SDP_FindAttributeInRec (tSDP_DISC_REC *p_rec,
|
||||
UINT16 attr_id);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindServiceInDb
|
||||
**
|
||||
** Description This function queries an SDP database for a specific service.
|
||||
** If the p_start_rec pointer is NULL, it looks from the beginning
|
||||
** of the database, else it continues from the next record after
|
||||
** p_start_rec.
|
||||
**
|
||||
** Returns Pointer to record containing service class, or NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSDP_DISC_REC *SDP_FindServiceInDb (tSDP_DISCOVERY_DB *p_db,
|
||||
UINT16 service_uuid,
|
||||
tSDP_DISC_REC *p_start_rec);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindServiceUUIDInDb
|
||||
**
|
||||
** Description This function queries an SDP database for a specific service.
|
||||
** If the p_start_rec pointer is NULL, it looks from the beginning
|
||||
** of the database, else it continues from the next record after
|
||||
** p_start_rec.
|
||||
**
|
||||
** NOTE the only difference between this function and the previous
|
||||
** function "SDP_FindServiceInDb()" is that this function takes
|
||||
** a tBT_UUID input.
|
||||
**
|
||||
** Returns Pointer to record containing service class, or NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSDP_DISC_REC *SDP_FindServiceUUIDInDb (tSDP_DISCOVERY_DB *p_db,
|
||||
tBT_UUID *p_uuid,
|
||||
tSDP_DISC_REC *p_start_rec);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindServiceUUIDInRec_128bit
|
||||
**
|
||||
** Description This function is called to read the 128-bit service UUID within a record
|
||||
** if there is any.
|
||||
**
|
||||
** Parameters: p_rec - pointer to a SDP record.
|
||||
** p_uuid - output parameter to save the UUID found.
|
||||
**
|
||||
** Returns TRUE if found, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindServiceInDb_128bit
|
||||
**
|
||||
** Description This function queries an SDP database for a specific service.
|
||||
** If the p_start_rec pointer is NULL, it looks from the beginning
|
||||
** of the database, else it continues from the next record after
|
||||
** p_start_rec.
|
||||
**
|
||||
** Returns Pointer to record containing service class, or NULL
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSDP_DISC_REC *SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB *p_db,
|
||||
tSDP_DISC_REC *p_start_rec);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindProtocolListElemInRec
|
||||
**
|
||||
** Description This function looks at a specific discovery record for a
|
||||
** protocol list element.
|
||||
**
|
||||
** Returns TRUE if found, FALSE if not
|
||||
** If found, the passed protocol list element is filled in.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec,
|
||||
UINT16 layer_uuid,
|
||||
tSDP_PROTOCOL_ELEM *p_elem);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindAddProtoListsElemInRec
|
||||
**
|
||||
** Description This function looks at a specific discovery record for a
|
||||
** protocol list element.
|
||||
**
|
||||
** Returns TRUE if found, FALSE if not
|
||||
** If found, the passed protocol list element is filled in.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec,
|
||||
UINT16 layer_uuid,
|
||||
tSDP_PROTOCOL_ELEM *p_elem);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindProfileVersionInRec
|
||||
**
|
||||
** Description This function looks at a specific discovery record for the
|
||||
** Profile list descriptor, and pulls out the version number.
|
||||
** The version number consists of an 8-bit major version and
|
||||
** an 8-bit minor version.
|
||||
**
|
||||
** Returns TRUE if found, FALSE if not
|
||||
** If found, the major and minor version numbers that were passed
|
||||
** in are filled in.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec,
|
||||
UINT16 profile_uuid,
|
||||
UINT16 *p_version);
|
||||
|
||||
|
||||
/* API into SDP for local service database updates */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_CreateRecord
|
||||
**
|
||||
** Description This function is called to create a record in the database.
|
||||
** This would be through the SDP database maintenance API. The
|
||||
** record is created empty, teh application should then call
|
||||
** "add_attribute" to add the record's attributes.
|
||||
**
|
||||
** Returns Record handle if OK, else 0.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT32 SDP_CreateRecord (void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_DeleteRecord
|
||||
**
|
||||
** Description This function is called to add a record (or all records)
|
||||
** from the database. This would be through the SDP database
|
||||
** maintenance API.
|
||||
**
|
||||
** If a record handle of 0 is passed, all records are deleted.
|
||||
**
|
||||
** Returns TRUE if succeeded, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_DeleteRecord (UINT32 handle);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ReadRecord
|
||||
**
|
||||
** Description This function is called to get the raw data of the record
|
||||
** with the given handle from the database.
|
||||
**
|
||||
** Returns -1, if the record is not found.
|
||||
** Otherwise, the offset (0 or 1) to start of data in p_data.
|
||||
**
|
||||
** The size of data copied into p_data is in *p_data_len.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddAttribute
|
||||
**
|
||||
** Description This function is called to add an attribute to a record.
|
||||
** This would be through the SDP database maintenance API.
|
||||
** If the attribute already exists in the record, it is replaced
|
||||
** with the new value.
|
||||
**
|
||||
** NOTE Attribute values must be passed as a Big Endian stream.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id,
|
||||
UINT8 attr_type, UINT32 attr_len,
|
||||
UINT8 *p_val);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddSequence
|
||||
**
|
||||
** Description This function is called to add a sequence to a record.
|
||||
** This would be through the SDP database maintenance API.
|
||||
** If the sequence already exists in the record, it is replaced
|
||||
** with the new sequence.
|
||||
**
|
||||
** NOTE Element values must be passed as a Big Endian stream.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddSequence (UINT32 handle, UINT16 attr_id,
|
||||
UINT16 num_elem, UINT8 type[],
|
||||
UINT8 len[], UINT8 *p_val[]);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddUuidSequence
|
||||
**
|
||||
** Description This function is called to add a UUID sequence to a record.
|
||||
** This would be through the SDP database maintenance API.
|
||||
** If the sequence already exists in the record, it is replaced
|
||||
** with the new sequence.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddUuidSequence (UINT32 handle, UINT16 attr_id,
|
||||
UINT16 num_uuids, UINT16 *p_uuids);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddProtocolList
|
||||
**
|
||||
** Description This function is called to add a protocol descriptor list to
|
||||
** a record. This would be through the SDP database maintenance API.
|
||||
** If the protocol list already exists in the record, it is replaced
|
||||
** with the new list.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddProtocolList (UINT32 handle, UINT16 num_elem,
|
||||
tSDP_PROTOCOL_ELEM *p_elem_list);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddAdditionProtoLists
|
||||
**
|
||||
** Description This function is called to add a protocol descriptor list to
|
||||
** a record. This would be through the SDP database maintenance API.
|
||||
** If the protocol list already exists in the record, it is replaced
|
||||
** with the new list.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddAdditionProtoLists (UINT32 handle, UINT16 num_elem,
|
||||
tSDP_PROTO_LIST_ELEM *p_proto_list);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddProfileDescriptorList
|
||||
**
|
||||
** Description This function is called to add a profile descriptor list to
|
||||
** a record. This would be through the SDP database maintenance API.
|
||||
** If the version already exists in the record, it is replaced
|
||||
** with the new one.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddProfileDescriptorList (UINT32 handle,
|
||||
UINT16 profile_uuid,
|
||||
UINT16 version);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddLanguageBaseAttrIDList
|
||||
**
|
||||
** Description This function is called to add a language base attr list to
|
||||
** a record. This would be through the SDP database maintenance API.
|
||||
** If the version already exists in the record, it is replaced
|
||||
** with the new one.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddLanguageBaseAttrIDList (UINT32 handle,
|
||||
UINT16 lang, UINT16 char_enc,
|
||||
UINT16 base_id);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_AddServiceClassIdList
|
||||
**
|
||||
** Description This function is called to add a service list to a record.
|
||||
** This would be through the SDP database maintenance API.
|
||||
** If the service list already exists in the record, it is replaced
|
||||
** with the new list.
|
||||
**
|
||||
** Returns TRUE if added OK, else FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_AddServiceClassIdList (UINT32 handle,
|
||||
UINT16 num_services,
|
||||
UINT16 *p_service_uuids);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_DeleteAttribute
|
||||
**
|
||||
** Description This function is called to delete an attribute from a record.
|
||||
** This would be through the SDP database maintenance API.
|
||||
**
|
||||
** Returns TRUE if deleted OK, else FALSE if not found
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id);
|
||||
|
||||
|
||||
/* Device Identification APIs */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_SetLocalDiRecord
|
||||
**
|
||||
** Description This function adds a DI record to the local SDP database.
|
||||
**
|
||||
** Returns Returns SDP_SUCCESS if record added successfully, else error
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 SDP_SetLocalDiRecord (tSDP_DI_RECORD *device_info,
|
||||
UINT32 *p_handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_DiDiscover
|
||||
**
|
||||
** Description This function queries a remote device for DI information.
|
||||
**
|
||||
** Returns SDP_SUCCESS if query started successfully, else error
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 SDP_DiDiscover (BD_ADDR remote_device,
|
||||
tSDP_DISCOVERY_DB *p_db, UINT32 len,
|
||||
tSDP_DISC_CMPL_CB *p_cb);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_GetNumDiRecords
|
||||
**
|
||||
** Description Searches specified database for DI records
|
||||
**
|
||||
** Returns number of DI records found
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 SDP_GetNumDiRecords (tSDP_DISCOVERY_DB *p_db);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_GetDiRecord
|
||||
**
|
||||
** Description This function retrieves a remote device's DI record from
|
||||
** the specified database.
|
||||
**
|
||||
** Returns SDP_SUCCESS if record retrieved, else error
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 SDP_GetDiRecord (UINT8 getRecordIndex,
|
||||
tSDP_DI_GET_RECORD *device_info,
|
||||
tSDP_DISCOVERY_DB *p_db);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_SetTraceLevel
|
||||
**
|
||||
** Description This function sets the trace level for SDP. If called with
|
||||
** a value of 0xFF, it simply reads the current trace level.
|
||||
**
|
||||
** Returns the new (current) trace level
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 SDP_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ConnOpen
|
||||
**
|
||||
** Description This function creates a connection to the SDP server on the
|
||||
** given device.
|
||||
**
|
||||
** Returns 0, if failed to initiate connection. Otherwise, the handle.
|
||||
**
|
||||
*******************************************************************************/
|
||||
UINT32 SDP_ConnOpen (UINT8 *p_bd_addr, tSDP_DISC_RES_CB *p_rcb,
|
||||
tSDP_DISC_CMPL_CB *p_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_WriteData
|
||||
**
|
||||
** Description This function sends data to the connected SDP server.
|
||||
**
|
||||
** Returns TRUE if data is sent, FALSE if failed.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN SDP_WriteData (UINT32 handle, BT_HDR *p_msg);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_ConnClose
|
||||
**
|
||||
** Description This function is called to close a SDP connection.
|
||||
**
|
||||
** Parameters: handle - Handle of the connection returned by SDP_ConnOpen
|
||||
**
|
||||
** Returns TRUE if connection is closed, FALSE if failed to find the handle.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN SDP_ConnClose (UINT32 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SDP_FindServiceUUIDInRec
|
||||
**
|
||||
** Description This function is called to read the service UUID within a record
|
||||
** if there is any.
|
||||
**
|
||||
** Parameters: p_rec - pointer to a SDP record.
|
||||
**
|
||||
** Returns TRUE if found, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
|
||||
#endif /* SDP_API_H */
|
327
tools/sdk/include/bluedroid/stack/sdpdefs.h
Normal file
327
tools/sdk/include/bluedroid/stack/sdpdefs.h
Normal file
@ -0,0 +1,327 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains the definitions for the SDP API
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef SDP_DEFS_H
|
||||
#define SDP_DEFS_H
|
||||
|
||||
/* Define the service attribute IDs.
|
||||
*/
|
||||
#define ATTR_ID_SERVICE_RECORD_HDL 0x0000
|
||||
#define ATTR_ID_SERVICE_CLASS_ID_LIST 0x0001
|
||||
#define ATTR_ID_SERVICE_RECORD_STATE 0x0002
|
||||
#define ATTR_ID_SERVICE_ID 0x0003
|
||||
#define ATTR_ID_PROTOCOL_DESC_LIST 0x0004
|
||||
#define ATTR_ID_BROWSE_GROUP_LIST 0x0005
|
||||
#define ATTR_ID_LANGUAGE_BASE_ATTR_ID_LIST 0x0006
|
||||
#define ATTR_ID_SERVICE_INFO_TIME_TO_LIVE 0x0007
|
||||
#define ATTR_ID_SERVICE_AVAILABILITY 0x0008
|
||||
#define ATTR_ID_BT_PROFILE_DESC_LIST 0x0009
|
||||
#define ATTR_ID_DOCUMENTATION_URL 0x000A
|
||||
#define ATTR_ID_CLIENT_EXE_URL 0x000B
|
||||
#define ATTR_ID_ICON_URL 0x000C
|
||||
#define ATTR_ID_ADDITION_PROTO_DESC_LISTS 0x000D
|
||||
|
||||
#define LANGUAGE_BASE_ID 0x0100
|
||||
#define ATTR_ID_SERVICE_NAME LANGUAGE_BASE_ID + 0x0000
|
||||
#define ATTR_ID_SERVICE_DESCRIPTION LANGUAGE_BASE_ID + 0x0001
|
||||
#define ATTR_ID_PROVIDER_NAME LANGUAGE_BASE_ID + 0x0002
|
||||
|
||||
/* Device Identification (DI)
|
||||
*/
|
||||
#define ATTR_ID_SPECIFICATION_ID 0x0200
|
||||
#define ATTR_ID_VENDOR_ID 0x0201
|
||||
#define ATTR_ID_PRODUCT_ID 0x0202
|
||||
#define ATTR_ID_PRODUCT_VERSION 0x0203
|
||||
#define ATTR_ID_PRIMARY_RECORD 0x0204
|
||||
#define ATTR_ID_VENDOR_ID_SOURCE 0x0205
|
||||
|
||||
#define BLUETOOTH_DI_SPECIFICATION 0x0103 /* 1.3 */
|
||||
#define DI_VENDOR_ID_DEFAULT 0xFFFF
|
||||
#define DI_VENDOR_ID_SOURCE_BTSIG 0x0001
|
||||
#define DI_VENDOR_ID_SOURCE_USBIF 0x0002
|
||||
|
||||
|
||||
#define ATTR_ID_IP_SUBNET 0x0200 /* PAN Profile (***) */
|
||||
#define ATTR_ID_VERSION_NUMBER_LIST 0x0200
|
||||
#define ATTR_ID_GOEP_L2CAP_PSM 0x0200
|
||||
#define ATTR_ID_GROUP_ID 0x0200
|
||||
#define ATTR_ID_SERVICE_DATABASE_STATE 0x0201
|
||||
#define ATTR_ID_SERVICE_VERSION 0x0300
|
||||
#define ATTR_ID_HCRP_1284ID 0x0300
|
||||
|
||||
#define ATTR_ID_SUPPORTED_DATA_STORES 0x0301
|
||||
#define ATTR_ID_NETWORK 0x0301
|
||||
#define ATTR_ID_EXTERNAL_NETWORK 0x0301
|
||||
#define ATTR_ID_FAX_CLASS_1_SUPPORT 0x0302
|
||||
#define ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL 0x0302
|
||||
#define ATTR_ID_DEVICE_NAME 0x0302
|
||||
#define ATTR_ID_SUPPORTED_FORMATS_LIST 0x0303
|
||||
#define ATTR_ID_FAX_CLASS_2_0_SUPPORT 0x0303
|
||||
#define ATTR_ID_FAX_CLASS_2_SUPPORT 0x0304
|
||||
#define ATTR_ID_FRIENDLY_NAME 0x0304
|
||||
#define ATTR_ID_AUDIO_FEEDBACK_SUPPORT 0x0305
|
||||
#define ATTR_ID_NETWORK_ADDRESS 0x0306
|
||||
#define ATTR_ID_DEVICE_LOCATION 0x0306
|
||||
#define ATTR_ID_WAP_GATEWAY 0x0307
|
||||
#define ATTR_ID_HOME_PAGE_URL 0x0308
|
||||
#define ATTR_ID_WAP_STACK_TYPE 0x0309
|
||||
#define ATTR_ID_IMG_SUPPORTED_CAPABILITIES 0x0310 /* Imaging Profile */
|
||||
#define ATTR_ID_SUPPORTED_FEATURES 0x0311 /* HFP, BIP */
|
||||
#define ATTR_ID_IMG_SUPPORTED_FUNCTIONS 0x0312 /* Imaging Profile */
|
||||
#define ATTR_ID_IMG_TOT_DATA_CAPABILITY 0x0313 /* Imaging Profile */
|
||||
#define ATTR_ID_SUPPORTED_REPOSITORIES 0x0314 /* Phone book access Profile */
|
||||
#define ATTR_ID_MAS_INSTANCE_ID 0x0315 /* MAP profile */
|
||||
#define ATTR_ID_SUPPORTED_MSG_TYPE 0x0316 /* MAP profile */
|
||||
#define ATTR_ID_MAP_SUPPORTED_FEATURES 0x0317 /* MAP profile */
|
||||
#define ATTR_ID_PBAP_SUPPORTED_FEATURES 0x0317 /* PBAP profile */
|
||||
|
||||
|
||||
/* These values are for the BPP profile */
|
||||
#define ATTR_ID_DOCUMENT_FORMATS_SUPPORTED 0x0350
|
||||
#define ATTR_ID_CHARACTER_REPERTOIRES_SUPPORTED 0x0352
|
||||
#define ATTR_ID_XHTML_IMAGE_FORMATS_SUPPORTED 0x0354
|
||||
#define ATTR_ID_COLOR_SUPPORTED 0x0356
|
||||
#define ATTR_ID_1284ID 0x0358
|
||||
#define ATTR_ID_PRINTER_NAME 0x035A
|
||||
#define ATTR_ID_PRINTER_LOCATION 0x035C
|
||||
#define ATTR_ID_DUPLEX_SUPPORTED 0x035E
|
||||
#define ATTR_ID_MEDIA_TYPES_SUPPORTED 0x0360
|
||||
#define ATTR_ID_MAX_MEDIA_WIDTH 0x0362
|
||||
#define ATTR_ID_MAX_MEDIA_LENGTH 0x0364
|
||||
#define ATTR_ID_ENHANCED_LAYOUT_SUPPORTED 0x0366
|
||||
#define ATTR_ID_RUI_FORMATS_SUPPORTED 0x0368
|
||||
#define ATTR_ID_RUI_REF_PRINTING_SUPPORTED 0x0370 /* Boolean */
|
||||
#define ATTR_ID_RUI_DIRECT_PRINTING_SUPPORTED 0x0372 /* Boolean */
|
||||
#define ATTR_ID_REF_PRINTING_TOP_URL 0x0374
|
||||
#define ATTR_ID_DIRECT_PRINTING_TOP_URL 0x0376
|
||||
#define ATTR_ID_PRINTER_ADMIN_RUI_TOP_URL 0x0378
|
||||
#define ATTR_ID_BPP_DEVICE_NAME 0x037A
|
||||
|
||||
/* These values are for the PAN profile */
|
||||
#define ATTR_ID_SECURITY_DESCRIPTION 0x030A
|
||||
#define ATTR_ID_NET_ACCESS_TYPE 0x030B
|
||||
#define ATTR_ID_MAX_NET_ACCESS_RATE 0x030C
|
||||
#define ATTR_ID_IPV4_SUBNET 0x030D
|
||||
#define ATTR_ID_IPV6_SUBNET 0x030E
|
||||
#define ATTR_ID_PAN_SECURITY 0x0400
|
||||
|
||||
/* These values are for HID profile */
|
||||
#define ATTR_ID_HID_DEVICE_RELNUM 0x0200
|
||||
#define ATTR_ID_HID_PARSER_VERSION 0x0201
|
||||
#define ATTR_ID_HID_DEVICE_SUBCLASS 0x0202
|
||||
#define ATTR_ID_HID_COUNTRY_CODE 0x0203
|
||||
#define ATTR_ID_HID_VIRTUAL_CABLE 0x0204
|
||||
#define ATTR_ID_HID_RECONNECT_INITIATE 0x0205
|
||||
#define ATTR_ID_HID_DESCRIPTOR_LIST 0x0206
|
||||
#define ATTR_ID_HID_LANGUAGE_ID_BASE 0x0207
|
||||
#define ATTR_ID_HID_SDP_DISABLE 0x0208
|
||||
#define ATTR_ID_HID_BATTERY_POWER 0x0209
|
||||
#define ATTR_ID_HID_REMOTE_WAKE 0x020A
|
||||
#define ATTR_ID_HID_PROFILE_VERSION 0x020B
|
||||
#define ATTR_ID_HID_LINK_SUPERVISION_TO 0x020C
|
||||
#define ATTR_ID_HID_NORMALLY_CONNECTABLE 0x020D
|
||||
#define ATTR_ID_HID_BOOT_DEVICE 0x020E
|
||||
#define ATTR_ID_HID_SSR_HOST_MAX_LAT 0x020F
|
||||
#define ATTR_ID_HID_SSR_HOST_MIN_TOUT 0x0210
|
||||
|
||||
/* These values are for the HDP profile */
|
||||
#define ATTR_ID_HDP_SUP_FEAT_LIST 0x0200 /* Supported features list */
|
||||
#define ATTR_ID_HDP_DATA_EXCH_SPEC 0x0301 /* Data exchange specification */
|
||||
#define ATTR_ID_HDP_MCAP_SUP_PROC 0x0302 /* MCAP supported procedures */
|
||||
|
||||
/* Define common 16-bit protocol UUIDs
|
||||
*/
|
||||
#define UUID_PROTOCOL_SDP 0x0001
|
||||
#define UUID_PROTOCOL_UDP 0x0002
|
||||
#define UUID_PROTOCOL_RFCOMM 0x0003
|
||||
#define UUID_PROTOCOL_TCP 0x0004
|
||||
#define UUID_PROTOCOL_TCS_BIN 0x0005
|
||||
#define UUID_PROTOCOL_TCS_AT 0x0006
|
||||
#define UUID_PROTOCOL_OBEX 0x0008
|
||||
#define UUID_PROTOCOL_IP 0x0009
|
||||
#define UUID_PROTOCOL_FTP 0x000A
|
||||
#define UUID_PROTOCOL_HTTP 0x000C
|
||||
#define UUID_PROTOCOL_WSP 0x000E
|
||||
#define UUID_PROTOCOL_BNEP 0x000F
|
||||
#define UUID_PROTOCOL_UPNP 0x0010
|
||||
#define UUID_PROTOCOL_HIDP 0x0011
|
||||
#define UUID_PROTOCOL_HCRP_CTRL 0x0012
|
||||
#define UUID_PROTOCOL_HCRP_DATA 0x0014
|
||||
#define UUID_PROTOCOL_HCRP_NOTIF 0x0016
|
||||
#define UUID_PROTOCOL_AVCTP 0x0017
|
||||
#define UUID_PROTOCOL_AVDTP 0x0019
|
||||
#define UUID_PROTOCOL_CMTP 0x001B
|
||||
#define UUID_PROTOCOL_UDI 0x001D
|
||||
#define UUID_PROTOCOL_MCAP_CTRL 0x001E
|
||||
#define UUID_PROTOCOL_MCAP_DATA 0x001F
|
||||
#define UUID_PROTOCOL_L2CAP 0x0100
|
||||
#define UUID_PROTOCOL_ATT 0x0007
|
||||
|
||||
/* Define common 16-bit service class UUIDs
|
||||
*/
|
||||
#define UUID_SERVCLASS_SERVICE_DISCOVERY_SERVER 0X1000
|
||||
#define UUID_SERVCLASS_BROWSE_GROUP_DESCRIPTOR 0X1001
|
||||
#define UUID_SERVCLASS_PUBLIC_BROWSE_GROUP 0X1002
|
||||
#define UUID_SERVCLASS_SERIAL_PORT 0X1101
|
||||
#define UUID_SERVCLASS_LAN_ACCESS_USING_PPP 0X1102
|
||||
#define UUID_SERVCLASS_DIALUP_NETWORKING 0X1103
|
||||
#define UUID_SERVCLASS_IRMC_SYNC 0X1104
|
||||
#define UUID_SERVCLASS_OBEX_OBJECT_PUSH 0X1105
|
||||
#define UUID_SERVCLASS_OBEX_FILE_TRANSFER 0X1106
|
||||
#define UUID_SERVCLASS_IRMC_SYNC_COMMAND 0X1107
|
||||
#define UUID_SERVCLASS_HEADSET 0X1108
|
||||
#define UUID_SERVCLASS_CORDLESS_TELEPHONY 0X1109
|
||||
#define UUID_SERVCLASS_AUDIO_SOURCE 0X110A
|
||||
#define UUID_SERVCLASS_AUDIO_SINK 0X110B
|
||||
#define UUID_SERVCLASS_AV_REM_CTRL_TARGET 0X110C /* Audio/Video Control profile */
|
||||
#define UUID_SERVCLASS_ADV_AUDIO_DISTRIBUTION 0X110D /* Advanced Audio Distribution profile */
|
||||
#define UUID_SERVCLASS_AV_REMOTE_CONTROL 0X110E /* Audio/Video Control profile */
|
||||
#define UUID_SERVCLASS_AV_REM_CTRL_CONTROL 0X110F /* Audio/Video Control profile */
|
||||
#define UUID_SERVCLASS_INTERCOM 0X1110
|
||||
#define UUID_SERVCLASS_FAX 0X1111
|
||||
#define UUID_SERVCLASS_HEADSET_AUDIO_GATEWAY 0X1112
|
||||
#define UUID_SERVCLASS_WAP 0X1113
|
||||
#define UUID_SERVCLASS_WAP_CLIENT 0X1114
|
||||
#define UUID_SERVCLASS_PANU 0X1115 /* PAN profile */
|
||||
#define UUID_SERVCLASS_NAP 0X1116 /* PAN profile */
|
||||
#define UUID_SERVCLASS_GN 0X1117 /* PAN profile */
|
||||
#define UUID_SERVCLASS_DIRECT_PRINTING 0X1118 /* BPP profile */
|
||||
#define UUID_SERVCLASS_REFERENCE_PRINTING 0X1119 /* BPP profile */
|
||||
#define UUID_SERVCLASS_IMAGING 0X111A /* Imaging profile */
|
||||
#define UUID_SERVCLASS_IMAGING_RESPONDER 0X111B /* Imaging profile */
|
||||
#define UUID_SERVCLASS_IMAGING_AUTO_ARCHIVE 0X111C /* Imaging profile */
|
||||
#define UUID_SERVCLASS_IMAGING_REF_OBJECTS 0X111D /* Imaging profile */
|
||||
#define UUID_SERVCLASS_HF_HANDSFREE 0X111E /* Handsfree profile */
|
||||
#define UUID_SERVCLASS_AG_HANDSFREE 0X111F /* Handsfree profile */
|
||||
#define UUID_SERVCLASS_DIR_PRT_REF_OBJ_SERVICE 0X1120 /* BPP profile */
|
||||
#define UUID_SERVCLASS_REFLECTED_UI 0X1121 /* BPP profile */
|
||||
#define UUID_SERVCLASS_BASIC_PRINTING 0X1122 /* BPP profile */
|
||||
#define UUID_SERVCLASS_PRINTING_STATUS 0X1123 /* BPP profile */
|
||||
#define UUID_SERVCLASS_HUMAN_INTERFACE 0X1124 /* HID profile */
|
||||
#define UUID_SERVCLASS_CABLE_REPLACEMENT 0X1125 /* HCRP profile */
|
||||
#define UUID_SERVCLASS_HCRP_PRINT 0X1126 /* HCRP profile */
|
||||
#define UUID_SERVCLASS_HCRP_SCAN 0X1127 /* HCRP profile */
|
||||
#define UUID_SERVCLASS_COMMON_ISDN_ACCESS 0X1128 /* CAPI Message Transport Protocol*/
|
||||
#define UUID_SERVCLASS_VIDEO_CONFERENCING_GW 0X1129 /* Video Conferencing profile */
|
||||
#define UUID_SERVCLASS_UDI_MT 0X112A /* Unrestricted Digital Information profile */
|
||||
#define UUID_SERVCLASS_UDI_TA 0X112B /* Unrestricted Digital Information profile */
|
||||
#define UUID_SERVCLASS_VCP 0X112C /* Video Conferencing profile */
|
||||
#define UUID_SERVCLASS_SAP 0X112D /* SIM Access profile */
|
||||
#define UUID_SERVCLASS_PBAP_PCE 0X112E /* Phonebook Access - PCE */
|
||||
#define UUID_SERVCLASS_PBAP_PSE 0X112F /* Phonebook Access - PSE */
|
||||
#define UUID_SERVCLASS_PHONE_ACCESS 0x1130
|
||||
#define UUID_SERVCLASS_HEADSET_HS 0x1131 /* Headset - HS, from HSP v1.2 */
|
||||
#define UUID_SERVCLASS_PNP_INFORMATION 0X1200 /* Device Identification */
|
||||
#define UUID_SERVCLASS_GENERIC_NETWORKING 0X1201
|
||||
#define UUID_SERVCLASS_GENERIC_FILETRANSFER 0X1202
|
||||
#define UUID_SERVCLASS_GENERIC_AUDIO 0X1203
|
||||
#define UUID_SERVCLASS_GENERIC_TELEPHONY 0X1204
|
||||
#define UUID_SERVCLASS_UPNP_SERVICE 0X1205 /* UPNP_Service [ESDP] */
|
||||
#define UUID_SERVCLASS_UPNP_IP_SERVICE 0X1206 /* UPNP_IP_Service [ESDP] */
|
||||
#define UUID_SERVCLASS_ESDP_UPNP_IP_PAN 0X1300 /* UPNP_IP_PAN [ESDP] */
|
||||
#define UUID_SERVCLASS_ESDP_UPNP_IP_LAP 0X1301 /* UPNP_IP_LAP [ESDP] */
|
||||
#define UUID_SERVCLASS_ESDP_UPNP_IP_L2CAP 0X1302 /* UPNP_L2CAP [ESDP] */
|
||||
#define UUID_SERVCLASS_VIDEO_SOURCE 0X1303 /* Video Distribution Profile (VDP) */
|
||||
#define UUID_SERVCLASS_VIDEO_SINK 0X1304 /* Video Distribution Profile (VDP) */
|
||||
#define UUID_SERVCLASS_VIDEO_DISTRIBUTION 0X1305 /* Video Distribution Profile (VDP) */
|
||||
#define UUID_SERVCLASS_HDP_PROFILE 0X1400 /* Health Device profile (HDP) */
|
||||
#define UUID_SERVCLASS_HDP_SOURCE 0X1401 /* Health Device profile (HDP) */
|
||||
#define UUID_SERVCLASS_HDP_SINK 0X1402 /* Health Device profile (HDP) */
|
||||
#define UUID_SERVCLASS_MAP_PROFILE 0X1134 /* MAP profile UUID */
|
||||
#define UUID_SERVCLASS_MESSAGE_ACCESS 0X1132 /* Message Access Service UUID */
|
||||
#define UUID_SERVCLASS_MESSAGE_NOTIFICATION 0X1133 /* Message Notification Service UUID */
|
||||
|
||||
#define UUID_SERVCLASS_GAP_SERVER 0x1800
|
||||
#define UUID_SERVCLASS_GATT_SERVER 0x1801
|
||||
#define UUID_SERVCLASS_IMMEDIATE_ALERT 0x1802 /* immediate alert */
|
||||
#define UUID_SERVCLASS_LINKLOSS 0x1803 /* Link Loss Alert */
|
||||
#define UUID_SERVCLASS_TX_POWER 0x1804 /* TX power */
|
||||
#define UUID_SERVCLASS_CURRENT_TIME 0x1805 /* Link Loss Alert */
|
||||
#define UUID_SERVCLASS_DST_CHG 0x1806 /* DST Time change */
|
||||
#define UUID_SERVCLASS_REF_TIME_UPD 0x1807 /* reference time update */
|
||||
#define UUID_SERVCLASS_THERMOMETER 0x1809 /* Thermometer UUID */
|
||||
#define UUID_SERVCLASS_DEVICE_INFO 0x180A /* device info service */
|
||||
#define UUID_SERVCLASS_NWA 0x180B /* Network availability */
|
||||
#define UUID_SERVCLASS_HEART_RATE 0x180D /* Heart Rate service */
|
||||
#define UUID_SERVCLASS_PHALERT 0x180E /* phone alert service */
|
||||
#define UUID_SERVCLASS_BATTERY 0x180F /* battery service */
|
||||
#define UUID_SERVCLASS_BPM 0x1810 /* blood pressure service */
|
||||
#define UUID_SERVCLASS_ALERT_NOTIFICATION 0x1811 /* alert notification service */
|
||||
#define UUID_SERVCLASS_LE_HID 0x1812 /* HID over LE */
|
||||
#define UUID_SERVCLASS_SCAN_PARAM 0x1813 /* Scan Parameter service */
|
||||
#define UUID_SERVCLASS_GLUCOSE 0x1808 /* Glucose Meter Service */
|
||||
#define UUID_SERVCLASS_RSC 0x1814 /* RUNNERS SPEED AND CADENCE SERVICE */
|
||||
#define UUID_SERVCLASS_CSC 0x1816 /* Cycling SPEED AND CADENCE SERVICE */
|
||||
|
||||
#define UUID_SERVCLASS_TEST_SERVER 0x9000 /* Test Group UUID */
|
||||
|
||||
#if (BTM_WBS_INCLUDED == TRUE )
|
||||
#define UUID_CODEC_CVSD 0x0001 /* CVSD */
|
||||
#define UUID_CODEC_MSBC 0x0002 /* mSBC */
|
||||
#endif
|
||||
|
||||
/* Define all the 'Descriptor Type' values.
|
||||
*/
|
||||
#define NULL_DESC_TYPE 0
|
||||
#define UINT_DESC_TYPE 1
|
||||
#define TWO_COMP_INT_DESC_TYPE 2
|
||||
#define UUID_DESC_TYPE 3
|
||||
#define TEXT_STR_DESC_TYPE 4
|
||||
#define BOOLEAN_DESC_TYPE 5
|
||||
#define DATA_ELE_SEQ_DESC_TYPE 6
|
||||
#define DATA_ELE_ALT_DESC_TYPE 7
|
||||
#define URL_DESC_TYPE 8
|
||||
|
||||
/* Define all the "Descriptor Size" values.
|
||||
*/
|
||||
#define SIZE_ONE_BYTE 0
|
||||
#define SIZE_TWO_BYTES 1
|
||||
#define SIZE_FOUR_BYTES 2
|
||||
#define SIZE_EIGHT_BYTES 3
|
||||
#define SIZE_SIXTEEN_BYTES 4
|
||||
#define SIZE_IN_NEXT_BYTE 5
|
||||
#define SIZE_IN_NEXT_WORD 6
|
||||
#define SIZE_IN_NEXT_LONG 7
|
||||
|
||||
/* Language Encoding Constants */
|
||||
#define LANG_ID_CODE_ENGLISH ((UINT16) 0x656e) /* "en" */
|
||||
#define LANG_ID_CHAR_ENCODE_UTF8 ((UINT16) 0x006a) /* UTF-8 */
|
||||
|
||||
/* Constants used for display purposes only. These define ovelapping attribute values */
|
||||
#define ATTR_ID_VERS_OR_GRP_OR_DRELNUM_OR_IPSUB_OR_SPECID 0x0200
|
||||
#define ATTR_ID_VEND_ID_OR_SERVICE_DB_STATE_OR_PARSE_VER 0x0201
|
||||
#define ATTR_ID_PROD_ID_OR_HID_DEV_SUBCLASS 0x0202
|
||||
#define ATTR_ID_PROD_VER_OR_HID_COUNTRY_CODE 0x0203
|
||||
#define ATTR_ID_PRIMARY_REC_OR_HID_VIRTUAL_CABLE 0x0204
|
||||
#define ATTR_ID_DI_VENDOR_ID_SOURCE_OR_HID_INIT_RECONNECT 0x0205
|
||||
#define ATTR_ID_SERV_VERS_OR_1284ID 0x0300
|
||||
#define ATTR_ID_DATA_STORES_OR_NETWORK 0x0301
|
||||
#define ATTR_ID_FAX_1_OR_AUD_VOL_OR_DEV_NAME 0x0302
|
||||
#define ATTR_ID_FORMATS_OR_FAX_2_0 0x0303
|
||||
#define ATTR_ID_FAX_CLASS_2_OR_FRIENDLY_NAME 0x0304
|
||||
#define ATTR_ID_NETADDRESS_OR_DEVLOCATION 0x0306
|
||||
|
||||
#endif
|
||||
|
||||
|
496
tools/sdk/include/bluedroid/stack/smp_api.h
Normal file
496
tools/sdk/include/bluedroid/stack/smp_api.h
Normal file
@ -0,0 +1,496 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-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 file contains the SMP API function external definitions.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef SMP_API_H
|
||||
#define SMP_API_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#define SMP_PIN_CODE_LEN_MAX PIN_CODE_LEN
|
||||
#define SMP_PIN_CODE_LEN_MIN 6
|
||||
|
||||
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
/* SMP command code */
|
||||
#define SMP_OPCODE_PAIRING_REQ 0x01
|
||||
#define SMP_OPCODE_PAIRING_RSP 0x02
|
||||
#define SMP_OPCODE_CONFIRM 0x03
|
||||
#define SMP_OPCODE_RAND 0x04
|
||||
#define SMP_OPCODE_PAIRING_FAILED 0x05
|
||||
#define SMP_OPCODE_ENCRYPT_INFO 0x06
|
||||
#define SMP_OPCODE_MASTER_ID 0x07
|
||||
#define SMP_OPCODE_IDENTITY_INFO 0x08
|
||||
#define SMP_OPCODE_ID_ADDR 0x09
|
||||
#define SMP_OPCODE_SIGN_INFO 0x0A
|
||||
#define SMP_OPCODE_SEC_REQ 0x0B
|
||||
#define SMP_OPCODE_PAIR_PUBLIC_KEY 0x0C
|
||||
#define SMP_OPCODE_PAIR_DHKEY_CHECK 0x0D
|
||||
#define SMP_OPCODE_PAIR_KEYPR_NOTIF 0x0E
|
||||
#define SMP_OPCODE_MAX SMP_OPCODE_PAIR_KEYPR_NOTIF
|
||||
#define SMP_OPCODE_MIN SMP_OPCODE_PAIRING_REQ
|
||||
#define SMP_OPCODE_PAIR_COMMITM 0x0F
|
||||
#endif
|
||||
|
||||
/* SMP event type */
|
||||
#define SMP_IO_CAP_REQ_EVT 1 /* IO capability request event */
|
||||
#define SMP_SEC_REQUEST_EVT 2 /* SMP pairing request */
|
||||
#define SMP_PASSKEY_NOTIF_EVT 3 /* passkey notification event */
|
||||
#define SMP_PASSKEY_REQ_EVT 4 /* passkey request event */
|
||||
#define SMP_OOB_REQ_EVT 5 /* OOB request event */
|
||||
#define SMP_NC_REQ_EVT 6 /* Numeric Comparison request event */
|
||||
#define SMP_COMPLT_EVT 7 /* SMP complete event */
|
||||
#define SMP_PEER_KEYPR_NOT_EVT 8 /* Peer keypress notification received event */
|
||||
#define SMP_SC_OOB_REQ_EVT 9 /* SC OOB request event (both local and peer OOB data */
|
||||
/* can be expected in response) */
|
||||
#define SMP_SC_LOC_OOB_DATA_UP_EVT 10 /* SC OOB local data set is created */
|
||||
/* (as result of SMP_CrLocScOobData(...)) */
|
||||
#define SMP_BR_KEYS_REQ_EVT 12 /* SMP over BR keys request event */
|
||||
typedef UINT8 tSMP_EVT;
|
||||
|
||||
|
||||
/* pairing failure reason code */
|
||||
#define SMP_PASSKEY_ENTRY_FAIL 0x01
|
||||
#define SMP_OOB_FAIL 0x02
|
||||
#define SMP_PAIR_AUTH_FAIL 0x03
|
||||
#define SMP_CONFIRM_VALUE_ERR 0x04
|
||||
#define SMP_PAIR_NOT_SUPPORT 0x05
|
||||
#define SMP_ENC_KEY_SIZE 0x06
|
||||
#define SMP_INVALID_CMD 0x07
|
||||
#define SMP_PAIR_FAIL_UNKNOWN 0x08
|
||||
#define SMP_REPEATED_ATTEMPTS 0x09
|
||||
#define SMP_INVALID_PARAMETERS 0x0A
|
||||
#define SMP_DHKEY_CHK_FAIL 0x0B
|
||||
#define SMP_NUMERIC_COMPAR_FAIL 0x0C
|
||||
#define SMP_BR_PARING_IN_PROGR 0x0D
|
||||
#define SMP_XTRANS_DERIVE_NOT_ALLOW 0x0E
|
||||
#define SMP_MAX_FAIL_RSN_PER_SPEC SMP_XTRANS_DERIVE_NOT_ALLOW
|
||||
|
||||
/* self defined error code */
|
||||
#define SMP_PAIR_INTERNAL_ERR (SMP_MAX_FAIL_RSN_PER_SPEC + 0x01) /* 0x0F */
|
||||
|
||||
/* 0x0F unknown IO capability, unable to decide association model */
|
||||
#define SMP_UNKNOWN_IO_CAP (SMP_MAX_FAIL_RSN_PER_SPEC + 0x02) /* 0x10 */
|
||||
|
||||
#define SMP_INIT_FAIL (SMP_MAX_FAIL_RSN_PER_SPEC + 0x03) /* 0x11 */
|
||||
#define SMP_CONFIRM_FAIL (SMP_MAX_FAIL_RSN_PER_SPEC + 0x04) /* 0x12 */
|
||||
#define SMP_BUSY (SMP_MAX_FAIL_RSN_PER_SPEC + 0x05) /* 0x13 */
|
||||
#define SMP_ENC_FAIL (SMP_MAX_FAIL_RSN_PER_SPEC + 0x06) /* 0x14 */
|
||||
#define SMP_STARTED (SMP_MAX_FAIL_RSN_PER_SPEC + 0x07) /* 0x15 */
|
||||
#define SMP_RSP_TIMEOUT (SMP_MAX_FAIL_RSN_PER_SPEC + 0x08) /* 0x16 */
|
||||
#define SMP_DIV_NOT_AVAIL (SMP_MAX_FAIL_RSN_PER_SPEC + 0x09) /* 0x17 */
|
||||
|
||||
/* 0x17 unspecified failed reason */
|
||||
#define SMP_FAIL (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0A) /* 0x18 */
|
||||
|
||||
#define SMP_CONN_TOUT (SMP_MAX_FAIL_RSN_PER_SPEC + 0x0B) /* 0x19 */
|
||||
#define SMP_SUCCESS 0
|
||||
|
||||
typedef UINT8 tSMP_STATUS;
|
||||
|
||||
|
||||
/* Device IO capability */
|
||||
#define SMP_IO_CAP_OUT BTM_IO_CAP_OUT /* DisplayOnly */
|
||||
#define SMP_IO_CAP_IO BTM_IO_CAP_IO /* DisplayYesNo */
|
||||
#define SMP_IO_CAP_IN BTM_IO_CAP_IN /* KeyboardOnly */
|
||||
#define SMP_IO_CAP_NONE BTM_IO_CAP_NONE /* NoInputNoOutput */
|
||||
#define SMP_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* Keyboard Display */
|
||||
#define SMP_IO_CAP_MAX BTM_IO_CAP_MAX
|
||||
typedef UINT8 tSMP_IO_CAP;
|
||||
|
||||
#ifndef SMP_DEFAULT_IO_CAPS
|
||||
#define SMP_DEFAULT_IO_CAPS SMP_IO_CAP_KBDISP
|
||||
#endif
|
||||
|
||||
/* OOB data present or not */
|
||||
enum {
|
||||
SMP_OOB_NONE,
|
||||
SMP_OOB_PRESENT,
|
||||
SMP_OOB_UNKNOWN
|
||||
};
|
||||
typedef UINT8 tSMP_OOB_FLAG;
|
||||
|
||||
/* type of OOB data required from application */
|
||||
enum {
|
||||
SMP_OOB_INVALID_TYPE,
|
||||
SMP_OOB_PEER,
|
||||
SMP_OOB_LOCAL,
|
||||
SMP_OOB_BOTH
|
||||
};
|
||||
typedef UINT8 tSMP_OOB_DATA_TYPE;
|
||||
|
||||
#define SMP_AUTH_NO_BOND 0x00
|
||||
#define SMP_AUTH_GEN_BOND 0x01 //todo sdh change GEN_BOND to BOND
|
||||
|
||||
/* SMP Authentication requirement */
|
||||
#define SMP_AUTH_YN_BIT (1 << 2)
|
||||
#define SMP_SC_SUPPORT_BIT (1 << 3)
|
||||
#define SMP_KP_SUPPORT_BIT (1 << 4)
|
||||
|
||||
#define SMP_AUTH_MASK (SMP_AUTH_GEN_BOND|SMP_AUTH_YN_BIT|SMP_SC_SUPPORT_BIT|SMP_KP_SUPPORT_BIT)
|
||||
|
||||
#define SMP_AUTH_BOND SMP_AUTH_GEN_BOND
|
||||
|
||||
/* no MITM, No Bonding, encryption only */
|
||||
#define SMP_AUTH_NB_ENC_ONLY 0x00 //(SMP_AUTH_MASK | BTM_AUTH_SP_NO)
|
||||
|
||||
/* MITM, No Bonding, Use IO Capability to determine authentication procedure */
|
||||
#define SMP_AUTH_NB_IOCAP (SMP_AUTH_NO_BOND | SMP_AUTH_YN_BIT)
|
||||
|
||||
/* No MITM, General Bonding, Encryption only */
|
||||
#define SMP_AUTH_GB_ENC_ONLY (SMP_AUTH_GEN_BOND )
|
||||
|
||||
/* MITM, General Bonding, Use IO Capability to determine authentication procedure */
|
||||
#define SMP_AUTH_GB_IOCAP (SMP_AUTH_GEN_BOND | SMP_AUTH_YN_BIT)
|
||||
|
||||
/* Secure Connections, no MITM, no Bonding */
|
||||
#define SMP_AUTH_SC_ENC_ONLY (SMP_SC_SUPPORT_BIT)
|
||||
|
||||
/* Secure Connections, no MITM, Bonding */
|
||||
#define SMP_AUTH_SC_GB (SMP_SC_SUPPORT_BIT | SMP_AUTH_GEN_BOND)
|
||||
|
||||
/* Secure Connections, MITM, no Bonding */
|
||||
#define SMP_AUTH_SC_MITM_NB (SMP_SC_SUPPORT_BIT | SMP_AUTH_YN_BIT | SMP_AUTH_NO_BOND)
|
||||
|
||||
/* Secure Connections, MITM, Bonding */
|
||||
#define SMP_AUTH_SC_MITM_GB (SMP_SC_SUPPORT_BIT | SMP_AUTH_YN_BIT | SMP_AUTH_GEN_BOND)
|
||||
|
||||
/* All AuthReq RFU bits are set to 1 - NOTE: reserved bit in Bonding_Flags is not set */
|
||||
#define SMP_AUTH_ALL_RFU_SET 0xF8
|
||||
|
||||
typedef UINT8 tSMP_AUTH_REQ;
|
||||
|
||||
#define SMP_SEC_NONE 0
|
||||
#define SMP_SEC_UNAUTHENTICATE (1 << 0)
|
||||
#define SMP_SEC_AUTHENTICATED (1 << 2)
|
||||
typedef UINT8 tSMP_SEC_LEVEL;
|
||||
|
||||
/* Maximum Encryption Key Size range */
|
||||
#define SMP_ENCR_KEY_SIZE_MIN 7
|
||||
#define SMP_ENCR_KEY_SIZE_MAX 16
|
||||
|
||||
/* SMP key types */
|
||||
#define SMP_SEC_KEY_TYPE_ENC (1 << 0) /* encryption key */
|
||||
#define SMP_SEC_KEY_TYPE_ID (1 << 1) /* identity key */
|
||||
#define SMP_SEC_KEY_TYPE_CSRK (1 << 2) /* slave CSRK */
|
||||
#define SMP_SEC_KEY_TYPE_LK (1 << 3) /* BR/EDR link key */
|
||||
typedef UINT8 tSMP_KEYS;
|
||||
|
||||
#define SMP_BR_SEC_DEFAULT_KEY (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | \
|
||||
SMP_SEC_KEY_TYPE_CSRK)
|
||||
|
||||
/* default security key distribution value */
|
||||
#define SMP_SEC_DEFAULT_KEY (SMP_SEC_KEY_TYPE_ENC | SMP_SEC_KEY_TYPE_ID | \
|
||||
SMP_SEC_KEY_TYPE_CSRK | SMP_SEC_KEY_TYPE_LK)
|
||||
|
||||
#define SMP_SC_KEY_STARTED 0 /* passkey entry started */
|
||||
#define SMP_SC_KEY_ENTERED 1 /* passkey digit entered */
|
||||
#define SMP_SC_KEY_ERASED 2 /* passkey digit erased */
|
||||
#define SMP_SC_KEY_CLEARED 3 /* passkey cleared */
|
||||
#define SMP_SC_KEY_COMPLT 4 /* passkey entry completed */
|
||||
#define SMP_SC_KEY_OUT_OF_RANGE 5 /* out of range */
|
||||
typedef UINT8 tSMP_SC_KEY_TYPE;
|
||||
|
||||
/* data type for BTM_SP_IO_REQ_EVT */
|
||||
typedef struct {
|
||||
tSMP_IO_CAP io_cap; /* local IO capabilities */
|
||||
tSMP_OOB_FLAG oob_data; /* OOB data present (locally) for the peer device */
|
||||
tSMP_AUTH_REQ auth_req; /* Authentication required (for local device) */
|
||||
UINT8 max_key_size; /* max encryption key size */
|
||||
tSMP_KEYS init_keys; /* initiator keys to be distributed */
|
||||
tSMP_KEYS resp_keys; /* responder keys */
|
||||
} tSMP_IO_REQ;
|
||||
|
||||
typedef struct {
|
||||
tSMP_STATUS reason;
|
||||
tSMP_SEC_LEVEL sec_level;
|
||||
BOOLEAN is_pair_cancel;
|
||||
BOOLEAN smp_over_br;
|
||||
} tSMP_CMPL;
|
||||
|
||||
typedef struct {
|
||||
BT_OCTET32 x;
|
||||
BT_OCTET32 y;
|
||||
} tSMP_PUBLIC_KEY;
|
||||
|
||||
/* the data associated with the info sent to the peer via OOB interface */
|
||||
typedef struct {
|
||||
BOOLEAN present;
|
||||
BT_OCTET16 randomizer;
|
||||
BT_OCTET16 commitment;
|
||||
|
||||
tBLE_BD_ADDR addr_sent_to;
|
||||
BT_OCTET32 private_key_used; /* is used to calculate: */
|
||||
/* publ_key_used = P-256(private_key_used, curve_p256.G) - send it to the */
|
||||
/* other side */
|
||||
/* dhkey = P-256(private_key_used, publ key rcvd from the other side) */
|
||||
tSMP_PUBLIC_KEY publ_key_used; /* P-256(private_key_used, curve_p256.G) */
|
||||
} tSMP_LOC_OOB_DATA;
|
||||
|
||||
/* the data associated with the info received from the peer via OOB interface */
|
||||
typedef struct {
|
||||
BOOLEAN present;
|
||||
BT_OCTET16 randomizer;
|
||||
BT_OCTET16 commitment;
|
||||
tBLE_BD_ADDR addr_rcvd_from;
|
||||
} tSMP_PEER_OOB_DATA;
|
||||
|
||||
typedef struct {
|
||||
tSMP_LOC_OOB_DATA loc_oob_data;
|
||||
tSMP_PEER_OOB_DATA peer_oob_data;
|
||||
} tSMP_SC_OOB_DATA;
|
||||
|
||||
|
||||
typedef union {
|
||||
UINT32 passkey;
|
||||
tSMP_IO_REQ io_req; /* IO request */
|
||||
tSMP_CMPL cmplt;
|
||||
tSMP_OOB_DATA_TYPE req_oob_type;
|
||||
tSMP_LOC_OOB_DATA loc_oob_data;
|
||||
} tSMP_EVT_DATA;
|
||||
|
||||
|
||||
/* AES Encryption output */
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT8 param_len;
|
||||
UINT16 opcode;
|
||||
UINT8 param_buf[BT_OCTET16_LEN];
|
||||
} tSMP_ENC;
|
||||
|
||||
/* Security Manager events - Called by the stack when Security Manager related events occur.*/
|
||||
typedef UINT8 (tSMP_CALLBACK) (tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
|
||||
|
||||
/* callback function for CMAC algorithm
|
||||
*/
|
||||
typedef void (tCMAC_CMPL_CBACK)(UINT8 *p_mac, UINT16 tlen, UINT32 sign_counter);
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* API of SMP */
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_Init
|
||||
**
|
||||
** Description This function initializes the SMP unit.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_Init(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_Free
|
||||
**
|
||||
** Description This function de initializes the SMP unit.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_Free(void);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_SetTraceLevel
|
||||
**
|
||||
** Description This function sets the trace level for SMP. If called with
|
||||
** a value of 0xFF, it simply returns the current trace level.
|
||||
**
|
||||
** Returns The new or current trace level
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT8 SMP_SetTraceLevel (UINT8 new_level);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_Register
|
||||
**
|
||||
** Description This function register for the SMP service callback.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SMP_Register (tSMP_CALLBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_Pair
|
||||
**
|
||||
** Description This function is called to start a SMP pairing.
|
||||
**
|
||||
** Returns SMP_STARTED if bond started, else otherwise exception.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSMP_STATUS SMP_Pair (BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_BR_PairWith
|
||||
**
|
||||
** Description This function is called to start a SMP pairing over BR/EDR.
|
||||
**
|
||||
** Returns SMP_STARTED if pairing started, otherwise reason for failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tSMP_STATUS SMP_BR_PairWith (BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_PairCancel
|
||||
**
|
||||
** Description This function is called to cancel a SMP pairing.
|
||||
**
|
||||
** Returns TRUE - pairing cancelled
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SMP_PairCancel (BD_ADDR bd_addr);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_SecurityGrant
|
||||
**
|
||||
** Description This function is called to grant security process.
|
||||
**
|
||||
** Parameters bd_addr - peer device bd address.
|
||||
** res - result of the operation SMP_SUCCESS if success.
|
||||
** Otherwise, SMP_REPEATED_ATTEMPTS is too many attempts.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_SecurityGrant(BD_ADDR bd_addr, UINT8 res);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_PasskeyReply
|
||||
**
|
||||
** Description This function is called after Security Manager submitted
|
||||
** Passkey request to the application.
|
||||
**
|
||||
** Parameters: bd_addr - Address of the device for which PIN was requested
|
||||
** res - result of the operation SMP_SUCCESS if success
|
||||
** passkey - numeric value in the range of
|
||||
** BTM_MIN_PASSKEY_VAL(0) - BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_PasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_ConfirmReply
|
||||
**
|
||||
** Description This function is called after Security Manager submitted
|
||||
** numeric comparison request to the application.
|
||||
**
|
||||
** Parameters: bd_addr - Address of the device with which numeric
|
||||
** comparison was requested
|
||||
** res - comparison result SMP_SUCCESS if success
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_ConfirmReply (BD_ADDR bd_addr, UINT8 res);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_OobDataReply
|
||||
**
|
||||
** Description This function is called to provide the OOB data for
|
||||
** SMP in response to SMP_OOB_REQ_EVT
|
||||
**
|
||||
** Parameters: bd_addr - Address of the peer device
|
||||
** res - result of the operation SMP_SUCCESS if success
|
||||
** p_data - SM Randomizer C.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_OobDataReply(BD_ADDR bd_addr, tSMP_STATUS res, UINT8 len,
|
||||
UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_SecureConnectionOobDataReply
|
||||
**
|
||||
** Description This function is called to provide the SC OOB data for
|
||||
** SMP in response to SMP_SC_OOB_REQ_EVT
|
||||
**
|
||||
** Parameters: p_data - pointer to the data
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_SecureConnectionOobDataReply(UINT8 *p_data);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_Encrypt
|
||||
**
|
||||
** Description This function is called to encrypt the data with the specified
|
||||
** key
|
||||
**
|
||||
** Parameters: key - Pointer to key key[0] conatins the MSB
|
||||
** key_len - key length
|
||||
** plain_text - Pointer to data to be encrypted
|
||||
** plain_text[0] conatins the MSB
|
||||
** pt_len - plain text length
|
||||
** p_out - pointer to the encrypted outputs
|
||||
**
|
||||
** Returns Boolean - TRUE: encryption is successful
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SMP_Encrypt (UINT8 *key, UINT8 key_len,
|
||||
UINT8 *plain_text, UINT8 pt_len,
|
||||
tSMP_ENC *p_out);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_KeypressNotification
|
||||
**
|
||||
** Description This function is called to notify SM about Keypress Notification.
|
||||
**
|
||||
** Parameters: bd_addr - Address of the device to send keypress
|
||||
** notification to
|
||||
** value - keypress notification parameter value
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void SMP_KeypressNotification (BD_ADDR bd_addr, UINT8 value);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function SMP_CreateLocalSecureConnectionsOobData
|
||||
**
|
||||
** Description This function is called to start creation of local SC OOB
|
||||
** data set (tSMP_LOC_OOB_DATA).
|
||||
**
|
||||
** Parameters: bd_addr - Address of the device to send OOB data block
|
||||
** to.
|
||||
**
|
||||
** Returns Boolean - TRUE: creation of local SC OOB data set started.
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN SMP_CreateLocalSecureConnectionsOobData (
|
||||
tBLE_BD_ADDR *addr_to_send_to);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* SMP_API_H */
|
Reference in New Issue
Block a user