mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 12:30: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:
348
tools/build-release.sh
Executable file
348
tools/build-release.sh
Executable file
@ -0,0 +1,348 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################
|
||||
# $1 - download link
|
||||
# $2 - JSON output file
|
||||
function downloadAndMergePackageJSON()
|
||||
{
|
||||
echo " --- Package JSON definition merge BEGIN ---"
|
||||
|
||||
jsonLink=$1
|
||||
jsonOut=$2
|
||||
curlAuthToken=$3
|
||||
outDirectory=$4
|
||||
|
||||
echo "Remote package JSON: $jsonLink (source)"
|
||||
echo "Current package JSON: $jsonOut (target)"
|
||||
|
||||
old_json=$outDirectory/oldJson.json
|
||||
merged_json=$outDirectory/mergedJson.json
|
||||
|
||||
#DEBUG
|
||||
#echo " Local tmp for remote JSON: $old_json"
|
||||
#echo " Merge output JSON: $merged_json"
|
||||
|
||||
echo "Downloading JSON package definition: $jsonLink ..."
|
||||
|
||||
# Authentication through HTTP headers might fail on redirection due to bug in cURL (https://curl.haxx.se/docs/adv_2018-b3bf.html - headers are resent to the target location including the original authentication)
|
||||
# Notes:
|
||||
# - eg AmazonAWS fails with Bad Request due to having maximum 1 authentication mechanism per a request, might be general issue
|
||||
# - it's a first-class credential leakage
|
||||
# - the fix is available in cURL 7.58.0+, however, TravisCI is not yet updated (May 29, 2018) - see https://docs.travis-ci.com/user/build-environment-updates
|
||||
# - TravisCI workaround: updating build environment through .travis.yml (ie install required version of cURL using apt-get, see https://docs.travis-ci.com/user/installing-dependencies/)
|
||||
# - previous point not used on purpose (build time increase, possible failure corrupts whole build, etc) but it's good to know there's a way out of hell
|
||||
# - local workaround: authentication through 'access_token' as GET parameter works smoothly, however, HTTP headers are preferred
|
||||
|
||||
#curl --verbose -sH "Authorization: token $curlAuthToken" -L -o "$old_json" "$jsonLink"
|
||||
curl -L -o "$old_json" "$jsonLink?access_token=$curlAuthToken"
|
||||
|
||||
#curl -L -o "$old_json" "$jsonLink"
|
||||
|
||||
echo "Merging $old_json into $jsonOut ..."
|
||||
|
||||
echo
|
||||
set +e
|
||||
stdbuf -oL python package/merge_packages.py "$jsonOut" "$old_json" > "$merged_json"
|
||||
set -e #supposed to be ON by default
|
||||
echo
|
||||
|
||||
set -v
|
||||
if [ ! -s $merged_json ]; then
|
||||
rm -f "$merged_json"
|
||||
echo "Nothing to merge ($merged_json empty), $jsonOut unchanged"
|
||||
else
|
||||
rm -f "$jsonOut"
|
||||
mv "$merged_json" "$jsonOut"
|
||||
echo "Data successfully merged to $jsonOut"
|
||||
fi
|
||||
|
||||
rm -f "$old_json"
|
||||
set +v
|
||||
echo " --- Package JSON definition merge END ---"
|
||||
}
|
||||
############################################################
|
||||
|
||||
#Cmdline options
|
||||
# -a: GitHub API access token
|
||||
# -d: output directory to store the (pre)release filedir set
|
||||
|
||||
set -e
|
||||
|
||||
echo
|
||||
echo "==================================================================="
|
||||
echo "RELEASE PACKAGE PUBLISHING ARRANGEMENTS (GitHub/Arduino compliance)"
|
||||
echo "==================================================================="
|
||||
echo
|
||||
|
||||
# cURL authentication token
|
||||
while getopts ":a:,:d:" opt; do
|
||||
case $opt in
|
||||
a)
|
||||
curlAuth=$OPTARG
|
||||
echo "ACCESS TOKEN: $curlAuth" >&2
|
||||
;;
|
||||
d)
|
||||
releaseDir=$OPTARG
|
||||
echo "RELEASE OUTPUT DIRECTORY: $releaseDir" >&2
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# where we at?
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
echo "Non-TravisCI environment"
|
||||
cd "$( dirname ${BASH_SOURCE[0]} )"/..
|
||||
bTravisRun=0
|
||||
else
|
||||
echo "TravisCI run"
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
bTravisRun=1
|
||||
fi
|
||||
|
||||
# no tag, no love
|
||||
if [ -z "$TRAVIS_TAG" ] && [ $bTravisRun -eq 1 ]; then
|
||||
echo "Non-tagged builds not supported in Travis CI environment, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
currentDir=`pwd`
|
||||
echo "Current working directory: $currentDir"
|
||||
|
||||
srcdir=$currentDir
|
||||
|
||||
if [ -z "$releaseDir" ]; then
|
||||
releaseDir=release
|
||||
fi
|
||||
echo "Release output directory: $releaseDir"
|
||||
|
||||
|
||||
# get current branch name and commit hash
|
||||
branch_name=""
|
||||
verx=""
|
||||
extent=""
|
||||
|
||||
if [ -z "$TRAVIS_TAG" ]; then
|
||||
branch_name=`git rev-parse --abbrev-ref HEAD 2>/dev/null`
|
||||
ver=`sed -n -E 's/version=([0-9.]+)/\1/p' platform.txt`
|
||||
verx=`git rev-parse --short=8 HEAD 2>/dev/null`
|
||||
else
|
||||
ver=$TRAVIS_TAG
|
||||
fi
|
||||
|
||||
# Package name (case-insensitive)
|
||||
shopt -s nocasematch
|
||||
|
||||
if [ ! -z "$branch_name" ] && [ "$branch_name" != "master" ]; then
|
||||
extent="-$branch_name-$verx"
|
||||
fi
|
||||
|
||||
package_name=esp32-$ver$extent
|
||||
|
||||
shopt -u nocasematch
|
||||
|
||||
echo "Version: $ver"
|
||||
echo "Branch name: $branch_name"
|
||||
echo "Git revision (8B): $verx"
|
||||
echo "Extension: $extent"
|
||||
echo "Travis CI tag: $TRAVIS_TAG"
|
||||
echo "Package name: $package_name"
|
||||
|
||||
# Set REMOTE_URL environment variable to the address where the package will be
|
||||
# available for download. This gets written into package json file.
|
||||
|
||||
if [ -z "$REMOTE_URL" ]; then
|
||||
REMOTE_URL="http://localhost:8000"
|
||||
echo "REMOTE_URL not defined, using default"
|
||||
fi
|
||||
|
||||
echo "Remote: $REMOTE_URL"
|
||||
|
||||
# Create directory for the package
|
||||
outdir=$releaseDir/$package_name
|
||||
echo "Temporary output directory: $outdir"
|
||||
|
||||
rm -rf $releaseDir
|
||||
mkdir -p $outdir
|
||||
|
||||
# Copy package required stuff:
|
||||
|
||||
# <package root>
|
||||
cp -f $srcdir/boards.txt $outdir/
|
||||
cp -f $srcdir/platform.txt $outdir/
|
||||
cp -f $srcdir/programmers.txt $outdir/
|
||||
|
||||
# <complete dirs>
|
||||
# cores/
|
||||
# libraries/
|
||||
# variants/
|
||||
cp -Rf $srcdir/cores $outdir/
|
||||
cp -Rf $srcdir/libraries $outdir/
|
||||
cp -Rf $srcdir/variants $outdir/
|
||||
|
||||
# <dir & files>
|
||||
# tools/partitions/
|
||||
mkdir -p $outdir/tools/partitions
|
||||
cp -f $srcdir/tools/partitions/boot_app0.bin $outdir/tools/partitions
|
||||
cp -f $srcdir/tools/partitions/default.csv $outdir/tools/partitions
|
||||
cp -f $srcdir/tools/partitions/minimal.csv $outdir/tools/partitions
|
||||
cp -f $srcdir/tools/partitions/min_spiffs.csv $outdir/tools/partitions
|
||||
cp -f $srcdir/tools/partitions/no_ota.csv $outdir/tools/partitions
|
||||
|
||||
# tools/sdk/
|
||||
cp -Rf $srcdir/tools/sdk $outdir/tools/
|
||||
|
||||
# tools/
|
||||
cp -f $srcdir/tools/espota.exe $outdir/tools/
|
||||
cp -f $srcdir/tools/espota.py $outdir/tools/
|
||||
cp -f $srcdir/tools/esptool.py $outdir/tools/
|
||||
cp -f $srcdir/tools/gen_esp32part.py $outdir/tools/
|
||||
cp -f $srcdir/tools/gen_esp32part.exe $outdir/tools/
|
||||
|
||||
find $outdir -name '*.DS_Store' -exec rm -f {} \;
|
||||
|
||||
# Do some replacements in platform.txt file, which are required because IDE
|
||||
# handles tool paths differently when package is installed in hardware folder
|
||||
cat $srcdir/platform.txt | \
|
||||
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \
|
||||
sed 's/tools.esptool.path={runtime.platform.path}\/tools\/esptool/tools.esptool.path=\{runtime.tools.esptool.path\}/g' \
|
||||
> $outdir/platform.txt
|
||||
|
||||
# Put core version and short hash of git version into core_version.h
|
||||
ver_define=`echo $plain_ver | tr "[:lower:].\055" "[:upper:]_"`
|
||||
echo Ver define: $ver_define
|
||||
echo \#define ARDUINO_ESP32_GIT_VER 0x`git rev-parse --short=8 HEAD 2>/dev/null` >$outdir/cores/esp32/core_version.h
|
||||
echo \#define ARDUINO_ESP32_GIT_DESC `git describe --tags 2>/dev/null` >>$outdir/cores/esp32/core_version.h
|
||||
echo \#define ARDUINO_ESP32_RELEASE_$ver_define >>$outdir/cores/esp32/core_version.h
|
||||
echo \#define ARDUINO_ESP32_RELEASE \"$ver_define\" >>$outdir/cores/esp32/core_version.h
|
||||
|
||||
# Store submodules' current versions
|
||||
git submodule status > $releaseDir/submodules.txt
|
||||
|
||||
# remove all .git* files
|
||||
find $outdir -name '*.git*' -type f -delete
|
||||
|
||||
# Zip the package
|
||||
package_name_zip=$package_name.zip
|
||||
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Making $package_name ZIP archive..."
|
||||
echo
|
||||
|
||||
pushd $releaseDir >/dev/null
|
||||
|
||||
zip -qr $package_name_zip $package_name
|
||||
|
||||
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Making $package_name JSON definition file(s)..."
|
||||
echo
|
||||
|
||||
# Calculate SHA sum and size
|
||||
sha=`shasum -a 256 $package_name_zip | cut -f 1 -d ' '`
|
||||
size=`/bin/ls -l $package_name_zip | awk '{print $5}'`
|
||||
echo Size: $size
|
||||
echo SHA-256: $sha
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
PACKAGE_JSON_DEV="package_esp32_dev_index.json"
|
||||
PACKAGE_JSON_REL="package_esp32_index.json"
|
||||
|
||||
# figure out the package type (release / pre-release)
|
||||
shopt -s nocasematch
|
||||
if [[ $TRAVIS_TAG == *-RC* ]]; then
|
||||
bIsPrerelease=1
|
||||
package_name_json=$PACKAGE_JSON_DEV
|
||||
echo "Package type: PRE-RELEASE, JSON def.file: $PACKAGE_JSON_DEV"
|
||||
else
|
||||
bIsPrerelease=0
|
||||
package_name_json=$PACKAGE_JSON_REL
|
||||
echo "Package type: RELEASE, JSON def.files: $PACKAGE_JSON_REL, $PACKAGE_JSON_DEV"
|
||||
fi
|
||||
shopt -u nocasematch
|
||||
|
||||
# Generate JSON package definition
|
||||
echo
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Preparing current package definition ($package_name_json)..."
|
||||
|
||||
# JSON contents
|
||||
jq_arg=".packages[0].platforms[0].version = \"$ver\" | \
|
||||
.packages[0].platforms[0].url = \"$REMOTE_URL/$package_name_zip\" |\
|
||||
.packages[0].platforms[0].archiveFileName = \"$package_name_zip\""
|
||||
|
||||
jq_arg="$jq_arg |\
|
||||
.packages[0].platforms[0].size = \"$size\" |\
|
||||
.packages[0].platforms[0].checksum = \"SHA-256:$sha\""
|
||||
|
||||
|
||||
# Cleanup temporary work dir
|
||||
rm -rf $outdir
|
||||
|
||||
|
||||
# Get previous release name
|
||||
echo
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Getting previous releases versions..."
|
||||
|
||||
releasesJson=$releaseDir/releases.json
|
||||
|
||||
curl -sH "Authorization: token $curlAuth" https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases > $releasesJson
|
||||
|
||||
# Previous final release (prerelase == false)
|
||||
prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
|
||||
# Previous release (possibly a pre-release)
|
||||
prev_any_release=$(jq -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
|
||||
# Previous pre-release
|
||||
prev_pre_release=$(jq -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' ${releasesJson})
|
||||
|
||||
rm -f "$releasesJson"
|
||||
|
||||
echo "Previous release: $prev_release"
|
||||
echo "Previous (pre-?)release: $prev_any_release"
|
||||
echo "Previous pre-release: $prev_pre_release"
|
||||
|
||||
# always get DEV version of JSON (included in both RC/REL)
|
||||
echo
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Generating $PACKAGE_JSON_DEV..."
|
||||
echo
|
||||
|
||||
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $releaseDir/$PACKAGE_JSON_DEV
|
||||
if [ ! -z "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then
|
||||
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_any_release}/${PACKAGE_JSON_DEV}" "$releaseDir/${PACKAGE_JSON_DEV}" "${curlAuth}" "$releaseDir"
|
||||
|
||||
# Release notes: GIT log comments (prev_any_release, current_release>
|
||||
git log --oneline $prev_any_release.. > $releaseDir/commits.txt
|
||||
fi
|
||||
|
||||
# for RELEASE run update REL JSON as well
|
||||
if [ $bIsPrerelease -eq 0 ]; then
|
||||
|
||||
echo
|
||||
echo "----------------------------------------------------------"
|
||||
echo "Generating $PACKAGE_JSON_REL..."
|
||||
echo
|
||||
|
||||
cat $srcdir/package/package_esp32_index.template.json | jq "$jq_arg" > $releaseDir/$PACKAGE_JSON_REL
|
||||
if [ ! -z "$prev_release" ] && [ "$prev_release" != "null" ]; then
|
||||
downloadAndMergePackageJSON "https://github.com/$TRAVIS_REPO_SLUG/releases/download/${prev_release}/${PACKAGE_JSON_REL}" "$releaseDir/${PACKAGE_JSON_REL}" "${curlAuth}" "$releaseDir"
|
||||
|
||||
# Release notes: GIT log comments (prev_release, current_release>
|
||||
git log --oneline $prev_release.. > $releaseDir/commits.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=============================================================="
|
||||
echo "Package '$package_name' ready for publishing, script finished."
|
||||
echo "=============================================================="
|
||||
echo
|
53
tools/build-tests.sh
Executable file
53
tools/build-tests.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
#- set -e
|
||||
|
||||
if [ ! -z "$TRAVIS_TAG" ]; then
|
||||
echo "No sketch builds & tests required for tagged TravisCI builds, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "travis_fold:start:sketch_test_env_prepare"
|
||||
pip install pyserial
|
||||
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
||||
tar xf arduino.tar.xz
|
||||
mv arduino-nightly $HOME/arduino_ide
|
||||
mkdir -p $HOME/Arduino/libraries
|
||||
cd $HOME/arduino_ide/hardware
|
||||
mkdir espressif
|
||||
cd espressif
|
||||
ln -s $TRAVIS_BUILD_DIR esp32
|
||||
cd esp32
|
||||
git submodule update --init --recursive
|
||||
cd tools
|
||||
python get.py
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin:$PATH"
|
||||
source tools/common.sh
|
||||
echo -e "travis_fold:end:sketch_test_env_prepare"
|
||||
|
||||
echo -e "travis_fold:start:sketch_test"
|
||||
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:sketch_test"
|
||||
|
||||
echo -e "travis_fold:start:size_report"
|
||||
cat size.log
|
||||
echo -e "travis_fold:end:size_report"
|
||||
|
||||
echo -e "travis_fold:start:platformio_test_env_prepare"
|
||||
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
|
||||
platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
|
||||
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' ~/.platformio/platforms/espressif32/platform.json && \
|
||||
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif32
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:platformio_test_env_prepare"
|
||||
|
||||
echo -e "travis_fold:start:platformio_test"
|
||||
platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
|
||||
platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
|
||||
platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
|
||||
platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
|
||||
platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
echo -e "travis_fold:end:platformio_test"
|
12
tools/build.sh
Executable file
12
tools/build.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run cmake tests
|
||||
tools/check_cmakelists.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# run sketch tests
|
||||
tools/build-tests.sh
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
|
||||
# zip the package if tagged build, otherwise finish here
|
||||
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
|
147
tools/deploy.sh
Normal file
147
tools/deploy.sh
Normal file
@ -0,0 +1,147 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
#Cmdline options
|
||||
# -t: tag (*_RC* determines prerelease version, can be overriden be -p)
|
||||
# -a: GitHub API access token
|
||||
# -s: GitHub repository slug (user/repo)
|
||||
# -p: prerelease true/false
|
||||
# -f: files to upload (ie assets. delim = ';', must come quoted)
|
||||
# -d: directory to upload (by adding dir contents to assets)
|
||||
while getopts ":t:,:a:,:s:,:p:,:f:,:d:" opt; do
|
||||
case $opt in
|
||||
t)
|
||||
varTagName=$OPTARG
|
||||
echo "TAG: $varTagName" >&2
|
||||
;;
|
||||
a)
|
||||
varAccessToken=$OPTARG
|
||||
echo "ACCESS TOKEN: $varAccessToken" >&2
|
||||
;;
|
||||
s)
|
||||
varRepoSlug=$OPTARG
|
||||
echo "REPO SLUG: $varRepoSlug" >&2
|
||||
;;
|
||||
p)
|
||||
varPrerelease=$OPTARG
|
||||
echo "PRERELEASE: $varPrerelease" >&2
|
||||
;;
|
||||
f)
|
||||
varAssets=$OPTARG
|
||||
echo "ASSETS: $varAssets" >&2
|
||||
;;
|
||||
d)
|
||||
varAssetsDir=$OPTARG
|
||||
echo "ASSETS DIR: $varAssetsDir" >&2
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#Check tag name for release/prerelease (prerelease tag contains '_RC' as for release-candidate. case-insensitive)
|
||||
shopt -s nocasematch
|
||||
if [ -z $varPrerelease ]; then
|
||||
if [[ $varTagName == *-RC* ]]; then
|
||||
varPrerelease=true
|
||||
else
|
||||
varPrerelease=false
|
||||
fi
|
||||
fi
|
||||
shopt -u nocasematch
|
||||
|
||||
#
|
||||
# Prepare Markdown release notes:
|
||||
#################################
|
||||
#
|
||||
# - tag's description:
|
||||
# ignore first 3 lines - commiter, tagname, blank
|
||||
# first line of message: heading
|
||||
# other lines: converted to bullets
|
||||
# empty lines ignored
|
||||
# if '* ' found as a first char pair, it's converted to '- ' to keep bulleting unified
|
||||
relNotesRaw=`git show -s --format=%b $varTagName`
|
||||
readarray -t msgArray <<<"$relNotesRaw"
|
||||
|
||||
arrLen=${#msgArray[@]}
|
||||
if [ $arrLen > 3 ]; then
|
||||
ind=3
|
||||
while [ $ind -lt $arrLen ]; do
|
||||
if [ $ind -eq 3 ]; then
|
||||
releaseNotes="#### ${msgArray[ind]}\\n"
|
||||
else
|
||||
oneLine="$(echo -e "${msgArray[ind]}" | sed -e 's/^[[:space:]]*//')"
|
||||
|
||||
if [ ${#oneLine} -gt 0 ]; then
|
||||
if [ "${oneLine:0:2}" == "* " ]; then oneLine=$(echo ${oneLine/\*/-}); fi
|
||||
if [ "${oneLine:0:2}" != "- " ]; then releaseNotes+="- "; fi
|
||||
releaseNotes+="$oneLine\\n"
|
||||
fi
|
||||
fi
|
||||
let ind=$ind+1
|
||||
done
|
||||
else
|
||||
releaseNotes="#### Release of $varTagName\\n"
|
||||
fi
|
||||
|
||||
# - list of commits (commits.txt must exit in the output dir)
|
||||
commitFile=$varAssetsDir/commits.txt
|
||||
if [ -e "$commitFile" ]; then
|
||||
|
||||
releaseNotes+="\\n##### Commits\\n"
|
||||
|
||||
IFS=$'\n'
|
||||
for next in `cat $commitFile`
|
||||
do
|
||||
IFS=' ' read -r commitId commitMsg <<< "$next"
|
||||
releaseNotes+="- [$commitId](https://github.com/$varRepoSlug/commit/$commitId) $commitMsg\\n"
|
||||
done
|
||||
rm -f $commitFile
|
||||
fi
|
||||
|
||||
releaseNotes=$(perl -pe 's/\r?\n/\\n/' <<< ${releaseNotes})
|
||||
|
||||
#JSON parameters to create a new release
|
||||
curlData="{\"tag_name\": \"$varTagName\",\"target_commitish\": \"master\",\"name\": \"v$varTagName\",\"body\": \"$releaseNotes\",\"draft\": false,\"prerelease\": $varPrerelease}"
|
||||
|
||||
#Create the release (initial source file assets created by GitHub)
|
||||
releaseId=$(curl --data "$curlData" https://api.github.com/repos/$varRepoSlug/releases?access_token=$varAccessToken | jq -r '.id')
|
||||
echo Release ID: $releaseId
|
||||
|
||||
# Assets defined by dir contents
|
||||
if [ ! -z $varAssetsDir ]; then
|
||||
varAssetsTemp=$(ls -p $varAssetsDir | grep -v / | tr '\n' ';')
|
||||
for item in $(echo $varAssetsTemp | tr ";" "\n")
|
||||
do
|
||||
varAssets+=$varAssetsDir/$item;
|
||||
varAssets+=';'
|
||||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo varAssets: $varAssets
|
||||
|
||||
#Upload additional assets
|
||||
if [ ! -z $varAssets ]; then
|
||||
curlAuth="Authorization: token $varAccessToken"
|
||||
for filename in $(echo $varAssets | tr ";" "\n")
|
||||
do
|
||||
echo
|
||||
echo
|
||||
echo Uploading $filename...
|
||||
|
||||
curl -X POST -sH "$curlAuth" -H "Content-Type: application/octet-stream" --data-binary @"$filename" https://uploads.github.com/repos/$varRepoSlug/releases/$releaseId/assets?name=$(basename $filename)
|
||||
done
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
|
||||
|
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Converts partition tables to/from CSV and binary formats.
|
||||
#
|
||||
# See http://esp-idf.readthedocs.io/en/latest/api-guides/partition-tables.html
|
||||
# See https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/partition-tables.html
|
||||
# for explanation of partition table structure and uses.
|
||||
#
|
||||
# Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
@ -31,11 +31,38 @@ import binascii
|
||||
|
||||
MAX_PARTITION_LENGTH = 0xC00 # 3K for partition data (96 entries) leaves 1K in a 4K sector for signature
|
||||
MD5_PARTITION_BEGIN = b"\xEB\xEB" + b"\xFF" * 14 # The first 2 bytes are like magic numbers for MD5 sum
|
||||
PARTITION_TABLE_SIZE = 0x1000 # Size of partition table
|
||||
|
||||
__version__ = '1.0'
|
||||
__version__ = '1.2'
|
||||
|
||||
APP_TYPE = 0x00
|
||||
DATA_TYPE = 0x01
|
||||
|
||||
TYPES = {
|
||||
"app" : APP_TYPE,
|
||||
"data" : DATA_TYPE,
|
||||
}
|
||||
|
||||
# Keep this map in sync with esp_partition_subtype_t enum in esp_partition.h
|
||||
SUBTYPES = {
|
||||
APP_TYPE : {
|
||||
"factory" : 0x00,
|
||||
"test" : 0x20,
|
||||
},
|
||||
DATA_TYPE : {
|
||||
"ota" : 0x00,
|
||||
"phy" : 0x01,
|
||||
"nvs" : 0x02,
|
||||
"coredump" : 0x03,
|
||||
"esphttpd" : 0x80,
|
||||
"fat" : 0x81,
|
||||
"spiffs" : 0x82,
|
||||
},
|
||||
}
|
||||
|
||||
quiet = False
|
||||
md5sum = True
|
||||
offset_part_table = 0
|
||||
|
||||
def status(msg):
|
||||
""" Print status message to stderr """
|
||||
@ -44,9 +71,8 @@ def status(msg):
|
||||
|
||||
def critical(msg):
|
||||
""" Print critical message to stderr """
|
||||
if not quiet:
|
||||
sys.stderr.write(msg)
|
||||
sys.stderr.write('\n')
|
||||
sys.stderr.write(msg)
|
||||
sys.stderr.write('\n')
|
||||
|
||||
class PartitionTable(list):
|
||||
def __init__(self):
|
||||
@ -77,10 +103,13 @@ class PartitionTable(list):
|
||||
raise
|
||||
|
||||
# fix up missing offsets & negative sizes
|
||||
last_end = 0x5000 # first offset after partition table
|
||||
last_end = offset_part_table + PARTITION_TABLE_SIZE # first offset after partition table
|
||||
for e in res:
|
||||
if offset_part_table != 0 and e.offset is not None and e.offset < last_end:
|
||||
critical("WARNING: 0x%x address in the partition table is below 0x%x" % (e.offset, last_end))
|
||||
e.offset = None
|
||||
if e.offset is None:
|
||||
pad_to = 0x10000 if e.type == PartitionDefinition.APP_TYPE else 4
|
||||
pad_to = 0x10000 if e.type == APP_TYPE else 4
|
||||
if last_end % pad_to != 0:
|
||||
last_end += pad_to - (last_end % pad_to)
|
||||
e.offset = last_end
|
||||
@ -101,6 +130,36 @@ class PartitionTable(list):
|
||||
else:
|
||||
return super(PartitionTable, self).__getitem__(item)
|
||||
|
||||
def find_by_type(self, ptype, subtype):
|
||||
""" Return a partition by type & subtype, returns
|
||||
None if not found """
|
||||
# convert ptype & subtypes names (if supplied this way) to integer values
|
||||
try:
|
||||
ptype = TYPES[ptype]
|
||||
except KeyError:
|
||||
try:
|
||||
ptypes = int(ptype, 0)
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
subtype = SUBTYPES[int(ptype)][subtype]
|
||||
except KeyError:
|
||||
try:
|
||||
ptypes = int(ptype, 0)
|
||||
except TypeError:
|
||||
pass
|
||||
|
||||
for p in self:
|
||||
if p.type == ptype and p.subtype == subtype:
|
||||
return p
|
||||
return None
|
||||
|
||||
def find_by_name(self, name):
|
||||
for p in self:
|
||||
if p.name == name:
|
||||
return p
|
||||
return None
|
||||
|
||||
def verify(self):
|
||||
# verify each partition individually
|
||||
for p in self:
|
||||
@ -108,12 +167,22 @@ class PartitionTable(list):
|
||||
# check for overlaps
|
||||
last = None
|
||||
for p in sorted(self, key=lambda x:x.offset):
|
||||
if p.offset < 0x5000:
|
||||
raise InputError("Partition offset 0x%x is below 0x5000" % p.offset)
|
||||
if p.offset < offset_part_table + PARTITION_TABLE_SIZE:
|
||||
raise InputError("Partition offset 0x%x is below 0x%x" % (p.offset, offset_part_table + PARTITION_TABLE_SIZE))
|
||||
if last is not None and p.offset < last.offset + last.size:
|
||||
raise InputError("Partition at 0x%x overlaps 0x%x-0x%x" % (p.offset, last.offset, last.offset+last.size-1))
|
||||
last = p
|
||||
|
||||
def flash_size(self):
|
||||
""" Return the size that partitions will occupy in flash
|
||||
(ie the offset the last partition ends at)
|
||||
"""
|
||||
try:
|
||||
last = sorted(self, reverse=True)[0]
|
||||
except IndexError:
|
||||
return 0 # empty table!
|
||||
return last.offset + last.size
|
||||
|
||||
@classmethod
|
||||
def from_binary(cls, b):
|
||||
md5 = hashlib.md5();
|
||||
@ -150,30 +219,6 @@ class PartitionTable(list):
|
||||
return "\n".join(rows) + "\n"
|
||||
|
||||
class PartitionDefinition(object):
|
||||
APP_TYPE = 0x00
|
||||
DATA_TYPE = 0x01
|
||||
TYPES = {
|
||||
"app" : APP_TYPE,
|
||||
"data" : DATA_TYPE,
|
||||
}
|
||||
|
||||
# Keep this map in sync with esp_partition_subtype_t enum in esp_partition.h
|
||||
SUBTYPES = {
|
||||
APP_TYPE : {
|
||||
"factory" : 0x00,
|
||||
"test" : 0x20,
|
||||
},
|
||||
DATA_TYPE : {
|
||||
"ota" : 0x00,
|
||||
"phy" : 0x01,
|
||||
"nvs" : 0x02,
|
||||
"coredump" : 0x03,
|
||||
"esphttpd" : 0x80,
|
||||
"fat" : 0x81,
|
||||
"spiffs" : 0x82,
|
||||
},
|
||||
}
|
||||
|
||||
MAGIC_BYTES = b"\xAA\x50"
|
||||
|
||||
ALIGNMENT = {
|
||||
@ -187,7 +232,7 @@ class PartitionDefinition(object):
|
||||
"encrypted" : 0
|
||||
}
|
||||
|
||||
# add subtypes for the 16 OTA slot values ("ota_XXX, etc.")
|
||||
# add subtypes for the 16 OTA slot values ("ota_XX, etc.")
|
||||
for ota_slot in range(16):
|
||||
SUBTYPES[TYPES["app"]]["ota_%d" % ota_slot] = 0x10 + ota_slot
|
||||
|
||||
@ -240,15 +285,27 @@ class PartitionDefinition(object):
|
||||
def __cmp__(self, other):
|
||||
return self.offset - other.offset
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.offset < other.offset
|
||||
|
||||
def __gt__(self, other):
|
||||
return self.offset > other.offset
|
||||
|
||||
def __le__(self, other):
|
||||
return self.offset <= other.offset
|
||||
|
||||
def __ge__(self, other):
|
||||
return self.offset >= other.offset
|
||||
|
||||
def parse_type(self, strval):
|
||||
if strval == "":
|
||||
raise InputError("Field 'type' can't be left empty.")
|
||||
return parse_int(strval, self.TYPES)
|
||||
return parse_int(strval, TYPES)
|
||||
|
||||
def parse_subtype(self, strval):
|
||||
if strval == "":
|
||||
return 0 # default
|
||||
return parse_int(strval, self.SUBTYPES.get(self.type, {}))
|
||||
return parse_int(strval, SUBTYPES.get(self.type, {}))
|
||||
|
||||
def parse_address(self, strval):
|
||||
if strval == "":
|
||||
@ -268,6 +325,14 @@ class PartitionDefinition(object):
|
||||
if self.size is None:
|
||||
raise ValidationError(self, "Size field is not set")
|
||||
|
||||
if self.name in TYPES and TYPES.get(self.name, "") != self.type:
|
||||
critical("WARNING: Partition has name '%s' which is a partition type, but does not match this partition's type (0x%x). Mistake in partition table?" % (self.name, self.type))
|
||||
all_subtype_names = []
|
||||
for names in (t.keys() for t in SUBTYPES.values()):
|
||||
all_subtype_names += names
|
||||
if self.name in all_subtype_names and SUBTYPES.get(self.type, {}).get(self.name, "") != self.subtype:
|
||||
critical("WARNING: Partition has name '%s' which is a partition subtype, but this partition has non-matching type 0x%x and subtype 0x%x. Mistake in partition table?" % (self.name, self.type, self.subtype))
|
||||
|
||||
STRUCT_FORMAT = "<2sBBLL16sL"
|
||||
|
||||
@classmethod
|
||||
@ -321,8 +386,8 @@ class PartitionDefinition(object):
|
||||
return ":".join(self.get_flags_list())
|
||||
|
||||
return ",".join([ self.name,
|
||||
lookup_keyword(self.type, self.TYPES),
|
||||
lookup_keyword(self.subtype, self.SUBTYPES.get(self.type, {})),
|
||||
lookup_keyword(self.type, TYPES),
|
||||
lookup_keyword(self.subtype, SUBTYPES.get(self.type, {})),
|
||||
addr_format(self.offset, False),
|
||||
addr_format(self.size, True),
|
||||
generate_text_flags()])
|
||||
@ -348,21 +413,26 @@ def parse_int(v, keywords={}):
|
||||
def main():
|
||||
global quiet
|
||||
global md5sum
|
||||
global offset_part_table
|
||||
parser = argparse.ArgumentParser(description='ESP32 partition table utility')
|
||||
|
||||
parser.add_argument('--flash-size', help='Optional flash size limit, checks partition table fits in flash',
|
||||
nargs='?', choices=[ '1MB', '2MB', '4MB', '8MB', '16MB' ])
|
||||
parser.add_argument('--disable-md5sum', help='Disable md5 checksum for the partition table', default=False, action='store_true')
|
||||
parser.add_argument('--verify', '-v', help='Verify partition table fields', default=True, action='store_false')
|
||||
parser.add_argument('--quiet', '-q', help="Don't print status messages to stderr", action='store_true')
|
||||
|
||||
parser.add_argument('input', help='Path to CSV or binary file to parse. Will use stdin if omitted.', type=argparse.FileType('rb'), default=sys.stdin)
|
||||
parser.add_argument('output', help='Path to output converted binary or CSV file. Will use stdout if omitted, unless the --display argument is also passed (in which case only the summary is printed.)',
|
||||
nargs='?',
|
||||
default='-')
|
||||
parser.add_argument('--no-verify', help="Don't verify partition table fields", action='store_true')
|
||||
parser.add_argument('--verify', '-v', help="Verify partition table fields (deprecated, this behaviour is enabled by default and this flag does nothing.", action='store_true')
|
||||
parser.add_argument('--quiet', '-q', help="Don't print non-critical status messages to stderr", action='store_true')
|
||||
parser.add_argument('--offset', '-o', help='Set offset partition table', default='0x8000')
|
||||
|
||||
parser.add_argument('input', help='Path to CSV or binary file to parse.', type=argparse.FileType('rb'))
|
||||
parser.add_argument('output', help='Path to output converted binary or CSV file. Will use stdout if omitted.',
|
||||
nargs='?', default='-')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
quiet = args.quiet
|
||||
md5sum = not args.disable_md5sum
|
||||
offset_part_table = int(args.offset, 0)
|
||||
input = args.input.read()
|
||||
input_is_binary = input[0:2] == PartitionDefinition.MAGIC_BYTES
|
||||
if input_is_binary:
|
||||
@ -373,17 +443,29 @@ def main():
|
||||
status("Parsing CSV input...")
|
||||
table = PartitionTable.from_csv(input)
|
||||
|
||||
if args.verify:
|
||||
if not args.no_verify:
|
||||
status("Verifying table...")
|
||||
table.verify()
|
||||
|
||||
if args.flash_size:
|
||||
size_mb = int(args.flash_size.replace("MB", ""))
|
||||
size = size_mb * 1024 * 1024 # flash memory uses honest megabytes!
|
||||
table_size = table.flash_size()
|
||||
if size < table_size:
|
||||
raise InputError("Partitions defined in '%s' occupy %.1fMB of flash (%d bytes) which does not fit in configured flash size %dMB. Change the flash size in menuconfig under the 'Serial Flasher Config' menu." %
|
||||
(args.input.name, table_size / 1024.0 / 1024.0, table_size, size_mb))
|
||||
|
||||
if input_is_binary:
|
||||
output = table.to_csv()
|
||||
with sys.stdout if args.output == '-' else open(args.output, 'w') as f:
|
||||
f.write(output)
|
||||
else:
|
||||
output = table.to_binary()
|
||||
with sys.stdout.buffer if args.output == '-' else open(args.output, 'wb') as f:
|
||||
try:
|
||||
stdout_binary = sys.stdout.buffer # Python 3
|
||||
except AttributeError:
|
||||
stdout_binary = sys.stdout
|
||||
with stdout_binary if args.output == '-' else open(args.output, 'wb') as f:
|
||||
f.write(output)
|
||||
|
||||
|
||||
|
@ -56,6 +56,7 @@ env.Prepend(
|
||||
CPPPATH=[
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bluedroid"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bluedroid", "api"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_trace"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_update"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bootloader_support"),
|
||||
@ -63,6 +64,8 @@ env.Prepend(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "driver"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp32"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_adc_cal"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp_http_client"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp-tls"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ethernet"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "fatfs"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "freertos"),
|
||||
@ -77,6 +80,7 @@ env.Prepend(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "openssl"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spi_flash"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "sdmmc"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "smartconfig_ack"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spiffs"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcpip_adapter"),
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "include", "ulp"),
|
||||
@ -99,7 +103,7 @@ env.Prepend(
|
||||
join(FRAMEWORK_DIR, "tools", "sdk", "ld")
|
||||
],
|
||||
LIBS=[
|
||||
"gcc", "openssl", "btdm_app", "fatfs", "wps", "coexist", "wear_levelling", "hal", "newlib", "driver", "bootloader_support", "pp", "mesh", "smartconfig", "jsmn", "wpa", "ethernet", "phy", "app_trace", "console", "ulp", "wpa_supplicant", "freertos", "bt", "micro-ecc", "cxx", "xtensa-debug-module", "mdns", "vfs", "soc", "core", "sdmmc", "coap", "tcpip_adapter", "c_nano", "rtc", "spi_flash", "wpa2", "esp32", "app_update", "nghttp", "spiffs", "espnow", "nvs_flash", "esp_adc_cal", "log", "expat", "m", "c", "heap", "mbedtls", "lwip", "net80211", "pthread", "json", "stdc++"
|
||||
"gcc", "openssl", "btdm_app", "fatfs", "wps", "coexist", "wear_levelling", "esp_http_client", "hal", "newlib", "driver", "bootloader_support", "pp", "mesh", "smartconfig", "jsmn", "wpa", "ethernet", "phy", "app_trace", "console", "ulp", "wpa_supplicant", "freertos", "bt", "micro-ecc", "cxx", "xtensa-debug-module", "mdns", "vfs", "soc", "core", "sdmmc", "coap", "tcpip_adapter", "c_nano", "esp-tls", "rtc", "spi_flash", "wpa2", "esp32", "app_update", "nghttp", "spiffs", "espnow", "nvs_flash", "esp_adc_cal", "log", "smartconfig_ack", "expat", "m", "c", "heap", "mbedtls", "lwip", "net80211", "pthread", "json", "stdc++"
|
||||
]
|
||||
)
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
tools/sdk/include/app_trace/esp_ota_ops.h
Executable file → Normal file
0
tools/sdk/include/app_trace/esp_ota_ops.h
Executable file → Normal file
0
tools/sdk/include/app_update/esp_ota_ops.h
Executable file → Normal file
0
tools/sdk/include/app_update/esp_ota_ops.h
Executable file → Normal file
@ -24,7 +24,7 @@
|
||||
#ifndef A2D_INT_H
|
||||
#define A2D_INT_H
|
||||
|
||||
#include "a2d_api.h"
|
||||
#include "stack/a2d_api.h"
|
||||
#if (A2D_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
|
@ -48,9 +48,9 @@ typedef enum {
|
||||
ESP_BT_STATUS_UNACCEPT_CONN_INTERVAL, /* relate to BT_UNACCEPT_CONN_INTERVAL in bt_def.h */
|
||||
ESP_BT_STATUS_PARAM_OUT_OF_RANGE, /* relate to BT_PARAM_OUT_OF_RANGE in bt_def.h */
|
||||
ESP_BT_STATUS_TIMEOUT, /* relate to BT_STATUS_TIMEOUT in bt_def.h */
|
||||
ESP_BT_STATUS_PEER_LE_DATA_LEN_UNSUPPORTED, /* relate to BTM_PEER_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* relate to BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED in btm_api.h */
|
||||
ESP_BT_STATUS_ERR_ILLEGAL_PARAMETER_FMT, /* relate to HCI_ERR_ILLEGAL_PARAMETER_FMT in hcidefs.h */
|
||||
ESP_BT_STATUS_PEER_LE_DATA_LEN_UNSUPPORTED, /* relate to BTM_PEER_LE_DATA_LEN_UNSUPPORTED in stack/btm_api.h */
|
||||
ESP_BT_STATUS_CONTROL_LE_DATA_LEN_UNSUPPORTED,/* relate to BTM_CONTROL_LE_DATA_LEN_UNSUPPORTED in stack/btm_api.h */
|
||||
ESP_BT_STATUS_ERR_ILLEGAL_PARAMETER_FMT, /* relate to HCI_ERR_ILLEGAL_PARAMETER_FMT in stack/hcidefs.h */
|
||||
ESP_BT_STATUS_MEMORY_FULL, /* relate to BT_STATUS_MEMORY_FULL in bt_def.h */
|
||||
} esp_bt_status_t;
|
||||
|
||||
@ -67,13 +67,13 @@ typedef uint8_t esp_link_key[ESP_BT_OCTET16_LEN]; /* Link Key */
|
||||
/// Default GATT interface id
|
||||
#define ESP_DEFAULT_GATT_IF 0xff
|
||||
|
||||
#define ESP_BLE_CONN_INT_MIN 0x0006 /*!< relate to BTM_BLE_CONN_INT_MIN in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_INT_MAX 0x0C80 /*!< relate to BTM_BLE_CONN_INT_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_LATENCY_MAX 500 /*!< relate to ESP_BLE_CONN_LATENCY_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MIN 0x000A /*!< relate to BTM_BLE_CONN_SUP_TOUT_MIN in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MAX 0x0C80 /*!< relate to ESP_BLE_CONN_SUP_TOUT_MAX in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ /* relate to ESP_BLE_CONN_PARAM_UNDEF in btm_ble_api.h */
|
||||
#define ESP_BLE_SCAN_PARAM_UNDEF 0xffffffff /* relate to ESP_BLE_SCAN_PARAM_UNDEF in btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_INT_MIN 0x0006 /*!< relate to BTM_BLE_CONN_INT_MIN in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_INT_MAX 0x0C80 /*!< relate to BTM_BLE_CONN_INT_MAX in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_LATENCY_MAX 500 /*!< relate to ESP_BLE_CONN_LATENCY_MAX in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MIN 0x000A /*!< relate to BTM_BLE_CONN_SUP_TOUT_MIN in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_SUP_TOUT_MAX 0x0C80 /*!< relate to ESP_BLE_CONN_SUP_TOUT_MAX in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */ /* relate to ESP_BLE_CONN_PARAM_UNDEF in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_SCAN_PARAM_UNDEF 0xffffffff /* relate to ESP_BLE_SCAN_PARAM_UNDEF in stack/btm_ble_api.h */
|
||||
|
||||
/// Check the param is valid or not
|
||||
#define ESP_BLE_IS_VALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) || ((x) == ESP_BLE_CONN_PARAM_UNDEF))
|
||||
@ -113,13 +113,13 @@ typedef enum {
|
||||
} esp_ble_addr_type_t;
|
||||
|
||||
/// Used to exchange the encrytyption key in the init key & response key
|
||||
#define ESP_BLE_ENC_KEY_MASK (1 << 0) /* relate to BTM_BLE_ENC_KEY_MASK in btm_api.h */
|
||||
#define ESP_BLE_ENC_KEY_MASK (1 << 0) /* relate to BTM_BLE_ENC_KEY_MASK in stack/btm_api.h */
|
||||
/// Used to exchange the IRK key in the init key & response key
|
||||
#define ESP_BLE_ID_KEY_MASK (1 << 1) /* relate to BTM_BLE_ID_KEY_MASK in btm_api.h */
|
||||
#define ESP_BLE_ID_KEY_MASK (1 << 1) /* relate to BTM_BLE_ID_KEY_MASK in stack/btm_api.h */
|
||||
/// Used to exchange the CSRK key in the init key & response key
|
||||
#define ESP_BLE_CSR_KEY_MASK (1 << 2) /* relate to BTM_BLE_CSR_KEY_MASK in btm_api.h */
|
||||
#define ESP_BLE_CSR_KEY_MASK (1 << 2) /* relate to BTM_BLE_CSR_KEY_MASK in stack/btm_api.h */
|
||||
/// Used to exchange the link key(this key just used in the BLE & BR/EDR coexist mode) in the init key & response key
|
||||
#define ESP_BLE_LINK_KEY_MASK (1 << 3) /* relate to BTM_BLE_LINK_KEY_MASK in btm_api.h */
|
||||
#define ESP_BLE_LINK_KEY_MASK (1 << 3) /* relate to BTM_BLE_LINK_KEY_MASK in stack/btm_api.h */
|
||||
typedef uint8_t esp_ble_key_mask_t; /* the key mask type */
|
||||
|
||||
/// Minimum of the application id
|
@ -27,22 +27,24 @@ extern "C" {
|
||||
/**
|
||||
*
|
||||
* @brief Get bluetooth device address. Must use after "esp_bluedroid_enable".
|
||||
*
|
||||
*
|
||||
* @return bluetooth device address (six bytes), or NULL if bluetooth stack is not enabled
|
||||
*/
|
||||
const uint8_t *esp_bt_dev_get_address(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set bluetooth device name. This function should be called after esp_bluedroid_enable()
|
||||
* completes successfully
|
||||
* @brief Set bluetooth device name. This function should be called after esp_bluedroid_enable()
|
||||
* completes successfully.
|
||||
* A BR/EDR/LE device type shall have a single Bluetooth device name which shall be
|
||||
* identical irrespective of the physical channel used to perform the name discovery procedure.
|
||||
*
|
||||
* @param[in] name : device name to be set
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_ARG : if name is NULL pointer or empty, or string length out of limit
|
||||
* - ESP_INVALID_STATE : if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL : others
|
||||
*/
|
||||
esp_err_t esp_bt_dev_set_device_name(const char *name);
|
@ -38,34 +38,94 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* relate to BTM_LE_KEY_xxx in btm_api.h */
|
||||
#define ESP_LE_KEY_NONE 0 /* relate to BTM_LE_KEY_NONE in btm_api.h */
|
||||
#define ESP_LE_KEY_PENC (1 << 0) /*!< encryption key, encryption information of peer device */ /* relate to BTM_LE_KEY_PENC in btm_api.h */
|
||||
#define ESP_LE_KEY_PID (1 << 1) /*!< identity key of the peer device */ /* relate to BTM_LE_KEY_PID in btm_api.h */
|
||||
#define ESP_LE_KEY_PCSRK (1 << 2) /*!< peer SRK */ /* relate to BTM_LE_KEY_PCSRK in btm_api.h */
|
||||
#define ESP_LE_KEY_PLK (1 << 3) /*!< Link key*/ /* relate to BTM_LE_KEY_PLK in btm_api.h */
|
||||
#define ESP_LE_KEY_LLK (ESP_LE_KEY_PLK << 4) /* relate to BTM_LE_KEY_LLK in btm_api.h */
|
||||
#define ESP_LE_KEY_LENC (ESP_LE_KEY_PENC << 4) /*!< master role security information:div */ /* relate to BTM_LE_KEY_LENC in btm_api.h */
|
||||
#define ESP_LE_KEY_LID (ESP_LE_KEY_PID << 4) /*!< master device ID key */ /* relate to BTM_LE_KEY_LID in btm_api.h */
|
||||
#define ESP_LE_KEY_LCSRK (ESP_LE_KEY_PCSRK << 4) /*!< local CSRK has been deliver to peer */ /* relate to BTM_LE_KEY_LCSRK in btm_api.h */
|
||||
/* relate to BTM_LE_KEY_xxx in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_NONE 0 /* relate to BTM_LE_KEY_NONE in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_PENC (1 << 0) /*!< encryption key, encryption information of peer device */ /* relate to BTM_LE_KEY_PENC in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_PID (1 << 1) /*!< identity key of the peer device */ /* relate to BTM_LE_KEY_PID in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_PCSRK (1 << 2) /*!< peer SRK */ /* relate to BTM_LE_KEY_PCSRK in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_PLK (1 << 3) /*!< Link key*/ /* relate to BTM_LE_KEY_PLK in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_LLK (ESP_LE_KEY_PLK << 4) /* relate to BTM_LE_KEY_LLK in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_LENC (ESP_LE_KEY_PENC << 4) /*!< master role security information:div */ /* relate to BTM_LE_KEY_LENC in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_LID (ESP_LE_KEY_PID << 4) /*!< master device ID key */ /* relate to BTM_LE_KEY_LID in stack/btm_api.h */
|
||||
#define ESP_LE_KEY_LCSRK (ESP_LE_KEY_PCSRK << 4) /*!< local CSRK has been deliver to peer */ /* relate to BTM_LE_KEY_LCSRK in stack/btm_api.h */
|
||||
typedef uint8_t esp_ble_key_type_t;
|
||||
|
||||
/* relate to BTM_LE_AUTH_xxx in btm_api.h */
|
||||
#define ESP_LE_AUTH_NO_BOND 0x00 /*!< 0*/ /* relate to BTM_LE_AUTH_NO_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_BOND 0x01 /*!< 1 << 0 */ /* relate to BTM_LE_AUTH_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_MITM (1 << 2) /*!< 1 << 2 */ /* relate to BTM_LE_AUTH_REQ_MITM in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_ONLY (1 << 3) /*!< 1 << 3 */ /* relate to BTM_LE_AUTH_REQ_SC_ONLY in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1001 */ /* relate to BTM_LE_AUTH_REQ_SC_BOND in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1100 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM in btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) /*!< 1101 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM_BOND in btm_api.h */
|
||||
/* relate to BTM_LE_AUTH_xxx in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_NO_BOND 0x00 /*!< 0*/ /* relate to BTM_LE_AUTH_NO_BOND in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_BOND 0x01 /*!< 1 << 0 */ /* relate to BTM_LE_AUTH_BOND in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_MITM (1 << 2) /*!< 1 << 2 */ /* relate to BTM_LE_AUTH_REQ_MITM in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_ONLY (1 << 3) /*!< 1 << 3 */ /* relate to BTM_LE_AUTH_REQ_SC_ONLY in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1001 */ /* relate to BTM_LE_AUTH_REQ_SC_BOND in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY) /*!< 1100 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM in stack/btm_api.h */
|
||||
#define ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) /*!< 1101 */ /* relate to BTM_LE_AUTH_REQ_SC_MITM_BOND in stack/btm_api.h */
|
||||
typedef uint8_t esp_ble_auth_req_t; /*!< combination of the above bit pattern */
|
||||
|
||||
/* relate to BTM_IO_CAP_xxx in btm_api.h */
|
||||
#define ESP_IO_CAP_OUT 0 /*!< DisplayOnly */ /* relate to BTM_IO_CAP_OUT in btm_api.h */
|
||||
#define ESP_IO_CAP_IO 1 /*!< DisplayYesNo */ /* relate to BTM_IO_CAP_IO in btm_api.h */
|
||||
#define ESP_IO_CAP_IN 2 /*!< KeyboardOnly */ /* relate to BTM_IO_CAP_IN in btm_api.h */
|
||||
#define ESP_IO_CAP_NONE 3 /*!< NoInputNoOutput */ /* relate to BTM_IO_CAP_NONE in btm_api.h */
|
||||
#define ESP_IO_CAP_KBDISP 4 /*!< Keyboard display */ /* relate to BTM_IO_CAP_KBDISP in btm_api.h */
|
||||
/* relate to BTM_IO_CAP_xxx in stack/btm_api.h */
|
||||
#define ESP_IO_CAP_OUT 0 /*!< DisplayOnly */ /* relate to BTM_IO_CAP_OUT in stack/btm_api.h */
|
||||
#define ESP_IO_CAP_IO 1 /*!< DisplayYesNo */ /* relate to BTM_IO_CAP_IO in stack/btm_api.h */
|
||||
#define ESP_IO_CAP_IN 2 /*!< KeyboardOnly */ /* relate to BTM_IO_CAP_IN in stack/btm_api.h */
|
||||
#define ESP_IO_CAP_NONE 3 /*!< NoInputNoOutput */ /* relate to BTM_IO_CAP_NONE in stack/btm_api.h */
|
||||
#define ESP_IO_CAP_KBDISP 4 /*!< Keyboard display */ /* relate to BTM_IO_CAP_KBDISP in stack/btm_api.h */
|
||||
|
||||
#define ESP_BLE_APPEARANCE_UNKNOWN 0x0000 /* relate to BTM_BLE_APPEARANCE_UNKNOWN in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_PHONE 0x0040 /* relate to BTM_BLE_APPEARANCE_GENERIC_PHONE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_COMPUTER 0x0080 /* relate to BTM_BLE_APPEARANCE_GENERIC_COMPUTER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_WATCH 0x00C0 /* relate to BTM_BLE_APPEARANCE_GENERIC_WATCH in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_SPORTS_WATCH 0x00C1 /* relate to BTM_BLE_APPEARANCE_SPORTS_WATCH in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_CLOCK 0x0100 /* relate to BTM_BLE_APPEARANCE_GENERIC_CLOCK in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_DISPLAY 0x0140 /* relate to BTM_BLE_APPEARANCE_GENERIC_DISPLAY in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_REMOTE 0x0180 /* relate to BTM_BLE_APPEARANCE_GENERIC_REMOTE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_EYEGLASSES 0x01C0 /* relate to BTM_BLE_APPEARANCE_GENERIC_EYEGLASSES in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_TAG 0x0200 /* relate to BTM_BLE_APPEARANCE_GENERIC_TAG in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_KEYRING 0x0240 /* relate to BTM_BLE_APPEARANCE_GENERIC_KEYRING in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 0x0280 /* relate to BTM_BLE_APPEARANCE_GENERIC_MEDIA_PLAYER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 0x02C0 /* relate to BTM_BLE_APPEARANCE_GENERIC_BARCODE_SCANNER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_THERMOMETER 0x0300 /* relate to BTM_BLE_APPEARANCE_GENERIC_THERMOMETER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_THERMOMETER_EAR 0x0301 /* relate to BTM_BLE_APPEARANCE_THERMOMETER_EAR in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_HEART_RATE 0x0340 /* relate to BTM_BLE_APPEARANCE_GENERIC_HEART_RATE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HEART_RATE_BELT 0x0341 /* relate to BTM_BLE_APPEARANCE_HEART_RATE_BELT in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 0x0380 /* relate to BTM_BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_BLOOD_PRESSURE_ARM 0x0381 /* relate to BTM_BLE_APPEARANCE_BLOOD_PRESSURE_ARM in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 0x0382 /* relate to BTM_BLE_APPEARANCE_BLOOD_PRESSURE_WRIST in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_HID 0x03C0 /* relate to BTM_BLE_APPEARANCE_GENERIC_HID in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_KEYBOARD 0x03C1 /* relate to BTM_BLE_APPEARANCE_HID_KEYBOARD in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_MOUSE 0x03C2 /* relate to BTM_BLE_APPEARANCE_HID_MOUSE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_JOYSTICK 0x03C3 /* relate to BTM_BLE_APPEARANCE_HID_JOYSTICK in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_GAMEPAD 0x03C4 /* relate to BTM_BLE_APPEARANCE_HID_GAMEPAD in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_DIGITIZER_TABLET 0x03C5 /* relate to BTM_BLE_APPEARANCE_HID_DIGITIZER_TABLET in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_CARD_READER 0x03C6 /* relate to BTM_BLE_APPEARANCE_HID_CARD_READER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_DIGITAL_PEN 0x03C7 /* relate to BTM_BLE_APPEARANCE_HID_DIGITAL_PEN in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_HID_BARCODE_SCANNER 0x03C8 /* relate to BTM_BLE_APPEARANCE_HID_BARCODE_SCANNER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_GLUCOSE 0x0400 /* relate to BTM_BLE_APPEARANCE_GENERIC_GLUCOSE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_WALKING 0x0440 /* relate to BTM_BLE_APPEARANCE_GENERIC_WALKING in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_WALKING_IN_SHOE 0x0441 /* relate to BTM_BLE_APPEARANCE_WALKING_IN_SHOE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_WALKING_ON_SHOE 0x0442 /* relate to BTM_BLE_APPEARANCE_WALKING_ON_SHOE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_WALKING_ON_HIP 0x0443 /* relate to BTM_BLE_APPEARANCE_WALKING_ON_HIP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_CYCLING 0x0480 /* relate to BTM_BLE_APPEARANCE_GENERIC_CYCLING in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_COMPUTER 0x0481 /* relate to BTM_BLE_APPEARANCE_CYCLING_COMPUTER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_SPEED 0x0482 /* relate to BTM_BLE_APPEARANCE_CYCLING_SPEED in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_CADENCE 0x0483 /* relate to BTM_BLE_APPEARANCE_CYCLING_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_POWER 0x0484 /* relate to BTM_BLE_APPEARANCE_CYCLING_POWER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_CYCLING_SPEED_CADENCE 0x0485 /* relate to BTM_BLE_APPEARANCE_CYCLING_SPEED_CADENCE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER 0x0C40 /* relate to BTM_BLE_APPEARANCE_GENERIC_PULSE_OXIMETER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 0x0C41 /* relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_PULSE_OXIMETER_WRIST 0x0C42 /* relate to BTM_BLE_APPEARANCE_PULSE_OXIMETER_WRIST in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_WEIGHT 0x0C80 /* relate to BTM_BLE_APPEARANCE_GENERIC_WEIGHT in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE 0x0CC0 /* relate to BTM_BLE_APPEARANCE_GENERIC_PERSONAL_MOBILITY_DEVICE in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_POWERED_WHEELCHAIR 0x0CC1 /* relate to BTM_BLE_APPEARANCE_POWERED_WHEELCHAIR in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_MOBILITY_SCOOTER 0x0CC2 /* relate to BTM_BLE_APPEARANCE_MOBILITY_SCOOTER in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_CONTINUOUS_GLUCOSE_MONITOR 0x0D00 /* relate to BTM_BLE_APPEARANCE_GENERIC_CONTINUOUS_GLUCOSE_MONITOR in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_INSULIN_PUMP 0x0D40 /* relate to BTM_BLE_APPEARANCE_GENERIC_INSULIN_PUMP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_INSULIN_PUMP_DURABLE_PUMP 0x0D41 /* relate to BTM_BLE_APPEARANCE_INSULIN_PUMP_DURABLE_PUMP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_INSULIN_PUMP_PATCH_PUMP 0x0D44 /* relate to BTM_BLE_APPEARANCE_INSULIN_PUMP_PATCH_PUMP in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_INSULIN_PEN 0x0D48 /* relate to BTM_BLE_APPEARANCE_INSULIN_PEN in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_MEDICATION_DELIVERY 0x0D80 /* relate to BTM_BLE_APPEARANCE_GENERIC_MEDICATION_DELIVERY in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS 0x1440 /* relate to BTM_BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION 0x1441 /* relate to BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV 0x1442 /* relate to BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_AND_NAV in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD 0x1443 /* relate to BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD in stack/btm_ble_api.h */
|
||||
#define ESP_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV 0x1444 /* relate to BTM_BLE_APPEARANCE_OUTDOOR_SPORTS_LOCATION_POD_AND_NAV in stack/btm_ble_api.h */
|
||||
|
||||
typedef uint8_t esp_ble_io_cap_t; /*!< combination of the io capability */
|
||||
|
||||
/// GAP BLE callback event type
|
||||
@ -108,45 +168,45 @@ typedef enum {
|
||||
/// Scan response data maximum length
|
||||
#define ESP_BLE_SCAN_RSP_DATA_LEN_MAX 31
|
||||
|
||||
/* relate to BTM_BLE_AD_TYPE_xxx in btm_ble_api.h */
|
||||
/* relate to BTM_BLE_AD_TYPE_xxx in stack/btm_ble_api.h */
|
||||
/// The type of advertising data(not adv_type)
|
||||
typedef enum {
|
||||
ESP_BLE_AD_TYPE_FLAG = 0x01, /* relate to BTM_BLE_AD_TYPE_FLAG in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_PART = 0x02, /* relate to BTM_BLE_AD_TYPE_16SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_CMPL = 0x03, /* relate to BTM_BLE_AD_TYPE_16SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_PART = 0x04, /* relate to BTM_BLE_AD_TYPE_32SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_CMPL = 0x05, /* relate to BTM_BLE_AD_TYPE_32SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_PART = 0x06, /* relate to BTM_BLE_AD_TYPE_128SRV_PART in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_CMPL = 0x07, /* relate to BTM_BLE_AD_TYPE_128SRV_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_SHORT = 0x08, /* relate to BTM_BLE_AD_TYPE_NAME_SHORT in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL = 0x09, /* relate to BTM_BLE_AD_TYPE_NAME_CMPL in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TX_PWR = 0x0A, /* relate to BTM_BLE_AD_TYPE_TX_PWR in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_DEV_CLASS = 0x0D, /* relate to BTM_BLE_AD_TYPE_DEV_CLASS in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_TK = 0x10, /* relate to BTM_BLE_AD_TYPE_SM_TK in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_OOB_FLAG = 0x11, /* relate to BTM_BLE_AD_TYPE_SM_OOB_FLAG in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INT_RANGE = 0x12, /* relate to BTM_BLE_AD_TYPE_INT_RANGE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SOL_SRV_UUID = 0x14, /* relate to BTM_BLE_AD_TYPE_SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SOL_SRV_UUID = 0x15, /* relate to BTM_BLE_AD_TYPE_128SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SERVICE_DATA = 0x16, /* relate to BTM_BLE_AD_TYPE_SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_PUBLIC_TARGET = 0x17, /* relate to BTM_BLE_AD_TYPE_PUBLIC_TARGET in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_RANDOM_TARGET = 0x18, /* relate to BTM_BLE_AD_TYPE_RANDOM_TARGET in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_APPEARANCE = 0x19, /* relate to BTM_BLE_AD_TYPE_APPEARANCE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_ADV_INT = 0x1A, /* relate to BTM_BLE_AD_TYPE_ADV_INT in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_DEV_ADDR = 0x1b, /* relate to BTM_BLE_AD_TYPE_LE_DEV_ADDR in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_ROLE = 0x1c, /* relate to BTM_BLE_AD_TYPE_LE_ROLE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_C256 = 0x1d, /* relate to BTM_BLE_AD_TYPE_SPAIR_C256 in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_R256 = 0x1e, /* relate to BTM_BLE_AD_TYPE_SPAIR_R256 in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SOL_SRV_UUID = 0x1f, /* relate to BTM_BLE_AD_TYPE_32SOL_SRV_UUID in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SERVICE_DATA = 0x20, /* relate to BTM_BLE_AD_TYPE_32SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SERVICE_DATA = 0x21, /* relate to BTM_BLE_AD_TYPE_128SERVICE_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_CONFIRM = 0x22, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_RANDOM = 0x23, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_RANDOM in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_URI = 0x24, /* relate to BTM_BLE_AD_TYPE_URI in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INDOOR_POSITION = 0x25, /* relate to BTM_BLE_AD_TYPE_INDOOR_POSITION in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TRANS_DISC_DATA = 0x26, /* relate to BTM_BLE_AD_TYPE_TRANS_DISC_DATA in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SUPPORT_FEATURE = 0x27, /* relate to BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_CHAN_MAP_UPDATE = 0x28, /* relate to BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE in btm_ble_api.h */
|
||||
ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE = 0xFF, /* relate to BTM_BLE_AD_MANUFACTURER_SPECIFIC_TYPE in btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_FLAG = 0x01, /* relate to BTM_BLE_AD_TYPE_FLAG in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_PART = 0x02, /* relate to BTM_BLE_AD_TYPE_16SRV_PART in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_16SRV_CMPL = 0x03, /* relate to BTM_BLE_AD_TYPE_16SRV_CMPL in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_PART = 0x04, /* relate to BTM_BLE_AD_TYPE_32SRV_PART in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SRV_CMPL = 0x05, /* relate to BTM_BLE_AD_TYPE_32SRV_CMPL in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_PART = 0x06, /* relate to BTM_BLE_AD_TYPE_128SRV_PART in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SRV_CMPL = 0x07, /* relate to BTM_BLE_AD_TYPE_128SRV_CMPL in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_SHORT = 0x08, /* relate to BTM_BLE_AD_TYPE_NAME_SHORT in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_NAME_CMPL = 0x09, /* relate to BTM_BLE_AD_TYPE_NAME_CMPL in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TX_PWR = 0x0A, /* relate to BTM_BLE_AD_TYPE_TX_PWR in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_DEV_CLASS = 0x0D, /* relate to BTM_BLE_AD_TYPE_DEV_CLASS in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_TK = 0x10, /* relate to BTM_BLE_AD_TYPE_SM_TK in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SM_OOB_FLAG = 0x11, /* relate to BTM_BLE_AD_TYPE_SM_OOB_FLAG in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INT_RANGE = 0x12, /* relate to BTM_BLE_AD_TYPE_INT_RANGE in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SOL_SRV_UUID = 0x14, /* relate to BTM_BLE_AD_TYPE_SOL_SRV_UUID in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SOL_SRV_UUID = 0x15, /* relate to BTM_BLE_AD_TYPE_128SOL_SRV_UUID in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SERVICE_DATA = 0x16, /* relate to BTM_BLE_AD_TYPE_SERVICE_DATA in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_PUBLIC_TARGET = 0x17, /* relate to BTM_BLE_AD_TYPE_PUBLIC_TARGET in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_RANDOM_TARGET = 0x18, /* relate to BTM_BLE_AD_TYPE_RANDOM_TARGET in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_APPEARANCE = 0x19, /* relate to BTM_BLE_AD_TYPE_APPEARANCE in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_ADV_INT = 0x1A, /* relate to BTM_BLE_AD_TYPE_ADV_INT in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_DEV_ADDR = 0x1b, /* relate to BTM_BLE_AD_TYPE_LE_DEV_ADDR in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_ROLE = 0x1c, /* relate to BTM_BLE_AD_TYPE_LE_ROLE in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_C256 = 0x1d, /* relate to BTM_BLE_AD_TYPE_SPAIR_C256 in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_SPAIR_R256 = 0x1e, /* relate to BTM_BLE_AD_TYPE_SPAIR_R256 in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SOL_SRV_UUID = 0x1f, /* relate to BTM_BLE_AD_TYPE_32SOL_SRV_UUID in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_32SERVICE_DATA = 0x20, /* relate to BTM_BLE_AD_TYPE_32SERVICE_DATA in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_128SERVICE_DATA = 0x21, /* relate to BTM_BLE_AD_TYPE_128SERVICE_DATA in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_CONFIRM = 0x22, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SECURE_RANDOM = 0x23, /* relate to BTM_BLE_AD_TYPE_LE_SECURE_RANDOM in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_URI = 0x24, /* relate to BTM_BLE_AD_TYPE_URI in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_INDOOR_POSITION = 0x25, /* relate to BTM_BLE_AD_TYPE_INDOOR_POSITION in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_TRANS_DISC_DATA = 0x26, /* relate to BTM_BLE_AD_TYPE_TRANS_DISC_DATA in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_LE_SUPPORT_FEATURE = 0x27, /* relate to BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_TYPE_CHAN_MAP_UPDATE = 0x28, /* relate to BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE in stack/btm_ble_api.h */
|
||||
ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE = 0xFF, /* relate to BTM_BLE_AD_MANUFACTURER_SPECIFIC_TYPE in stack/btm_ble_api.h */
|
||||
} esp_ble_adv_data_type;
|
||||
|
||||
/// Advertising mode
|
||||
@ -179,18 +239,18 @@ typedef enum {
|
||||
} esp_ble_adv_filter_t;
|
||||
|
||||
|
||||
/* relate to BTA_DM_BLE_SEC_xxx in bta_api.h */
|
||||
/* relate to BTA_DM_BLE_SEC_xxx in bta/bta_api.h */
|
||||
typedef enum {
|
||||
ESP_BLE_SEC_ENCRYPT = 1, /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta_api.h. If the device has already
|
||||
ESP_BLE_SEC_ENCRYPT = 1, /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta/bta_api.h. If the device has already
|
||||
bonded, the stack will used LTK to encrypt with the remote device directly.
|
||||
Else if the device hasn't bonded, the stack will used the default authentication request
|
||||
used the esp_ble_gap_set_security_param function set by the user. */
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta_api.h. If the device has already
|
||||
ESP_BLE_SEC_ENCRYPT_NO_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta/bta_api.h. If the device has already
|
||||
bonded, the stack will check the LTK Whether the authentication request has been met, if met, used the LTK
|
||||
to encrypt with the remote device directly, else Re-pair with the remote device.
|
||||
Else if the device hasn't bonded, the stack will used NO MITM authentication request in the current link instead of
|
||||
used the authreq in the esp_ble_gap_set_security_param function set by the user. */
|
||||
ESP_BLE_SEC_ENCRYPT_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta_api.h. If the device has already
|
||||
ESP_BLE_SEC_ENCRYPT_MITM, /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta/bta_api.h. If the device has already
|
||||
bonded, the stack will check the LTK Whether the authentication request has been met, if met, used the LTK
|
||||
to encrypt with the remote device directly, else Re-pair with the remote device.
|
||||
Else if the device hasn't bonded, the stack will used MITM authentication request in the current link instead of
|
||||
@ -264,6 +324,13 @@ typedef enum {
|
||||
3. directed advertising packets addressed to this device.*/
|
||||
} esp_ble_scan_filter_t;
|
||||
|
||||
/// Ble scan duplicate type
|
||||
typedef enum {
|
||||
BLE_SCAN_DUPLICATE_DISABLE = 0x0, /*!< the Link Layer should generate advertising reports to the host for each packet received */
|
||||
BLE_SCAN_DUPLICATE_ENABLE = 0x1, /*!< the Link Layer should filter out duplicate advertising reports to the Host */
|
||||
BLE_SCAN_DUPLICATE_MAX = 0x2, /*!< 0x02 – 0xFF, Reserved for future use */
|
||||
} esp_ble_scan_duplicate_t;
|
||||
|
||||
/// Ble scan parameters
|
||||
typedef struct {
|
||||
esp_ble_scan_type_t scan_type; /*!< Scan type */
|
||||
@ -279,6 +346,9 @@ typedef struct {
|
||||
Range: 0x0004 to 0x4000 Default: 0x0010 (10 ms)
|
||||
Time = N * 0.625 msec
|
||||
Time Range: 2.5 msec to 10240 msec */
|
||||
esp_ble_scan_duplicate_t scan_duplicate; /*!< The Scan_Duplicates parameter controls whether the Link Layer should filter out
|
||||
duplicate advertising reports (BLE_SCAN_DUPLICATE_ENABLE) to the Host, or if the Link Layer should generate
|
||||
advertising reports for each packet received */
|
||||
} esp_ble_scan_params_t;
|
||||
|
||||
/// Connection update parameters
|
||||
@ -775,6 +845,20 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
*/
|
||||
esp_err_t esp_ble_gap_config_local_privacy (bool privacy_enable);
|
||||
|
||||
/**
|
||||
* @brief set local gap appearance icon
|
||||
*
|
||||
*
|
||||
* @param[in] icon - External appearance value, these values are defined by the Bluetooth SIG, please refer to
|
||||
* https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_config_local_icon (uint16_t icon);
|
||||
|
||||
/**
|
||||
* @brief Add or remove device from white list
|
||||
*
|
||||
@ -982,7 +1066,7 @@ esp_err_t esp_ble_remove_bond_device(esp_bd_addr_t bd_addr);
|
||||
* It will return the device bonded number immediately.
|
||||
*
|
||||
* @return - >= 0 : bonded devices number.
|
||||
* - < 0 : failed
|
||||
* - ESP_FAIL : failed
|
||||
*
|
||||
*/
|
||||
int esp_ble_get_bond_device_num(void);
|
@ -23,6 +23,27 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// RSSI threshold
|
||||
#define ESP_BT_GAP_RSSI_HIGH_THRLD -20 /*!< High RSSI threshold */
|
||||
#define ESP_BT_GAP_RSSI_LOW_THRLD -45 /*!< Low RSSI threshold */
|
||||
|
||||
/// Class of device
|
||||
typedef struct {
|
||||
uint32_t reserved_2: 2; /*!< undefined */
|
||||
uint32_t minor: 6; /*!< minor class */
|
||||
uint32_t major: 5; /*!< major class */
|
||||
uint32_t service: 11; /*!< service class */
|
||||
uint32_t reserved_8: 8; /*!< undefined */
|
||||
} esp_bt_cod_t;
|
||||
|
||||
/// class of device settings
|
||||
typedef enum {
|
||||
ESP_BT_SET_COD_MAJOR_MINOR = 0x01, /*!< overwrite major, minor class */
|
||||
ESP_BT_SET_COD_SERVICE_CLASS = 0x02, /*!< set the bits in the input, the current bit will remain */
|
||||
ESP_BT_CLR_COD_SERVICE_CLASS = 0x04, /*!< clear the bits in the input, others will remain */
|
||||
ESP_BT_SET_COD_ALL = 0x08, /*!< overwrite major, minor, set the bits in service class */
|
||||
ESP_BT_INIT_COD = 0x0a, /*!< overwrite major, minor, and service class */
|
||||
} esp_bt_cod_mode_t;
|
||||
|
||||
/// Discoverability and Connectability mode
|
||||
typedef enum {
|
||||
@ -127,12 +148,15 @@ typedef enum {
|
||||
ESP_BT_GAP_DISC_STATE_CHANGED_EVT, /*!< discovery state changed event */
|
||||
ESP_BT_GAP_RMT_SRVCS_EVT, /*!< get remote services event */
|
||||
ESP_BT_GAP_RMT_SRVC_REC_EVT, /*!< get remote service record event */
|
||||
ESP_BT_GAP_AUTH_CMPL_EVT, /*!< AUTH complete event */
|
||||
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
|
||||
ESP_BT_GAP_EVT_MAX,
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
/** Inquiry Mode */
|
||||
typedef enum {
|
||||
ESP_BT_INQ_MODE_GENERAL_INQUIRY, /*!< General inquiry mode */
|
||||
ESP_BT_INQ_MODE_LIMITED_INQIURY, /*!< Limited inquiry mode */
|
||||
ESP_BT_INQ_MODE_LIMITED_INQUIRY, /*!< Limited inquiry mode */
|
||||
} esp_bt_inq_mode_t;
|
||||
|
||||
/** Minimum and Maximum inquiry length*/
|
||||
@ -174,6 +198,24 @@ typedef union {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< service search status */
|
||||
} rmt_srvc_rec; /*!< specific service record from remote device parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_READ_RSSI_DELTA_EVT *
|
||||
*/
|
||||
struct read_rssi_delta_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< read rssi status */
|
||||
int8_t rssi_delta; /*!< rssi delta value range -128 ~127, The value zero indicates that the RSSI is inside the Golden Receive Power Range, the Golden Receive Power Range is from ESP_BT_GAP_RSSI_LOW_THRLD to ESP_BT_GAP_RSSI_HIGH_THRLD */
|
||||
} read_rssi_delta; /*!< read rssi parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_AUTH_CMPL_EVT
|
||||
*/
|
||||
struct auth_cmpl_param {
|
||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||
esp_bt_status_t stat; /*!< authentication complete status */
|
||||
uint8_t device_name[ESP_BT_GAP_MAX_BDNAME_LEN + 1]; /*!< device name */
|
||||
} auth_cmpl; /*!< authentication complete parameter struct */
|
||||
} esp_bt_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -258,7 +300,7 @@ esp_err_t esp_bt_gap_register_callback(esp_bt_gap_cb_t callback);
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_ARG: if argument invalid
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
|
||||
@ -274,7 +316,7 @@ esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if invalid parameters are provided
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
@ -286,7 +328,7 @@ esp_err_t esp_bt_gap_start_discovery(esp_bt_inq_mode_t mode, uint8_t inq_len, ui
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_cancel_discovery(void);
|
||||
@ -297,7 +339,7 @@ esp_err_t esp_bt_gap_cancel_discovery(void);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda);
|
||||
@ -309,7 +351,7 @@ esp_err_t esp_bt_gap_get_remote_services(esp_bd_addr_t remote_bda);
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_RMT_SRVC_REC_EVT after service discovery ends
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_remote_service_record(esp_bd_addr_t remote_bda, esp_bt_uuid_t *uuid);
|
||||
@ -326,6 +368,85 @@ esp_err_t esp_bt_gap_get_remote_service_record(esp_bd_addr_t remote_bda, esp_bt_
|
||||
*/
|
||||
uint8_t *esp_bt_gap_resolve_eir_data(uint8_t *eir, esp_bt_eir_type_t type, uint8_t *length);
|
||||
|
||||
/**
|
||||
* @brief This function is called to set class of device.
|
||||
* esp_bt_gap_cb_t will is called with ESP_BT_GAP_SET_COD_EVT after set COD ends
|
||||
* Some profile have special restrictions on class of device,
|
||||
* changes may cause these profile do not work
|
||||
*
|
||||
* @param[in] cod - class of device
|
||||
* @param[in] mode - setting mode
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_ERR_INVALID_ARG: if param is invalid
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_cod(esp_bt_cod_t cod, esp_bt_cod_mode_t mode);
|
||||
|
||||
/**
|
||||
* @brief This function is called to get class of device.
|
||||
*
|
||||
* @param[out] cod - class of device
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_cod(esp_bt_cod_t *cod);
|
||||
|
||||
/**
|
||||
* @brief This function is called to read RSSI delta by address after connected. The RSSI value returned by ESP_BT_GAP_READ_RSSI_DELTA_EVT.
|
||||
*
|
||||
*
|
||||
* @param[in] remote_addr - remote device address, corresponding to a certain connection handle.
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_gap_read_rssi_delta(esp_bd_addr_t remote_addr);
|
||||
|
||||
/**
|
||||
* @brief Removes a device from the security database list of
|
||||
* peer device.
|
||||
*
|
||||
* @param[in] bd_addr : BD address of the peer device
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - ESP_FAIL : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_bt_gap_remove_bond_device(esp_bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief Get the device number from the security database list of peer device.
|
||||
* It will return the device bonded number immediately.
|
||||
*
|
||||
* @return - >= 0 : bonded devices number.
|
||||
* - ESP_FAIL : failed
|
||||
*
|
||||
*/
|
||||
int esp_bt_gap_get_bond_device_num(void);
|
||||
|
||||
/**
|
||||
* @brief Get the device from the security database list of peer device.
|
||||
* It will return the device bonded information immediately.
|
||||
* @param[inout] dev_num: Indicate the dev_list array(buffer) size as input.
|
||||
* If dev_num is large enough, it means the actual number as output.
|
||||
* Suggest that dev_num value equal to esp_ble_get_bond_device_num().
|
||||
*
|
||||
* @param[out] dev_list: an array(buffer) of `esp_bd_addr_t` type. Use for storing the bonded devices address.
|
||||
* The dev_list should be allocated by who call this API.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_bond_device_list(int *dev_num, esp_bd_addr_t *dev_list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -23,10 +23,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Maximum Transmission Unit used in GATT
|
||||
#define ESP_GATT_DEF_BLE_MTU_SIZE 23 /* relate to GATT_DEF_BLE_MTU_SIZE in gatt_api.h */
|
||||
#define ESP_GATT_DEF_BLE_MTU_SIZE 23 /* relate to GATT_DEF_BLE_MTU_SIZE in stack/gatt_api.h */
|
||||
|
||||
// Maximum Transmission Unit allowed in GATT
|
||||
#define ESP_GATT_MAX_MTU_SIZE 517 /* relate to GATT_MAX_MTU_SIZE in gatt_api.h */
|
||||
#define ESP_GATT_MAX_MTU_SIZE 517 /* relate to GATT_MAX_MTU_SIZE in stack/gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief This function is called to set local MTU,
|
@ -154,81 +154,81 @@ extern "C" {
|
||||
* @}
|
||||
*/
|
||||
|
||||
/* relate to BTA_GATT_PREP_WRITE_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_PREP_WRITE_xxx in bta/bta_gatt_api.h */
|
||||
/// Attribute write data type from the client
|
||||
typedef enum {
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */ /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */ /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta/bta_gatt_api.h */
|
||||
} esp_gatt_prep_write_type;
|
||||
|
||||
/* relate to BTA_GATT_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief GATT success code and error codes
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_OK = 0x0, /* relate to BTA_GATT_OK in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */ /* relate to BTA_GATT_INVALID_HANDLE in bta_gatt_api.h */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */ /* relate to BTA_GATT_READ_NOT_PERMIT in bta_gatt_api.h */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */ /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */ /* relate to BTA_GATT_INVALID_PDU in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */ /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta_gatt_api.h */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */ /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */ /* relate to BTA_GATT_INVALID_OFFSET in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */ /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta_gatt_api.h */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */ /* relate to BTA_GATT_PREPARE_Q_FULL in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */ /* relate to BTA_GATT_NOT_FOUND in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */ /* relate to BTA_GATT_NOT_LONG in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */ /* relate to BTA_GATT_INSUF_KEY_SIZE in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */ /* relate to BTA_GATT_INVALID_ATTR_LEN in bta_gatt_api.h */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */ /* relate to BTA_GATT_ERR_UNLIKELY in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */ /* relate to BTA_GATT_INSUF_ENCRYPTION in bta_gatt_api.h */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */ /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */ /* relate to BTA_GATT_INSUF_RESOURCE in bta_gatt_api.h */
|
||||
ESP_GATT_OK = 0x0, /* relate to BTA_GATT_OK in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */ /* relate to BTA_GATT_INVALID_HANDLE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */ /* relate to BTA_GATT_READ_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */ /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */ /* relate to BTA_GATT_INVALID_PDU in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */ /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */ /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */ /* relate to BTA_GATT_INVALID_OFFSET in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */ /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */ /* relate to BTA_GATT_PREPARE_Q_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */ /* relate to BTA_GATT_NOT_FOUND in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */ /* relate to BTA_GATT_NOT_LONG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */ /* relate to BTA_GATT_INSUF_KEY_SIZE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */ /* relate to BTA_GATT_INVALID_ATTR_LEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */ /* relate to BTA_GATT_ERR_UNLIKELY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */ /* relate to BTA_GATT_INSUF_ENCRYPTION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */ /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */ /* relate to BTA_GATT_INSUF_RESOURCE in bta/bta_gatt_api.h */
|
||||
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */ /* relate to BTA_GATT_NO_RESOURCES in bta_gatt_api.h */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */ /* relate to BTA_GATT_INTERNAL_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */ /* relate to BTA_GATT_WRONG_STATE in bta_gatt_api.h */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */ /* relate to BTA_GATT_DB_FULL in bta_gatt_api.h */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */ /* relate to BTA_GATT_BUSY in bta_gatt_api.h */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */ /* relate to BTA_GATT_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */ /* relate to BTA_GATT_CMD_STARTED in bta_gatt_api.h */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */ /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta_gatt_api.h */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */ /* relate to BTA_GATT_PENDING in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */ /* relate to BTA_GATT_AUTH_FAIL in bta_gatt_api.h */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta_gatt_api.h */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta_gatt_api.h */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta_gatt_api.h */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta_gatt_api.h */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */ /* relate to BTA_GATT_ALREADY_OPEN in bta_gatt_api.h */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */ /* relate to BTA_GATT_CANCEL in bta_gatt_api.h */
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */ /* relate to BTA_GATT_NO_RESOURCES in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */ /* relate to BTA_GATT_INTERNAL_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */ /* relate to BTA_GATT_WRONG_STATE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */ /* relate to BTA_GATT_DB_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */ /* relate to BTA_GATT_BUSY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */ /* relate to BTA_GATT_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */ /* relate to BTA_GATT_CMD_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */ /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */ /* relate to BTA_GATT_PENDING in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */ /* relate to BTA_GATT_AUTH_FAIL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */ /* relate to BTA_GATT_ALREADY_OPEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */ /* relate to BTA_GATT_CANCEL in bta/bta_gatt_api.h */
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /* 0xe0 */ /* relate to BTA_GATT_STACK_RSP in bta_gatt_api.h */
|
||||
ESP_GATT_APP_RSP = 0xe1, /* 0xe1 */ /* relate to BTA_GATT_APP_RSP in bta_gatt_api.h */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /* 0xe0 */ /* relate to BTA_GATT_STACK_RSP in bta/bta_gatt_api.h */
|
||||
ESP_GATT_APP_RSP = 0xe1, /* 0xe1 */ /* relate to BTA_GATT_APP_RSP in bta/bta_gatt_api.h */
|
||||
//Error caused by customer application or stack bug
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /* 0xef */ /* relate to BTA_GATT_UNKNOWN_ERROR in bta_gatt_api.h */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */ /* relate to BTA_GATT_CCC_CFG_ERR in bta_gatt_api.h */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */ /* relate to BTA_GATT_PRC_IN_PROGRESS in bta_gatt_api.h */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFFAttribute value out of range */ /* relate to BTA_GATT_OUT_OF_RANGE in bta_gatt_api.h */
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /* 0xef */ /* relate to BTA_GATT_UNKNOWN_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */ /* relate to BTA_GATT_CCC_CFG_ERR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */ /* relate to BTA_GATT_PRC_IN_PROGRESS in bta/bta_gatt_api.h */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFFAttribute value out of range */ /* relate to BTA_GATT_OUT_OF_RANGE in bta/bta_gatt_api.h */
|
||||
} esp_gatt_status_t;
|
||||
|
||||
/* relate to BTA_GATT_CONN_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_CONN_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt Connection reason enum
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */ /* relate to BTA_GATT_CONN_UNKNOWN in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */ /* relate to BTA_GATT_CONN_L2C_FAILURE in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */ /* relate to BTA_GATT_CONN_TIMEOUT in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */ /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connectionterminated by local host */ /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */ /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */ /* relate to BTA_GATT_CONN_CONN_CANCEL in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */ /* relate to BTA_GATT_CONN_NONE in bta_gatt_api.h */
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */ /* relate to BTA_GATT_CONN_UNKNOWN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */ /* relate to BTA_GATT_CONN_L2C_FAILURE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */ /* relate to BTA_GATT_CONN_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */ /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connectionterminated by local host */ /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */ /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */ /* relate to BTA_GATT_CONN_CONN_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */ /* relate to BTA_GATT_CONN_NONE in bta/bta_gatt_api.h */
|
||||
} esp_gatt_conn_reason_t;
|
||||
|
||||
/**
|
||||
@ -248,42 +248,42 @@ typedef struct {
|
||||
bool is_primary; /*!< This service is primary or not */
|
||||
} __attribute__((packed)) esp_gatt_srvc_id_t;
|
||||
|
||||
/* relate to BTA_GATT_AUTH_REQ_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_AUTH_REQ_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt authentication request type
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /* relate to BTA_GATT_AUTH_REQ_NONE in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /* relate to BTA_GATT_AUTH_REQ_NONE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
} esp_gatt_auth_req_t;
|
||||
|
||||
/* relate to BTA_GATT_PERM_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_PERM_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Attribute permissions
|
||||
*/
|
||||
#define ESP_GATT_PERM_READ (1 << 0) /* bit 0 - 0x0001 */ /* relate to BTA_GATT_PERM_READ in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 - 0x0002 */ /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 - 0x0004 */ /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4) /* bit 4 - 0x0010 */ /* relate to BTA_GATT_PERM_WRITE in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 - 0x0020 */ /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ (1 << 0) /* bit 0 - 0x0001 */ /* relate to BTA_GATT_PERM_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 - 0x0002 */ /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 - 0x0004 */ /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4) /* bit 4 - 0x0010 */ /* relate to BTA_GATT_PERM_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 - 0x0020 */ /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
typedef uint16_t esp_gatt_perm_t;
|
||||
|
||||
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta_gatt_api.h */
|
||||
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta/bta_gatt_api.h */
|
||||
/* definition of characteristic properties */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0) /* 0x01 */ /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1) /* 0x02 */ /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2) /* 0x04 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3) /* 0x08 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4) /* 0x10 */ /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5) /* 0x20 */ /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6) /* 0x40 */ /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7) /* 0x80 */ /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0) /* 0x01 */ /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1) /* 0x02 */ /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2) /* 0x04 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3) /* 0x08 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4) /* 0x10 */ /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5) /* 0x20 */ /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6) /* 0x40 */ /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7) /* 0x80 */ /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta/bta_gatt_api.h */
|
||||
typedef uint8_t esp_gatt_char_prop_t;
|
||||
|
||||
/// GATT maximum attribute length
|
||||
@ -450,7 +450,8 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The include service current attribute handle */
|
||||
uint16_t incl_srvc_s_handle; /*!< The start hanlde of the service which has been included */
|
||||
uint16_t incl_srvc_s_handle; /*!< The start handle of the service which has been included */
|
||||
uint16_t incl_srvc_e_handle; /*!< The end handle of the service which has been included */
|
||||
esp_bt_uuid_t uuid; /*!< The include service uuid */
|
||||
} esp_gattc_incl_svc_elem_t; /*!< The gattc inclue service element */
|
||||
|
@ -65,6 +65,8 @@ typedef enum {
|
||||
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
|
||||
ESP_GATTC_READ_MULTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor multiple complete, the event comes */
|
||||
ESP_GATTC_QUEUE_FULL_EVT = 43, /*!< When the gattc command queue full, the event comes */
|
||||
ESP_GATTC_SET_ASSOC_EVT = 44, /*!< When the ble gattc set the associated address complete, the event comes */
|
||||
ESP_GATTC_GET_ADDR_LIST_EVT = 45, /*!< When the ble get gattc address list in cache finish, the event comes */
|
||||
} esp_gattc_cb_event_t;
|
||||
|
||||
|
||||
@ -125,6 +127,7 @@ typedef union {
|
||||
uint16_t start_handle; /*!< Service start handle */
|
||||
uint16_t end_handle; /*!< Service end handle */
|
||||
esp_gatt_id_t srvc_id; /*!< Service id, include service uuid and other information */
|
||||
bool is_primary; /*!< True if this is the primary service */
|
||||
} search_res; /*!< Gatt client callback param of ESP_GATTC_SEARCH_RES_EVT */
|
||||
|
||||
/**
|
||||
@ -215,6 +218,20 @@ typedef union {
|
||||
uint16_t conn_id; /*!< Connection id */
|
||||
esp_bd_addr_t remote_bda; /*!< Remote bluetooth device address */
|
||||
} disconnect; /*!< Gatt client callback param of ESP_GATTC_DISCONNECT_EVT */
|
||||
/**
|
||||
* @brief ESP_GATTC_SET_ASSOC_EVT
|
||||
*/
|
||||
struct gattc_set_assoc_addr_cmp_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
} set_assoc_cmp; /*!< Gatt client callback param of ESP_GATTC_SET_ASSOC_EVT */
|
||||
/**
|
||||
* @brief ESP_GATTC_GET_ADDR_LIST_EVT
|
||||
*/
|
||||
struct gattc_get_addr_list_evt_param {
|
||||
esp_gatt_status_t status; /*!< Operation status */
|
||||
uint8_t num_addr; /*!< The number of address in the gattc cache address list */
|
||||
esp_bd_addr_t *addr_list; /*!< The pointer to the address list which has been get from the gattc cache */
|
||||
} get_addr_list; /*!< Gatt client callback param of ESP_GATTC_GET_ADDR_LIST_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GATTC_QUEUE_FULL_EVT
|
||||
@ -784,6 +801,41 @@ esp_err_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gattc_if,
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_cache_refresh(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
* @brief Add or delete the associated address with the source address.
|
||||
* Note: The role of this API is mainly when the client side has stored a server-side database,
|
||||
* when it needs to connect another device, but the device's attribute database is the same
|
||||
* as the server database stored on the client-side, calling this API can use the database
|
||||
* that the device has stored used as the peer server database to reduce the attribute
|
||||
* database search and discovery process and speed up the connection time.
|
||||
* The associated address mains that device want to used the database has stored in the local cache.
|
||||
* The source address mains that device want to share the database to the associated address device.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] src_addr: the source address which provide the attribute table.
|
||||
* @param[in] assoc_addr: the associated device address which went to share the attribute table with the source address.
|
||||
* @param[in] is_assoc: true add the associated device address, false remove the associated device address.
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_cache_assoc(esp_gatt_if_t gattc_if, esp_bd_addr_t src_addr,
|
||||
esp_bd_addr_t assoc_addr, bool is_assoc);
|
||||
/**
|
||||
* @brief Get the address list which has store the attribute table in the gattc cache. There will
|
||||
* callback ESP_GATTC_GET_ADDR_LIST_EVT event when get address list complete.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gattc_cache_get_addr_list(esp_gatt_if_t gattc_if);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
635
tools/sdk/include/bluedroid/api/esp_hf_client_api.h
Normal file
635
tools/sdk/include/bluedroid/api/esp_hf_client_api.h
Normal file
@ -0,0 +1,635 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_HF_CLIENT_API_H__
|
||||
#define __ESP_HF_CLIENT_API_H__
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_hf_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_BT_HF_CLIENT_NUMBER_LEN (32)
|
||||
#define ESP_BT_HF_CLIENT_OPERATOR_NAME_LEN (16)
|
||||
|
||||
/// Bluetooth HFP RFCOMM connection and service level connection status
|
||||
typedef enum {
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED = 0, /*!< RFCOMM data link channel released */
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING, /*!< connecting remote device on the RFCOMM data link*/
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_CONNECTED, /*!< RFCOMM connection established */
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_SLC_CONNECTED, /*!< service level connection established */
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTING, /*!< disconnecting with remote device on the RFCOMM dat link*/
|
||||
} esp_hf_client_connection_state_t;
|
||||
|
||||
/// Bluetooth HFP audio connection status
|
||||
typedef enum {
|
||||
ESP_HF_CLIENT_AUDIO_STATE_DISCONNECTED = 0, /*!< audio connection released */
|
||||
ESP_HF_CLIENT_AUDIO_STATE_CONNECTING, /*!< audio connection has been initiated */
|
||||
ESP_HF_CLIENT_AUDIO_STATE_CONNECTED, /*!< audio connection is established */
|
||||
ESP_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC, /*!< mSBC audio connection is estalibshed */
|
||||
} esp_hf_client_audio_state_t;
|
||||
|
||||
/// in-band ring tone state
|
||||
typedef enum {
|
||||
ESP_HF_CLIENT_IN_BAND_RINGTONE_NOT_PROVIDED = 0,
|
||||
ESP_HF_CLIENT_IN_BAND_RINGTONE_PROVIDED,
|
||||
} esp_hf_client_in_band_ring_state_t;
|
||||
|
||||
/* features masks of AG */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_3WAY 0x01 /* Three-way calling */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECNR 0x02 /* Echo cancellation and/or noise reduction */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VREC 0x04 /* Voice recognition */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_INBAND 0x08 /* In-band ring tone */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_VTAG 0x10 /* Attach a phone number to a voice tag */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_REJECT 0x20 /* Ability to reject incoming call */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECS 0x40 /* Enhanced Call Status */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_ECC 0x80 /* Enhanced Call Control */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_EXTERR 0x100 /* Extended error codes */
|
||||
#define ESP_HF_CLIENT_PEER_FEAT_CODEC 0x200 /* Codec Negotiation */
|
||||
|
||||
/* CHLD feature masks of AG */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL 0x01 /* 0 Release waiting call or held calls */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_ACC 0x02 /* 1 Release active calls and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_REL_X 0x04 /* 1x Release specified active call only */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_HOLD_ACC 0x08 /* 2 Active calls on hold and accept other waiting or held call */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_PRIV_X 0x10 /* 2x Request private mode with specified call(put the rest on hold */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE 0x20 /* 3 Add held call to multiparty */
|
||||
#define ESP_HF_CLIENT_CHLD_FEAT_MERGE_DETACH 0x40 /* 4 Connect two calls and leave(disconnct from multiparty */
|
||||
|
||||
/// HF CLIENT callback events
|
||||
typedef enum {
|
||||
ESP_HF_CLIENT_CONNECTION_STATE_EVT = 0, /*!< connection state changed event */
|
||||
ESP_HF_CLIENT_AUDIO_STATE_EVT, /*!< audio connection state change event */
|
||||
ESP_HF_CLIENT_BVRA_EVT, /*!< voice recognition state change event */
|
||||
ESP_HF_CLIENT_CIND_CALL_EVT, /*!< call indication */
|
||||
ESP_HF_CLIENT_CIND_CALL_SETUP_EVT, /*!< call setup indication */
|
||||
ESP_HF_CLIENT_CIND_CALL_HELD_EVT, /*!< call held indication */
|
||||
ESP_HF_CLIENT_CIND_SERVICE_AVAILABILITY_EVT, /*!< network service availability indication */
|
||||
ESP_HF_CLIENT_CIND_SIGNAL_STRENGTH_EVT, /*!< signal strength indication */
|
||||
ESP_HF_CLIENT_CIND_ROAMING_STATUS_EVT, /*!< roaming status indication */
|
||||
ESP_HF_CLIENT_CIND_BATTERY_LEVEL_EVT, /*!< battery level indication */
|
||||
ESP_HF_CLIENT_COPS_CURRENT_OPERATOR_EVT, /*!< current operator information */
|
||||
ESP_HF_CLIENT_BTRH_EVT, /*!< call response and hold event */
|
||||
ESP_HF_CLIENT_CLIP_EVT, /*!< Calling Line Identification notification */
|
||||
ESP_HF_CLIENT_CCWA_EVT, /*!< call waiting notification */
|
||||
ESP_HF_CLIENT_CLCC_EVT, /*!< list of current calls notification */
|
||||
ESP_HF_CLIENT_VOLUME_CONTROL_EVT, /*!< audio volume control command from AG, provided by +VGM or +VGS message */
|
||||
ESP_HF_CLIENT_AT_RESPONSE_EVT, /*!< AT command response event */
|
||||
ESP_HF_CLIENT_CNUM_EVT, /*!< subscriber information response from AG */
|
||||
ESP_HF_CLIENT_BSIR_EVT, /*!< setting of in-band ring tone */
|
||||
ESP_HF_CLIENT_BINP_EVT, /*!< requested number of last voice tag from AG */
|
||||
ESP_HF_CLIENT_RING_IND_EVT, /*!< ring indication event */
|
||||
} esp_hf_client_cb_event_t;
|
||||
|
||||
/// HFP client callback parameters
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CONNECTION_STATE_EVT
|
||||
*/
|
||||
struct hf_client_conn_stat_param {
|
||||
esp_hf_client_connection_state_t state; /*!< HF connection state */
|
||||
uint32_t peer_feat; /*!< AG supported features */
|
||||
uint32_t chld_feat; /*!< AG supported features on call hold and multiparty services */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
} conn_stat; /*!< HF callback param of ESP_HF_CLIENT_CONNECTION_STATE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_AUDIO_STATE_EVT
|
||||
*/
|
||||
struct hf_client_audio_stat_param {
|
||||
esp_hf_client_audio_state_t state; /*!< audio connection state */
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
} audio_stat; /*!< HF callback param of ESP_HF_CLIENT_AUDIO_STATE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_BVRA_EVT
|
||||
*/
|
||||
struct hf_client_bvra_param {
|
||||
esp_hf_vr_state_t value; /*!< voice recognition state */
|
||||
} bvra; /*!< HF callback param of ESP_HF_CLIENT_BVRA_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_SERVICE_AVAILABILITY_EVT
|
||||
*/
|
||||
struct hf_client_service_availability_param {
|
||||
esp_hf_service_availability_status_t status; /*!< service availability status */
|
||||
} service_availability; /*!< HF callback param of ESP_HF_CLIENT_CIND_SERVICE_AVAILABILITY_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_ROAMING_STATUS_EVT
|
||||
*/
|
||||
struct hf_client_network_roaming_param {
|
||||
esp_hf_roaming_status_t status; /*!< roaming status */
|
||||
} roaming; /*!< HF callback param of ESP_HF_CLIENT_CIND_ROAMING_STATUS_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_SIGNAL_STRENGTH_EVT
|
||||
*/
|
||||
struct hf_client_signal_strength_ind_param {
|
||||
int value; /*!< singal strength value, ranges from 0 to 5 */
|
||||
} signal_strength; /*!< HF callback param of ESP_HF_CLIENT_CIND_SIGNAL_STRENGTH_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_BATTERY_LEVEL_EVT
|
||||
*/
|
||||
struct hf_client_battery_level_ind_param {
|
||||
int value; /*!< battery charge value, ranges from 0 to 5 */
|
||||
} battery_level; /*!< HF callback param of ESP_HF_CLIENT_CIND_BATTERY_LEVEL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_COPS_CURRENT_OPERATOR_EVT
|
||||
*/
|
||||
struct hf_client_current_operator_param {
|
||||
const char *name; /*!< name of the network operator */
|
||||
} cops; /*!< HF callback param of ESP_HF_CLIENT_COPS_CURRENT_OPERATOR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_CALL_EVT
|
||||
*/
|
||||
struct hf_client_call_ind_param {
|
||||
esp_hf_call_status_t status; /*!< call status indicator */
|
||||
} call; /*!< HF callback param of ESP_HF_CLIENT_CIND_CALL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_CALL_SETUP_EVT
|
||||
*/
|
||||
struct hf_client_call_setup_ind_param {
|
||||
esp_hf_call_setup_status_t status; /*!< call setup status indicator */
|
||||
} call_setup; /*!< HF callback param of ESP_HF_CLIENT_BVRA_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CIND_CALL_HELD_EVT
|
||||
*/
|
||||
struct hf_client_call_held_ind_param {
|
||||
esp_hf_call_held_status_t status; /*!< bluetooth proprietary call hold status indocator */
|
||||
} call_held; /*!< HF callback param of ESP_HF_CLIENT_CIND_CALL_HELD_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_BTRH_EVT
|
||||
*/
|
||||
struct hf_client_btrh_param {
|
||||
esp_hf_btrh_status_t status; /*!< call hold and response status result code */
|
||||
} btrh; /*!< HF callback param of ESP_HF_CLIENT_BRTH_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CLIP_EVT
|
||||
*/
|
||||
struct hf_client_clip_param {
|
||||
const char *number; /*!< phone number string of call */
|
||||
} clip; /*!< HF callback param of ESP_HF_CLIENT_CLIP_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CCWA_EVT
|
||||
*/
|
||||
struct hf_client_ccwa_param {
|
||||
const char *number; /*!< phone number string of waiting call */
|
||||
} ccwa; /*!< HF callback param of ESP_HF_CLIENT_BVRA_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CLCC_EVT
|
||||
*/
|
||||
struct hf_client_clcc_param {
|
||||
int idx; /*!< numbering(starting with 1) of the call */
|
||||
esp_hf_current_call_direction_t dir; /*!< direction of the call */
|
||||
esp_hf_current_call_status_t status; /*!< status of the call */
|
||||
esp_hf_current_call_mpty_type_t mpty; /*!< multi-party flag */
|
||||
char *number; /*!< phone number(optional) */
|
||||
} clcc; /*!< HF callback param of ESP_HF_CLIENT_CLCC_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_VOLUME_CONTROL_EVT
|
||||
*/
|
||||
struct hf_client_volume_control_param {
|
||||
esp_hf_volume_control_target_t type; /*!< volume control target, speaker or microphone */
|
||||
int volume; /*!< gain, ranges from 0 to 15 */
|
||||
} volume_control; /*!< HF callback param of ESP_HF_CLIENT_VOLUME_CONTROL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_AT_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_client_at_response_param {
|
||||
esp_hf_at_response_code_t code; /*!< AT response code */
|
||||
esp_hf_cme_err_t cme; /*!< Extended Audio Gateway Error Result Code */
|
||||
} at_response; /*!< HF callback param of ESP_HF_CLIENT_AT_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_CNUM_EVT
|
||||
*/
|
||||
struct hf_client_cnum_param {
|
||||
const char *number; /*!< phone number string */
|
||||
esp_hf_subscriber_service_type_t type; /*!< service type that the phone number relates to */
|
||||
} cnum; /*!< HF callback param of ESP_HF_CLIENT_CNUM_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_BSIR_EVT
|
||||
*/
|
||||
struct hf_client_bsirparam {
|
||||
esp_hf_client_in_band_ring_state_t state; /*!< setting state of in-band ring tone */
|
||||
} bsir; /*!< HF callback param of ESP_HF_CLIENT_BSIR_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CLIENT_BINP_EVT
|
||||
*/
|
||||
struct hf_client_binp_param {
|
||||
const char *number; /*!< phone number corresponding to the last voice tag in the HF */
|
||||
} binp; /*!< HF callback param of ESP_HF_CLIENT_BINP_EVT */
|
||||
|
||||
} esp_hf_client_cb_param_t;
|
||||
|
||||
/**
|
||||
* @brief HFP client incoming data callback function, the callback is useful in case of
|
||||
* Voice Over HCI.
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
* buffer is allocated inside bluetooth protocol stack and will be released after
|
||||
* invoke of the callback is finished.
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
*/
|
||||
typedef void (* esp_hf_client_incoming_data_cb_t)(const uint8_t *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief HFP client outgoing data callback function, the callback is useful in case of
|
||||
* Voice Over HCI. Once audio connection is set up and the application layer has
|
||||
* prepared data to send, the lower layer will call this function to read data
|
||||
* and then send. This callback is supposed to be implemented as non-blocking,
|
||||
* and if data is not enough, return value 0 is supposed.
|
||||
*
|
||||
* @param[in] buf : pointer to incoming data(payload of HCI synchronous data packet), the
|
||||
* buffer is allocated inside bluetooth protocol stack and will be released after
|
||||
* invoke of the callback is finished.
|
||||
* @param[in] len : size(in bytes) in buf
|
||||
* @param[out] length of data successfully read
|
||||
*/
|
||||
typedef uint32_t (* esp_hf_client_outgoing_data_cb_t)(uint8_t *buf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief HFP client callback function type
|
||||
*
|
||||
* @param event : Event type
|
||||
*
|
||||
* @param param : Pointer to callback parameter
|
||||
*/
|
||||
typedef void (* esp_hf_client_cb_t)(esp_hf_client_cb_event_t event, esp_hf_client_cb_param_t *param);
|
||||
|
||||
/**
|
||||
* @brief Register application callback function to HFP client module. This function should be called
|
||||
* only after esp_bluedroid_enable() completes successfully, used by HFP client
|
||||
*
|
||||
* @param[in] callback: HFP client event callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_register_callback(esp_hf_client_cb_t callback);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Initialize the bluetooth HFP client module. This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_init(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief De-initialize for HFP client module. This function
|
||||
* should be called only after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_deinit(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Connect to remote bluetooth HFP audio gateway(AG) device, must after esp_a2d_hf_client_init()
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: connect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_connect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disconnect from the remote HFP audio gateway
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_disconnect(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Create audio connection with remote HFP AG. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_connect_audio(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Release the established audio connection with remote HFP AG.
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Enable voice recognition in the AG. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_start_voice_recognition(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disable voice recognition in the AG. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_stop_voice_recognition(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Volume synchronization with AG. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] type: volume control target, speaker or microphone
|
||||
* @param[in] volume: gain of the speaker of microphone, ranges 0 to 15
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_volume_update(esp_hf_volume_control_target_t type, int volume);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Place a call with a specified number, if number is NULL, last called number is
|
||||
* called. As a precondition to use this API, Service Level Connection shall
|
||||
* exist with AG
|
||||
*
|
||||
* @param[in] number: number string of the call. If NULL, the last number is called(aka re-dial)
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_dial(const char *number);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Place a call with number specified by location(speed dial). As a precondition,
|
||||
* to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] location: location of the number in the memory
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
|
||||
esp_err_t esp_hf_client_dial_memory(int location);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Send call hold and multiparty commands, or enhanced call control commands(Use AT+CHLD).
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] chld: AT+CHLD call hold and multiparty handling AT command.
|
||||
* @param[in] idx: used in Enhanced Call Control Mechanisms, used if chld is
|
||||
* ESP_HF_CHLD_TYPE_REL_X or ESP_HF_CHLD_TYPE_PRIV_X
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_send_chld_cmd(esp_hf_chld_type_t chld, int idx);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Send response and hold action command(Send AT+BTRH command)
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] btrh: response and hold action to send
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_send_btrh_cmd(esp_hf_btrh_cmd_t btrh);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Answer an incoming call(send ATA command). As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_answer_call(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Reject an incoming call(send AT+CHUP command), As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_reject_call(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Query list of current calls in AG(send AT+CLCC command), As a precondition to use this API,
|
||||
* Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_query_current_calls(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Query the name of currently selected network operator in AG(use AT+COPS commands)
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_query_current_operator_name(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get subscriber information number from AG(send AT+CNUM command)
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_retrieve_subscriber_info(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Transmit DTMF codes during an ongoing call(use AT+VTS commands)
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @param[in] code: dtmf code, single ascii character in the set 0-9, #, *, A-D
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_send_dtmf(char code);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Request a phone number from AG corresponding to last voice tag recorded
|
||||
* (send AT+BINP command). As a precondition to use this API, Service Level
|
||||
* Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_request_last_voice_tag_number(void);
|
||||
|
||||
/**
|
||||
* @brief Register HFP client data output function; the callback is only used in
|
||||
* the case that Voice Over HCI is enabled.
|
||||
*
|
||||
* @param[in] recv: HFP client incoming data callback function
|
||||
* @param[in] send: HFP client outgoing data callback function
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: if callback is a NULL function pointer
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t recv,
|
||||
esp_hf_client_outgoing_data_cb_t send);
|
||||
|
||||
/**
|
||||
* @brief Trigger the lower-layer to fetch and send audio data. This function is only
|
||||
* only used in the case that Voice Over HCI is enabled. Precondition is that
|
||||
* the HFP audio connection is connected. After this function is called, lower
|
||||
* layer will invoke esp_hf_client_outgoing_data_cb_t to fetch data
|
||||
*
|
||||
*/
|
||||
void esp_hf_client_outgoing_data_ready(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize the down sampling converter. This is a utility function that can
|
||||
* only be used in the case that Voice Over HCI is enabled.
|
||||
*
|
||||
* @param[in] src_sps: original samples per second(source audio data, i.e. 48000, 32000,
|
||||
* 16000, 44100, 22050, 11025)
|
||||
* @param[in] bits: number of bits per pcm sample (16)
|
||||
* @param[in] channels: number of channels (i.e. mono(1), stereo(2)...)
|
||||
*/
|
||||
void esp_hf_client_pcm_resample_init(uint32_t src_sps, uint32_t bits, uint32_t channels);
|
||||
|
||||
/**
|
||||
* @brief Down sampling utility to convert high sampling rate into 8K/16bits 1-channel mode PCM
|
||||
* samples. This can only be used in the case that Voice Over HCI is enabled.
|
||||
*
|
||||
* @param[in] src: pointer to the buffer where the original smapling PCM are stored
|
||||
* @param[in] in_bytes: length of the input PCM sample buffer in byte
|
||||
* @param[in] dst: pointer to the buffer which is to be used to store the converted PCM samples
|
||||
*
|
||||
* @return number of samples converted
|
||||
*/
|
||||
int32_t esp_hf_client_pcm_resample(void *src, uint32_t in_bytes, void *dst);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __ESP_HF_CLIENT_API_H__ */
|
181
tools/sdk/include/bluedroid/api/esp_hf_defs.h
Normal file
181
tools/sdk/include/bluedroid/api/esp_hf_defs.h
Normal file
@ -0,0 +1,181 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_HF_DEFS_H__
|
||||
#define __ESP_HF_DEFS_H__
|
||||
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/// Bluetooth HFP audio volume control target
|
||||
typedef enum {
|
||||
ESP_HF_VOLUME_CONTROL_TARGET_SPK = 0, /*!< speaker */
|
||||
ESP_HF_VOLUME_CONTROL_TARGET_MIC, /*!< microphone */
|
||||
} esp_hf_volume_control_target_t;
|
||||
|
||||
/// +CIND roaming status indicator values
|
||||
typedef enum {
|
||||
ESP_HF_ROAMING_STATUS_INACTIVE = 0, /*!< roaming is not active */
|
||||
ESP_HF_ROAMING_STATUS_ACTIVE, /*!< a roaming is active */
|
||||
} esp_hf_roaming_status_t;
|
||||
|
||||
/// +CIND call status indicator values
|
||||
typedef enum {
|
||||
ESP_HF_CALL_STATUS_NO_CALLS = 0, /*!< no call in progress */
|
||||
ESP_HF_CALL_STATUS_CALL_IN_PROGRESS = 1, /*!< call is present(active or held) */
|
||||
} esp_hf_call_status_t;
|
||||
|
||||
/// +CIND call setup status indicator values
|
||||
typedef enum {
|
||||
ESP_HF_CALL_SETUP_STATUS_NONE = 0, /*!< no call setup in progress */
|
||||
ESP_HF_CALL_SETUP_STATUS_INCOMING = 1, /*!< incoming call setup in progress */
|
||||
ESP_HF_CALL_SETUP_STATUS_OUTGOING_DIALING = 2, /*!< outgoing call setup in dialing state */
|
||||
ESP_HF_CALL_SETUP_STATUS_OUTGOING_ALERTING = 3, /*!< outgoing call setup in alerting state */
|
||||
} esp_hf_call_setup_status_t;
|
||||
|
||||
/// +CIND call held indicator values
|
||||
typedef enum {
|
||||
ESP_HF_CALL_HELD_STATUS_NONE = 0, /*!< no calls held */
|
||||
ESP_HF_CALL_HELD_STATUS_HELD_AND_ACTIVE = 1, /*!< both active and held call */
|
||||
ESP_HF_CALL_HELD_STATUS_HELD = 2, /*!< call on hold, no active call*/
|
||||
} esp_hf_call_held_status_t;
|
||||
|
||||
/// +CIND network service availability status
|
||||
typedef enum {
|
||||
ESP_HF_SERVICE_AVAILABILITY_STATUS_UNAVAILABLE = 0, /*!< service not available */
|
||||
ESP_HF_SERVICE_AVAILABILITY_STATUS_AVAILABLE, /*!< service available */
|
||||
} esp_hf_service_availability_status_t;
|
||||
|
||||
/// +CLCC status of the call
|
||||
typedef enum {
|
||||
ESP_HF_CURRENT_CALL_STATUS_ACTIVE = 0, /*!< active */
|
||||
ESP_HF_CURRENT_CALL_STATUS_HELD = 1, /*!< held */
|
||||
ESP_HF_CURRENT_CALL_STATUS_DIALING = 2, /*!< dialing (outgoing calls only) */
|
||||
ESP_HF_CURRENT_CALL_STATUS_ALERTING = 3, /*!< alerting (outgoing calls only) */
|
||||
ESP_HF_CURRENT_CALL_STATUS_INCOMING = 4, /*!< incoming (incoming calls only) */
|
||||
ESP_HF_CURRENT_CALL_STATUS_WAITING = 5, /*!< waiting (incoming calls only) */
|
||||
ESP_HF_CURRENT_CALL_STATUS_HELD_BY_RESP_HOLD = 6, /*!< call held by response and hold */
|
||||
} esp_hf_current_call_status_t;
|
||||
|
||||
/// +CLCC direction of the call
|
||||
typedef enum {
|
||||
ESP_HF_CURRENT_CALL_DIRECTION_OUTGOING = 0, /*!< outgoing */
|
||||
ESP_HF_CURRENT_CALL_DIRECTION_INCOMING = 1, /*!< incoming */
|
||||
} esp_hf_current_call_direction_t;
|
||||
|
||||
/// +CLCC multi-party call flag
|
||||
typedef enum {
|
||||
ESP_HF_CURRENT_CALL_MPTY_TYPE_SINGLE = 0, /*!< not a member of a multi-party call */
|
||||
ESP_HF_CURRENT_CALL_MPTY_TYPE_MULTI = 1, /*!< member of a multi-party call */
|
||||
} esp_hf_current_call_mpty_type_t;
|
||||
|
||||
/// +CLCC call mode
|
||||
typedef enum {
|
||||
ESP_HF_CURRENT_CALL_MODE_VOICE = 0,
|
||||
ESP_HF_CURRENT_CALL_MODE_DATA = 1,
|
||||
ESP_HF_CURRENT_CALL_MODE_FAX = 2,
|
||||
} esp_hf_current_call_mode_t;
|
||||
|
||||
/// +CLCC address type
|
||||
typedef enum {
|
||||
ESP_HF_CALL_ADDR_TYPE_UNKNOWN = 0x81, /*!< unkown address type */
|
||||
ESP_HF_CALL_ADDR_TYPE_INTERNATIONAL = 0x91, /*!< international address */
|
||||
} esp_hf_call_addr_type_t;
|
||||
|
||||
/// +CNUM service type of the phone number
|
||||
typedef enum {
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_UNKNOWN = 0, /*!< unknown */
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_VOICE, /*!< voice service */
|
||||
ESP_HF_SUBSCRIBER_SERVICE_TYPE_FAX, /*!< fax service */
|
||||
} esp_hf_subscriber_service_type_t;
|
||||
|
||||
/// +BTRH response and hold result code
|
||||
typedef enum {
|
||||
ESP_HF_BTRH_STATUS_HELD = 0, /*!< incoming call is put on held in AG */
|
||||
ESP_HF_BTRH_STATUS_ACCEPTED, /*!< held incoming call is accepted in AG */
|
||||
ESP_HF_BTRH_STATUS_REJECTED, /*!< held incoming call is rejected in AG */
|
||||
} esp_hf_btrh_status_t;
|
||||
|
||||
/// AT+BTRH response and hold action code
|
||||
typedef enum {
|
||||
ESP_HF_BTRH_CMD_HOLD = 0, /*!< put the incoming call on hold */
|
||||
ESP_HF_BTRH_CMD_ACCEPT = 1, /*!< accept a held incoming call */
|
||||
ESP_HF_BTRH_CMD_REJECT = 2, /*!< reject a held incoming call */
|
||||
} esp_hf_btrh_cmd_t;
|
||||
|
||||
/// response indication codes for AT commands
|
||||
typedef enum {
|
||||
ESP_HF_AT_RESPONSE_CODE_OK = 0, /*!< acknoweledges execution of a command line */
|
||||
ESP_HF_AT_RESPONSE_CODE_ERR, /*!< command not accepted */
|
||||
ESP_HF_AT_RESPONSE_CODE_NO_CARRIER, /*!< connection terminated */
|
||||
ESP_HF_AT_RESPONSE_CODE_BUSY, /*!< busy signal detected */
|
||||
ESP_HF_AT_RESPONSE_CODE_NO_ANSWER, /*!< connection completion timeout */
|
||||
ESP_HF_AT_RESPONSE_CODE_DELAYED, /*!< delayed */
|
||||
ESP_HF_AT_RESPONSE_CODE_BLACKLISTED, /*!< blacklisted */
|
||||
ESP_HF_AT_RESPONSE_CODE_CME, /*!< CME error */
|
||||
} esp_hf_at_response_code_t;
|
||||
|
||||
/// voice recognition state
|
||||
typedef enum {
|
||||
ESP_HF_VR_STATE_DISABLED = 0, /*!< voice recognition disabled */
|
||||
ESP_HF_VR_STATE_ENABLED, /*!< voice recognition enabled */
|
||||
} esp_hf_vr_state_t;
|
||||
|
||||
/// AT+CHLD command values
|
||||
typedef enum {
|
||||
ESP_HF_CHLD_TYPE_REL = 0, /*!< <0>, Terminate all held or set UDUB("busy") to a waiting call */
|
||||
ESP_HF_CHLD_TYPE_REL_ACC, /*!< <1>, Terminate all active calls and accepts a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_HOLD_ACC, /*!< <2>, Hold all active calls and accepts a waiting/held call */
|
||||
ESP_HF_CHLD_TYPE_MERGE, /*!< <3>, Add all held calls to a conference */
|
||||
ESP_HF_CHLD_TYPE_MERGE_DETACH, /*!< <4>, connect the two calls and disconnects the subscriber from both calls */
|
||||
ESP_HF_CHLD_TYPE_REL_X, /*!< <1x>, releases specified calls only */
|
||||
ESP_HF_CHLD_TYPE_PRIV_X, /*!< <2x>, request private consultation mode with specified call */
|
||||
} esp_hf_chld_type_t;
|
||||
|
||||
/// Extended Audio Gateway Error Result Code Response
|
||||
typedef enum {
|
||||
ESP_HF_CME_AG_FAILURE = 0, /*!< ag failure */
|
||||
ESP_HF_CME_NO_CONNECTION_TO_PHONE = 1, /*!< no connection to phone */
|
||||
ESP_HF_CME_OPERATION_NOT_ALLOWED = 3, /*!< operation not allowed */
|
||||
ESP_HF_CME_OPERATION_NOT_SUPPORTED = 4, /*!< operation not supported */
|
||||
ESP_HF_CME_PH_SIM_PIN_REQUIRED = 5, /*!< PH-SIM PIN Required */
|
||||
ESP_HF_CME_SIM_NOT_INSERTED = 10, /*!< SIM not inserted */
|
||||
ESP_HF_CME_SIM_PIN_REQUIRED = 11, /*!< SIM PIN required */
|
||||
ESP_HF_CME_SIM_PUK_REQUIRED = 12, /*!< SIM PUK required */
|
||||
ESP_HF_CME_SIM_FAILURE = 13, /*!< SIM failure */
|
||||
ESP_HF_CME_SIM_BUSY = 14, /*!< SIM busy */
|
||||
ESP_HF_CME_INCORRECT_PASSWORD = 16, /*!< incorrect password */
|
||||
ESP_HF_CME_SIM_PIN2_REQUIRED = 17, /*!< SIM PIN2 required */
|
||||
ESP_HF_CME_SIM_PUK2_REQUIRED = 18, /*!< SIM PUK2 required */
|
||||
ESP_HF_CME_MEMEORY_FULL = 20, /*!< memory full */
|
||||
ESP_HF_CME_INVALID_INDEX = 21, /*!< invalid index */
|
||||
ESP_HF_CME_MEMEORY_FAILURE = 23, /*!< memory failure */
|
||||
ESP_HF_CME_TEXT_STRING_TOO_LONG = 24, /*!< test string too long */
|
||||
ESP_HF_CME_INVALID_CHARACTERS_IN_TEXT_STRING = 25, /*!< invalid characters in text string */
|
||||
ESP_HF_CME_DIAL_STRING_TOO_LONG = 26, /*!< dial string too long*/
|
||||
ESP_HF_CME_INVALID_CHARACTERS_IN_DIAL_STRING = 27, /*!< invalid characters in dial string */
|
||||
ESP_HF_CME_NO_NETWORK_SERVICE = 30, /*!< no network service */
|
||||
ESP_HF_CME_NETWORK_TIMEOUT = 31, /*!< network timeout */
|
||||
ESP_HF_CME_NETWORK_NOT_ALLOWED = 32, /*!< network not allowed --emergency calls only */
|
||||
} esp_hf_cme_err_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESP_HF_DEFS_H__ */
|
@ -31,13 +31,13 @@ typedef enum {
|
||||
} esp_spp_status_t;
|
||||
|
||||
/* Security Setting Mask */
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta_api.h*/
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta_api.h*/
|
||||
#define ESP_SPP_SEC_ENCRYPT 0x0024 /*!< Encryption required. relate to BTA_SEC_ENCRYPT in bta_api.h*/
|
||||
#define ESP_SPP_SEC_MODE4_LEVEL4 0x0040 /*!< Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption relate to BTA_SEC_MODE4_LEVEL4 in bta_api.h*/
|
||||
#define ESP_SPP_SEC_MITM 0x3000 /*!< Man-In-The_Middle protection relate to BTA_SEC_MITM in bta_api.h*/
|
||||
#define ESP_SPP_SEC_IN_16_DIGITS 0x4000 /*!< Min 16 digit for pin code relate to BTA_SEC_IN_16_DIGITS in bta_api.h*/
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_ENCRYPT 0x0024 /*!< Encryption required. relate to BTA_SEC_ENCRYPT in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_MODE4_LEVEL4 0x0040 /*!< Mode 4 level 4 service, i.e. incoming/outgoing MITM and P-256 encryption relate to BTA_SEC_MODE4_LEVEL4 in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_MITM 0x3000 /*!< Man-In-The_Middle protection relate to BTA_SEC_MITM in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_IN_16_DIGITS 0x4000 /*!< Min 16 digit for pin code relate to BTA_SEC_IN_16_DIGITS in bta/bta_api.h*/
|
||||
typedef uint16_t esp_spp_sec_t;
|
||||
|
||||
typedef enum {
|
||||
@ -62,9 +62,9 @@ typedef enum {
|
||||
ESP_SPP_CLOSE_EVT = 27, /*!< When SPP connection closed, the event comes */
|
||||
ESP_SPP_START_EVT = 28, /*!< When SPP server started, the event comes */
|
||||
ESP_SPP_CL_INIT_EVT = 29, /*!< When SPP client initiated a connection, the event comes */
|
||||
ESP_SPP_DATA_IND_EVT = 30, /*!< When SPP connection received data, the event comes */
|
||||
ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes */
|
||||
ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes */
|
||||
ESP_SPP_DATA_IND_EVT = 30, /*!< When SPP connection received data, the event comes, olny for ESP_SPP_MODE_CB */
|
||||
ESP_SPP_CONG_EVT = 31, /*!< When SPP connection congestion status changed, the event comes, olny for ESP_SPP_MODE_CB */
|
||||
ESP_SPP_WRITE_EVT = 33, /*!< When SPP write operation completes, the event comes, olny for ESP_SPP_MODE_CB */
|
||||
ESP_SPP_SRV_OPEN_EVT = 34, /*!< When SPP Server connection open, the event comes */
|
||||
} esp_spp_cb_event_t;
|
||||
|
||||
@ -95,6 +95,7 @@ typedef union {
|
||||
struct spp_open_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
int fd; /*!< The file descriptor olny for ESP_SPP_MODE_VFS*/
|
||||
esp_bd_addr_t rem_bda; /*!< The peer address */
|
||||
} open; /*!< SPP callback param of ESP_SPP_OPEN_EVT */
|
||||
|
||||
@ -105,6 +106,7 @@ typedef union {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint32_t new_listen_handle; /*!< The new listen handle */
|
||||
int fd; /*!< The file descriptor olny for ESP_SPP_MODE_VFS*/
|
||||
esp_bd_addr_t rem_bda; /*!< The peer address */
|
||||
} srv_open; /*!< SPP callback param of ESP_SPP_SRV_OPEN_EVT */
|
||||
/**
|
||||
@ -142,7 +144,6 @@ typedef union {
|
||||
struct spp_write_evt_param {
|
||||
esp_spp_status_t status; /*!< status */
|
||||
uint32_t handle; /*!< The connection handle */
|
||||
uint32_t req_id; /*!< The req_id in the associated BTA_JvRfcommWrite() */
|
||||
int len; /*!< The length of the data written. */
|
||||
bool cong; /*!< congestion status */
|
||||
} write; /*!< SPP callback param of ESP_SPP_WRITE_EVT */
|
||||
@ -275,7 +276,7 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function closes an SPP connection.
|
||||
* @brief This function is used to write data, olny for ESP_SPP_MODE_CB.
|
||||
*
|
||||
* @param[in] handle: The connection handle.
|
||||
* @param[in] len: The length of the data written.
|
||||
@ -287,6 +288,16 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
*/
|
||||
esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to register VFS.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_spp_vfs_register(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -24,10 +24,10 @@
|
||||
#ifndef AVCT_INT_H
|
||||
#define AVCT_INT_H
|
||||
|
||||
#include "avct_api.h"
|
||||
#include "stack/avct_api.h"
|
||||
#include "avct_defs.h"
|
||||
#include "l2c_api.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "stack/l2c_api.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** constants
|
||||
|
@ -24,7 +24,7 @@
|
||||
******************************************************************************/
|
||||
#ifndef AVDT_DEFS_H
|
||||
#define AVDT_DEFS_H
|
||||
#include "bt_target.h"
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#if (AVDT_INCLUDED == TRUE)
|
||||
|
||||
|
@ -24,12 +24,12 @@
|
||||
#ifndef AVDT_INT_H
|
||||
#define AVDT_INT_H
|
||||
|
||||
#include "avdt_api.h"
|
||||
#include "avdtc_api.h"
|
||||
#include "stack/avdt_api.h"
|
||||
#include "stack/avdtc_api.h"
|
||||
#include "avdt_defs.h"
|
||||
#include "l2c_api.h"
|
||||
#include "btm_api.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "stack/l2c_api.h"
|
||||
#include "stack/btm_api.h"
|
||||
#include "osi/fixed_queue.h"
|
||||
|
||||
#if (AVRC_INCLUDED == TRUE)
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#define AVRC_INT_H
|
||||
|
||||
#include "avct_defs.h"
|
||||
#include "avrc_api.h"
|
||||
#include "stack/avrc_api.h"
|
||||
|
||||
#if (AVRC_INCLUDED == TRUE)
|
||||
/* DEBUG FLAGS
|
||||
@ -70,7 +70,7 @@
|
||||
#define AVRC_VENDOR_UNIQUE_MASK 0x70 /* vendor unique id */
|
||||
|
||||
|
||||
/* Company ID is 24-bit integer We can not use the macros in bt_types.h */
|
||||
/* Company ID is 24-bit integer We can not use the macros in stack/bt_types.h */
|
||||
#define AVRC_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
|
||||
#define AVRC_BE_STREAM_TO_CO_ID(u32, p) {u32 = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
|
||||
|
||||
|
3
tools/sdk/include/bluedroid/bt.h
Normal file
3
tools/sdk/include/bluedroid/bt.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#warning "This header is deprecated, please use functions defined in esp_bt.h instead."
|
||||
#include "esp_bt.h"
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
// #include "bluetooth.h"
|
||||
#include "bt_defs.h"
|
||||
#include "common/bt_defs.h"
|
||||
|
||||
#define SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH 15
|
||||
|
||||
|
@ -25,14 +25,14 @@
|
||||
#ifndef BTA_API_H
|
||||
#define BTA_API_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_types.h"
|
||||
#include "btm_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "stack/btm_api.h"
|
||||
// #include "uipc_msg.h"
|
||||
#include "sdp_api.h"
|
||||
#include "stack/sdp_api.h"
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#include "btm_ble_api.h"
|
||||
#include "stack/btm_ble_api.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
@ -53,7 +53,7 @@ typedef UINT8 tBTA_STATUS;
|
||||
* Service ID
|
||||
*
|
||||
* NOTES: When you add a new Service ID for BTA AND require to change the value of BTA_MAX_SERVICE_ID,
|
||||
* make sure that the correct security ID of the new service from Security service definitions (btm_api.h)
|
||||
* make sure that the correct security ID of the new service from Security service definitions (stack/btm_api.h)
|
||||
* should be added to bta_service_id_to_btm_srv_id_lkup_tbl table in bta_dm_act.c.
|
||||
*/
|
||||
|
||||
@ -1022,7 +1022,7 @@ typedef struct {
|
||||
/* If the device name is known to application BTA skips the remote name request */
|
||||
BOOLEAN is_limited; /* TRUE, if the limited inquiry bit is set in the CoD */
|
||||
INT8 rssi; /* The rssi value */
|
||||
UINT8 *p_eir; /* received EIR */
|
||||
UINT8 *p_eir; /* Received EIR */
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT8 inq_result_type;
|
||||
UINT8 ble_addr_type;
|
||||
@ -1054,7 +1054,7 @@ typedef struct {
|
||||
tBTA_SERVICE_MASK services; /* Services found on peer device. */
|
||||
// btla-specific ++
|
||||
UINT8 *p_raw_data; /* Raw data for discovery DB */
|
||||
UINT32 raw_data_size; /* size of raw data */
|
||||
UINT32 raw_data_size; /* Size of raw data */
|
||||
tBT_DEVICE_TYPE device_type; /* device type in case it is BLE device */
|
||||
UINT32 num_uuids;
|
||||
UINT8 *p_uuid_list;
|
||||
@ -1075,11 +1075,17 @@ typedef union {
|
||||
tBTA_DM_INQ_RES inq_res; /* Inquiry result for a peer device. */
|
||||
tBTA_DM_INQ_CMPL inq_cmpl; /* Inquiry complete. */
|
||||
tBTA_DM_DISC_RES disc_res; /* Discovery result for a peer device. */
|
||||
tBTA_DM_DISC_BLE_RES disc_ble_res; /* discovery result for GATT based service */
|
||||
tBTA_DM_DISC_BLE_RES disc_ble_res; /* Discovery result for GATT based service */
|
||||
tBTA_DM_DI_DISC_CMPL di_disc; /* DI discovery result for a peer device */
|
||||
|
||||
} tBTA_DM_SEARCH;
|
||||
|
||||
/* Structure of search callback event and structures */
|
||||
typedef struct {
|
||||
tBTA_DM_SEARCH_EVT event; /* Search callback events */
|
||||
UINT16 len; /* Length of p_data */
|
||||
tBTA_DM_SEARCH *p_data; /* Union of all search callback structures */
|
||||
} tBTA_DM_SEARCH_PARAM;
|
||||
|
||||
/* Search callback */
|
||||
typedef void (tBTA_DM_SEARCH_CBACK)(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH *p_data);
|
||||
|
||||
@ -1089,7 +1095,7 @@ typedef void (tBTA_DM_EXEC_CBACK) (void *p_param);
|
||||
/* Encryption callback*/
|
||||
typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result);
|
||||
|
||||
/* relate to ESP_BLE_SEC_xxx in esp_gatt_defs.h */
|
||||
/* Relate to ESP_BLE_SEC_xxx in esp_gatt_defs.h */
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#define BTA_DM_BLE_SEC_NONE BTM_BLE_SEC_NONE
|
||||
#define BTA_DM_BLE_SEC_ENCRYPT BTM_BLE_SEC_ENCRYPT
|
||||
@ -1416,13 +1422,13 @@ extern void BTA_DisableTestMode(void);
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmSetDeviceName(char *p_name);
|
||||
extern void BTA_DmSetDeviceName(const char *p_name);
|
||||
|
||||
extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA_ADD_WHITELIST_CBACK *add_wl_cb);
|
||||
|
||||
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_CMPL_CB *cmpl_cb);
|
||||
extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -1902,6 +1908,7 @@ extern void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
|
||||
** scan_interval - scan interval
|
||||
** scan_window - scan window
|
||||
** scan_mode - scan mode
|
||||
** scan_duplicate_filter - scan duplicate filter
|
||||
** scan_param_setup_status_cback - Set scan param status callback
|
||||
**
|
||||
** Returns void
|
||||
@ -1909,7 +1916,7 @@ extern void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interval,
|
||||
UINT32 scan_window, tBLE_SCAN_MODE scan_mode, UINT8 scan_fil_poilcy,
|
||||
UINT8 addr_type_own, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback);
|
||||
UINT8 addr_type_own, UINT8 scan_duplicate_filter, tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -2081,6 +2088,19 @@ extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleConfigLocalPrivacy(BOOLEAN privacy_enable, tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleConfigLocalIcon
|
||||
**
|
||||
** Description set gap local icon
|
||||
**
|
||||
** Parameters: icon - appearance value.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_DmBleConfigLocalIcon(uint16_t icon);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleEnableRemotePrivacy
|
@ -26,12 +26,12 @@
|
||||
#ifndef BTA_AR_API_H
|
||||
#define BTA_AR_API_H
|
||||
|
||||
#include "avdt_api.h"
|
||||
#include "avct_api.h"
|
||||
#include "avrc_api.h"
|
||||
#include "sdp_api.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "bta_sys.h"
|
||||
#include "stack/avdt_api.h"
|
||||
#include "stack/avct_api.h"
|
||||
#include "stack/avrc_api.h"
|
||||
#include "stack/sdp_api.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
#include "bta/bta_sys.h"
|
||||
|
||||
#if (BTA_AR_INCLUDED == TRUE)
|
||||
|
@ -26,10 +26,10 @@
|
||||
#ifndef BTA_AV_API_H
|
||||
#define BTA_AV_API_H
|
||||
|
||||
#include "avrc_api.h"
|
||||
#include "avdt_api.h"
|
||||
#include "a2d_api.h"
|
||||
#include "bta_api.h"
|
||||
#include "stack/avrc_api.h"
|
||||
#include "stack/avdt_api.h"
|
||||
#include "stack/a2d_api.h"
|
||||
#include "bta/bta_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_AV_CI_H
|
||||
#define BTA_AV_CI_H
|
||||
|
||||
#include "bta_av_api.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
|
@ -24,8 +24,8 @@
|
||||
#ifndef BTA_AV_CO_H
|
||||
#define BTA_AV_CO_H
|
||||
|
||||
#include "l2c_api.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "stack/l2c_api.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_DM_CI_H
|
||||
#define BTA_DM_CI_H
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "bta/bta_api.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Function Declarations
|
||||
@ -61,18 +61,6 @@ extern void bta_dm_ci_io_req(BD_ADDR bd_addr, tBTA_IO_CAP io_cap,
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_ci_rmt_oob(BOOLEAN accept, BD_ADDR bd_addr,
|
||||
BT_OCTET16 c, BT_OCTET16 r);
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_ci_data_ready
|
||||
**
|
||||
** Description This function sends an event to indicating that the phone
|
||||
** has SCO data ready..
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_sco_ci_data_ready(UINT16 event, UINT16 sco_handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -24,30 +24,7 @@
|
||||
#ifndef BTA_DM_CO_H
|
||||
#define BTA_DM_CO_H
|
||||
|
||||
#include "bta_sys.h"
|
||||
|
||||
|
||||
#ifndef BTA_SCO_OUT_PKT_SIZE
|
||||
#define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
|
||||
#endif
|
||||
|
||||
#define BTA_SCO_CODEC_PCM 0 /* used for regular SCO */
|
||||
#define BTA_SCO_CODEC_SBC 1 /* used for WBS */
|
||||
typedef UINT8 tBTA_SCO_CODEC_TYPE;
|
||||
|
||||
#define BTA_DM_SCO_SAMP_RATE_8K 8000
|
||||
#define BTA_DM_SCO_SAMP_RATE_16K 16000
|
||||
|
||||
/* SCO codec information */
|
||||
typedef struct {
|
||||
tBTA_SCO_CODEC_TYPE codec_type;
|
||||
} tBTA_CODEC_INFO;
|
||||
|
||||
#define BTA_DM_SCO_ROUTE_PCM BTM_SCO_ROUTE_PCM
|
||||
#define BTA_DM_SCO_ROUTE_HCI BTM_SCO_ROUTE_HCI
|
||||
|
||||
typedef tBTM_SCO_ROUTE_TYPE tBTA_DM_SCO_ROUTE_TYPE;
|
||||
|
||||
#include "bta/bta_sys.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Function Declarations
|
||||
@ -135,72 +112,6 @@ extern void bta_dm_co_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r);
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_co_rmt_oob(BD_ADDR bd_addr);
|
||||
|
||||
/*****************************************************************************
|
||||
** SCO over HCI Function Declarations
|
||||
*****************************************************************************/
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_co_init
|
||||
**
|
||||
** Description This function can be used by the phone to initialize audio
|
||||
** codec or for other initialization purposes before SCO connection
|
||||
** is opened.
|
||||
**
|
||||
**
|
||||
** Returns Void.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_DM_SCO_ROUTE_TYPE bta_dm_sco_co_init(UINT32 rx_bw, UINT32 tx_bw,
|
||||
tBTA_CODEC_INFO *p_codec_info, UINT8 app_id);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_co_open
|
||||
**
|
||||
** Description This function is executed when a SCO connection is open.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_sco_co_open(UINT16 handle, UINT8 pkt_size, UINT16 event);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_co_close
|
||||
**
|
||||
** Description This function is called when a SCO connection is closed
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_sco_co_close(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_co_out_data
|
||||
**
|
||||
** Description This function is called to send SCO data over HCI.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_sco_co_out_data(BT_HDR **p_buf);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_sco_co_in_data
|
||||
**
|
||||
** Description This function is called to send incoming SCO data to application.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_dm_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
@ -25,9 +25,9 @@
|
||||
#ifndef BTA_GATT_API_H
|
||||
#define BTA_GATT_API_H
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "gatt_api.h"
|
||||
#include "list.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "stack/gatt_api.h"
|
||||
#include "osi/list.h"
|
||||
|
||||
#ifndef BTA_GATT_INCLUDED
|
||||
#warning BTA_GATT_INCLUDED not defined
|
||||
@ -183,6 +183,8 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */
|
||||
#define BTA_GATTC_READ_MULTIPLE_EVT 37 /* GATTC Read mutiple event */
|
||||
#define BTA_GATTC_QUEUE_FULL_EVT 38 /* GATTC queue full event */
|
||||
#define BTA_GATTC_ASSOC_EVT 39 /* GATTC association address event */
|
||||
#define BTA_GATTC_GET_ADDR_LIST_EVT 40 /* GATTC get address list in the cache event */
|
||||
|
||||
typedef UINT8 tBTA_GATTC_EVT;
|
||||
|
||||
@ -280,7 +282,8 @@ typedef struct {
|
||||
UINT8 id;
|
||||
UINT8 prop; /* used when attribute type is characteristic */
|
||||
BOOLEAN is_primary; /* used when attribute type is service */
|
||||
UINT16 incl_srvc_handle; /* used when attribute type is included service */
|
||||
UINT16 incl_srvc_s_handle; /* used when attribute type is included service */
|
||||
UINT16 incl_srvc_e_handle; /* used when attribute type is included service */
|
||||
}tBTA_GATTC_NV_ATTR;
|
||||
|
||||
/* callback data structure */
|
||||
@ -319,6 +322,7 @@ typedef struct {
|
||||
UINT16 start_handle;
|
||||
UINT16 end_handle;
|
||||
tBTA_GATT_ID service_uuid;
|
||||
bool is_primary;
|
||||
}tBTA_GATTC_SRVC_RES;
|
||||
|
||||
typedef struct {
|
||||
@ -364,12 +368,24 @@ typedef struct {
|
||||
BOOLEAN is_full;
|
||||
} tBTA_GATTC_QUEUE_FULL;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
} tBTA_GATTC_SET_ASSOC;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
UINT8 num_addr;
|
||||
BD_ADDR *bda_list;
|
||||
} tBTA_GATTC_GET_ADDR_LIST;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTC_IF client_if;
|
||||
UINT16 conn_id;
|
||||
BD_ADDR remote_bda;
|
||||
}tBTA_GATTC_OPEN_CLOSE;
|
||||
} tBTA_GATTC_OPEN_CLOSE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTC_IF client_if;
|
||||
@ -413,6 +429,8 @@ typedef union {
|
||||
tBTA_GATTC_CONGEST congest;
|
||||
tBTA_GATTC_QUEUE_FULL queue_full;
|
||||
tBTA_GATTC_SERVICE_CHANGE srvc_chg; /* service change event */
|
||||
tBTA_GATTC_SET_ASSOC set_assoc;
|
||||
tBTA_GATTC_GET_ADDR_LIST get_addr_list;
|
||||
} tBTA_GATTC;
|
||||
|
||||
/* GATTC enable callback function */
|
||||
@ -674,6 +692,7 @@ typedef struct
|
||||
tBT_UUID uuid;
|
||||
UINT16 handle;
|
||||
UINT16 incl_srvc_s_handle;
|
||||
UINT16 incl_srvc_e_handle;
|
||||
tBTA_GATTC_SERVICE *owning_service; /* owning service*/
|
||||
tBTA_GATTC_SERVICE *included_service;
|
||||
} __attribute__((packed)) tBTA_GATTC_INCLUDED_SVC;
|
||||
@ -1079,11 +1098,16 @@ extern void BTA_GATTC_ReadMultiple(UINT16 conn_id, tBTA_GATTC_MULTI *p_read_mult
|
||||
** Description Refresh the server cache of the remote device
|
||||
**
|
||||
** Parameters remote_bda: remote device BD address.
|
||||
** erase_flash: delete cache from nvs flash
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_Refresh(BD_ADDR remote_bda);
|
||||
extern void BTA_GATTC_Refresh(BD_ADDR remote_bda, bool erase_flash);
|
||||
|
||||
extern void BTA_GATTC_CacheAssoc(tBTA_GATTC_IF client_if, BD_ADDR src_addr, BD_ADDR assoc_addr, BOOLEAN is_assoc);
|
||||
|
||||
extern void BTA_GATTC_CacheGetAddrList(tBTA_GATTC_IF client_if);
|
||||
|
||||
|
||||
/*******************************************************************************
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_GATTC_CI_H
|
||||
#define BTA_GATTC_CI_H
|
||||
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
@ -36,7 +36,7 @@ typedef struct {
|
||||
tBTA_GATT_STATUS status;
|
||||
} tBTA_GATTC_CI_EVT;
|
||||
|
||||
#define BTA_GATTC_NV_LOAD_MAX 10
|
||||
#define BTA_GATTC_NV_LOAD_MAX 100
|
||||
|
||||
/* Read Ready Event */
|
||||
typedef struct {
|
@ -24,7 +24,8 @@
|
||||
#ifndef BTA_GATTC_CO_H
|
||||
#define BTA_GATTC_CO_H
|
||||
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
#include "osi/hash_functions.h"
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -41,8 +42,7 @@
|
||||
** Returns void.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_gattc_co_cache_open(BD_ADDR server_bda, UINT16 evt,
|
||||
UINT16 conn_id, BOOLEAN to_save);
|
||||
extern tBTA_GATT_STATUS bta_gattc_co_cache_open(BD_ADDR server_bda, BOOLEAN to_save, UINT8 *index);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -75,9 +75,8 @@ extern void bta_gattc_co_cache_close(BD_ADDR server_bda, UINT16 conn_id);
|
||||
** Returns
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_gattc_co_cache_save(BD_ADDR server_bda, UINT16 evt,
|
||||
UINT16 num_attr, tBTA_GATTC_NV_ATTR *p_attr,
|
||||
UINT16 attr_index, UINT16 conn_id);
|
||||
extern void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 num_attr,
|
||||
tBTA_GATTC_NV_ATTR *p_attr_list);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -94,8 +93,7 @@ extern void bta_gattc_co_cache_save(BD_ADDR server_bda, UINT16 evt,
|
||||
** Returns
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_gattc_co_cache_load(BD_ADDR server_bda, UINT16 evt,
|
||||
UINT16 start_index, UINT16 conn_id);
|
||||
extern tBTA_GATT_STATUS bta_gattc_co_cache_load(tBTA_GATTC_NV_ATTR *attr, UINT8 index);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -111,4 +109,32 @@ extern void bta_gattc_co_cache_load(BD_ADDR server_bda, UINT16 evt,
|
||||
*******************************************************************************/
|
||||
extern void bta_gattc_co_cache_reset(BD_ADDR server_bda);
|
||||
|
||||
extern size_t bta_gattc_get_cache_attr_length(UINT8 index);
|
||||
|
||||
extern void bta_gattc_co_cache_addr_init(void);
|
||||
|
||||
extern void bta_gattc_co_cache_addr_deinit(void);
|
||||
|
||||
extern BOOLEAN bta_gattc_co_addr_in_cache(BD_ADDR bda);
|
||||
|
||||
extern uint8_t bta_gattc_co_find_addr_in_cache(BD_ADDR bda);
|
||||
|
||||
extern uint8_t bta_gattc_co_find_hash_in_cache(hash_key_t hash_key);
|
||||
|
||||
extern UINT8 bta_gattc_co_get_addr_num(void);
|
||||
|
||||
extern void bta_gattc_co_get_addr_list(BD_ADDR *addr_list);
|
||||
|
||||
extern void bta_gattc_co_cache_addr_save(BD_ADDR bd_addr, hash_key_t hash_key);
|
||||
|
||||
extern BOOLEAN bta_gattc_co_cache_new_assoc_list(BD_ADDR src_addr, uint8_t index);
|
||||
|
||||
extern BOOLEAN bta_gattc_co_cache_append_assoc_addr(BD_ADDR src_addr, BD_ADDR assoc_addr);
|
||||
|
||||
extern BOOLEAN bta_gattc_co_cache_remove_assoc_addr(BD_ADDR src_addr, BD_ADDR assoc_addr);
|
||||
|
||||
uint8_t* bta_gattc_co_cache_find_src_addr(BD_ADDR assoc_addr, uint8_t *index);
|
||||
|
||||
extern BOOLEAN bta_gattc_co_cache_clear_assoc_addr(BD_ADDR src_addr);
|
||||
|
||||
#endif /* BTA_GATT_CO_H */
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_GATTS_CO_H
|
||||
#define BTA_GATTS_CO_H
|
||||
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
378
tools/sdk/include/bluedroid/bta/bta_hf_client_api.h
Normal file
378
tools/sdk/include/bluedroid/bta/bta_hf_client_api.h
Normal file
@ -0,0 +1,378 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014 The Android Open Source Project
|
||||
* Copyright (C) 2003-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the public interface file for the handsfree (HF role) subsystem
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_HF_CLIENT_API_H
|
||||
#define BTA_HF_CLIENT_API_H
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "bta_hfp_defs.h"
|
||||
|
||||
#if (BTA_HF_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
|
||||
/* HFP peer (AG) features*/
|
||||
#define BTA_HF_CLIENT_PEER_FEAT_3WAY 0x00000001 /* Three-way calling */
|
||||
#define BTA_HF_CLIENT_PEER_FEAT_ECNR 0x00000002 /* Echo cancellation and/or noise reduction */
|
||||
#define BTA_HF_CLIENT_PEER_FEAT_VREC 0x00000004 /* Voice recognition */
|
||||
#define BTA_HF_CLIENT_PEER_INBAND 0x00000008 /* In-band ring tone */
|
||||
#define BTA_HF_CLIENT_PEER_VTAG 0x00000010 /* Attach a phone number to a voice tag */
|
||||
#define BTA_HF_CLIENT_PEER_REJECT 0x00000020 /* Ability to reject incoming call */
|
||||
#define BTA_HF_CLIENT_PEER_ECS 0x00000040 /* Enhanced Call Status */
|
||||
#define BTA_HF_CLIENT_PEER_ECC 0x00000080 /* Enhanced Call Control */
|
||||
#define BTA_HF_CLIENT_PEER_EXTERR 0x00000100 /* Extended error codes */
|
||||
#define BTA_HF_CLIENT_PEER_CODEC 0x00000200 /* Codec Negotiation */
|
||||
|
||||
typedef UINT16 tBTA_HF_CLIENT_PEER_FEAT;
|
||||
|
||||
/* HFP HF features */
|
||||
#define BTA_HF_CLIENT_FEAT_ECNR 0x00000001 /* Echo cancellation and/or noise reduction */
|
||||
#define BTA_HF_CLIENT_FEAT_3WAY 0x00000002 /* Call waiting and three-way calling */
|
||||
#define BTA_HF_CLIENT_FEAT_CLI 0x00000004 /* Caller ID presentation capability */
|
||||
#define BTA_HF_CLIENT_FEAT_VREC 0x00000008 /* Voice recognition activation */
|
||||
#define BTA_HF_CLIENT_FEAT_VOL 0x00000010 /* Remote volume control */
|
||||
#define BTA_HF_CLIENT_FEAT_ECS 0x00000020 /* Enhanced Call Status */
|
||||
#define BTA_HF_CLIENT_FEAT_ECC 0x00000040 /* Enhanced Call Control */
|
||||
#define BTA_HF_CLIENT_FEAT_CODEC 0x00000080 /* Codec Negotiation */
|
||||
|
||||
/* HFP HF extended call handling - masks not related to any spec */
|
||||
#define BTA_HF_CLIENT_CHLD_REL 0x00000001 /* 0 Release waiting call or held calls */
|
||||
#define BTA_HF_CLIENT_CHLD_REL_ACC 0x00000002 /* 1 Release active calls and accept other (waiting or held) cal */
|
||||
#define BTA_HF_CLIENT_CHLD_REL_X 0x00000004 /* 1x Release x call*/
|
||||
#define BTA_HF_CLIENT_CHLD_HOLD_ACC 0x00000008 /* 2 Active calls on hold and accept other call */
|
||||
#define BTA_HF_CLIENT_CHLD_PRIV_X 0x00000010 /* 2x Active multiparty call on hold except call x */
|
||||
#define BTA_HF_CLIENT_CHLD_MERGE 0x00000020 /* 3 Add held call to multiparty */
|
||||
#define BTA_HF_CLIENT_CHLD_MERGE_DETACH 0x00000040 /* 4 Add held call to multiparty */
|
||||
|
||||
typedef UINT16 tBTA_HF_CLIENT_CHLD_FEAT;
|
||||
|
||||
/* HFP AG errors ot OK sent to HF Unit */
|
||||
#define BTA_HF_CLIENT_AT_RESULT_OK 0
|
||||
#define BTA_HF_CLIENT_AT_RESULT_ERROR 1
|
||||
#define BTA_HF_CLIENT_AT_RESULT_NO_CARRIER 2
|
||||
#define BTA_HF_CLIENT_AT_RESULT_BUSY 3
|
||||
#define BTA_HF_CLIENT_AT_RESULT_NO_ANSWER 4
|
||||
#define BTA_HF_CLIENT_AT_RESULT_DELAY 5
|
||||
#define BTA_HF_CLIENT_AT_RESULT_BLACKLISTED 6
|
||||
#define BTA_HF_CLIENT_AT_RESULT_CME 7
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_AT_RESULT_TYPE;
|
||||
|
||||
/* HF Client callback events */
|
||||
#define BTA_HF_CLIENT_ENABLE_EVT 0 /* HF Client enabled */
|
||||
#define BTA_HF_CLIENT_REGISTER_EVT 1 /* HF Client registered */
|
||||
#define BTA_HF_CLIENT_OPEN_EVT 2 /* HF Client connection open */
|
||||
#define BTA_HF_CLIENT_CLOSE_EVT 3 /* HF Client connection closed */
|
||||
#define BTA_HF_CLIENT_CONN_EVT 4 /* Service level connection opened */
|
||||
#define BTA_HF_CLIENT_AUDIO_OPEN_EVT 5 /* Audio connection open */
|
||||
#define BTA_HF_CLIENT_AUDIO_MSBC_OPEN_EVT 6 /* Audio connection with mSBC codec open */
|
||||
#define BTA_HF_CLIENT_AUDIO_CLOSE_EVT 7 /* Audio connection closed */
|
||||
#define BTA_HF_CLIENT_SPK_EVT 8 /* Speaker volume changed */
|
||||
#define BTA_HF_CLIENT_MIC_EVT 9 /* Microphone volume changed */
|
||||
#define BTA_HF_CLIENT_IND_EVT 10 /* Indicator */
|
||||
#define BTA_HF_CLIENT_VOICE_REC_EVT 11 /* AG changed voice recognition setting */
|
||||
#define BTA_HF_CLIENT_OPERATOR_NAME_EVT 12 /* Operator name acquired */
|
||||
#define BTA_HF_CLIENT_CLIP_EVT 13 /* Calling line identification event */
|
||||
#define BTA_HF_CLIENT_CCWA_EVT 14 /* Call waiting notification */
|
||||
#define BTA_HF_CLIENT_AT_RESULT_EVT 15 /* Call waiting notification */
|
||||
#define BTA_HF_CLIENT_CLCC_EVT 16 /* current call event */
|
||||
#define BTA_HF_CLIENT_CNUM_EVT 17 /* subscriber information event */
|
||||
#define BTA_HF_CLIENT_BTRH_EVT 18 /* bluetooth response and hold event */
|
||||
#define BTA_HF_CLIENT_BSIR_EVT 19 /* in-band ring tone setting changed event */
|
||||
#define BTA_HF_CLIENT_BINP_EVT 20 /* binp number event */
|
||||
#define BTA_HF_CLIENT_RING_INDICATION 21 /* HF Client ring indication */
|
||||
#define BTA_HF_CLIENT_DISABLE_EVT 30 /* HF Client disabled */
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_EVT;
|
||||
|
||||
/* HF Client open status */
|
||||
#define BTA_HF_CLIENT_SUCCESS 0 /* Connection successfully opened */
|
||||
#define BTA_HF_CLIENT_FAIL_SDP 1 /* Open failed due to SDP */
|
||||
#define BTA_HF_CLIENT_FAIL_RFCOMM 2 /* Open failed due to RFCOMM */
|
||||
#define BTA_HF_CLIENT_FAIL_RESOURCES 3 /* out of resources failure */
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_STATUS;
|
||||
|
||||
/* indicator type */
|
||||
#define BTA_HF_CLIENT_IND_BATTCH 0 /* Battery charge indicator */
|
||||
#define BTA_HF_CLIENT_IND_SIGNAL 1 /* Signal Strength indicator */
|
||||
#define BTA_HF_CLIENT_IND_SERVICE 2 /* Service availability indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALL 3 /* Standard call status indicator*/
|
||||
#define BTA_HF_CLIENT_IND_ROAM 4 /* Roaming status indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* Call hold status indicator */
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_IND_TYPE;
|
||||
|
||||
/* AT commands */
|
||||
#define BTA_HF_CLIENT_AT_CMD_VTS 0
|
||||
#define BTA_HF_CLIENT_AT_CMD_BTRH 1
|
||||
#define BTA_HF_CLIENT_AT_CMD_CHUP 2
|
||||
#define BTA_HF_CLIENT_AT_CMD_CHLD 3
|
||||
#define BTA_HF_CLIENT_AT_CMD_BCC 4
|
||||
#define BTA_HF_CLIENT_AT_CMD_CNUM 5
|
||||
#define BTA_HF_CLIENT_AT_CMD_ATA 6
|
||||
#define BTA_HF_CLIENT_AT_CMD_COPS 7
|
||||
#define BTA_HF_CLIENT_AT_CMD_ATD 8
|
||||
#define BTA_HF_CLIENT_AT_CMD_VGM 9
|
||||
#define BTA_HF_CLIENT_AT_CMD_VGS 10
|
||||
#define BTA_HF_CLIENT_AT_CMD_BVRA 11
|
||||
#define BTA_HF_CLIENT_AT_CMD_CLCC 12
|
||||
#define BTA_HF_CLIENT_AT_CMD_BINP 13
|
||||
#define BTA_HF_CLIENT_AT_CMD_BLDN 14
|
||||
#define BTA_HF_CLIENT_AT_CMD_NREC 15
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_AT_CMD_TYPE;
|
||||
|
||||
/* data associated with most non-AT events */
|
||||
/* placeholder, if not needed should be removed*/
|
||||
typedef struct {
|
||||
} tBTA_HF_CLIENT_HDR;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_REGISTER_EVT */
|
||||
typedef struct {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
UINT16 handle;
|
||||
tBTA_HF_CLIENT_STATUS status;
|
||||
} tBTA_HF_CLIENT_REGISTER;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_OPEN_EVT */
|
||||
typedef struct {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
tBTA_HF_CLIENT_STATUS status;
|
||||
} tBTA_HF_CLIENT_OPEN;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_CONN_EVT */
|
||||
typedef struct {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
tBTA_HF_CLIENT_PEER_FEAT peer_feat;
|
||||
tBTA_HF_CLIENT_CHLD_FEAT chld_feat;
|
||||
} tBTA_HF_CLIENT_CONN;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_IND_EVT event */
|
||||
typedef struct {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
tBTA_HF_CLIENT_IND_TYPE type;
|
||||
UINT16 value;
|
||||
} tBTA_HF_CLIENT_IND;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_OPERATOR_NAME_EVT */
|
||||
#define BTA_HF_CLIENT_OPERATOR_NAME_LEN 16
|
||||
typedef struct {
|
||||
char name[BTA_HF_CLIENT_OPERATOR_NAME_LEN + 1];
|
||||
} tBTA_HF_CLIENT_OPERATOR_NAME;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_CLIP_EVT and BTA_HF_CLIENT_CCWA_EVT*/
|
||||
#define BTA_HF_CLIENT_NUMBER_LEN 32
|
||||
typedef struct {
|
||||
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
|
||||
} tBTA_HF_CLIENT_NUMBER;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_AT_RESULT_EVT event */
|
||||
typedef struct {
|
||||
tBTA_HF_CLIENT_AT_RESULT_TYPE type;
|
||||
UINT16 cme;
|
||||
} tBTA_HF_CLIENT_AT_RESULT;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_CLCC_EVT event */
|
||||
typedef struct {
|
||||
UINT32 idx;
|
||||
BOOLEAN inc;
|
||||
UINT8 status;
|
||||
BOOLEAN mpty;
|
||||
BOOLEAN number_present;
|
||||
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
|
||||
} tBTA_HF_CLIENT_CLCC;
|
||||
|
||||
/* data associated with BTA_HF_CLIENT_CNUM_EVT event */
|
||||
typedef struct {
|
||||
UINT16 service;
|
||||
char number[BTA_HF_CLIENT_NUMBER_LEN + 1];
|
||||
} tBTA_HF_CLIENT_CNUM;
|
||||
|
||||
/* data associated with other events */
|
||||
typedef struct {
|
||||
UINT16 value;
|
||||
} tBTA_HF_CLIENT_VAL;
|
||||
|
||||
/* union of data associated with AG callback */
|
||||
typedef union {
|
||||
tBTA_HF_CLIENT_HDR hdr;
|
||||
tBTA_HF_CLIENT_REGISTER reg;
|
||||
tBTA_HF_CLIENT_OPEN open;
|
||||
tBTA_HF_CLIENT_CONN conn;
|
||||
tBTA_HF_CLIENT_IND ind;
|
||||
tBTA_HF_CLIENT_VAL val;
|
||||
tBTA_HF_CLIENT_OPERATOR_NAME operator;
|
||||
tBTA_HF_CLIENT_NUMBER number;
|
||||
tBTA_HF_CLIENT_AT_RESULT result;
|
||||
tBTA_HF_CLIENT_CLCC clcc;
|
||||
tBTA_HF_CLIENT_CNUM cnum;
|
||||
} tBTA_HF_CLIENT;
|
||||
|
||||
typedef UINT32 tBTA_HF_CLIENT_FEAT;
|
||||
|
||||
/* HF Client callback */
|
||||
typedef void (tBTA_HF_CLIENT_CBACK)(tBTA_HF_CLIENT_EVT event, void *p_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientEnable
|
||||
**
|
||||
** Description Enable the HF CLient service. When the enable
|
||||
** operation is complete the callback function will be
|
||||
** called with a BTA_HF_CLIENT_ENABLE_EVT. This function must
|
||||
** be called before other function in the HF CLient API are
|
||||
** called.
|
||||
**
|
||||
** Returns BTA_SUCCESS if OK, BTA_FAILURE otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientDisable
|
||||
**
|
||||
** Description Disable the HF Client service
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientDisable(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientRegister
|
||||
**
|
||||
** Description Register an HF Client service.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
|
||||
char *p_service_name);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientDeregister
|
||||
**
|
||||
** Description Deregister an HF Client service.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientDeregister(UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientOpen
|
||||
**
|
||||
** Description Opens a connection to an audio gateway.
|
||||
** When connection is open callback function is called
|
||||
** with a BTA_HF_CLIENT_OPEN_EVT. Only the data connection is
|
||||
** opened. The audio connection is not opened.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientOpen(UINT16 handle, BD_ADDR bd_addr, tBTA_SEC sec_mask);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientClose
|
||||
**
|
||||
** Description Close the current connection to an audio gateway.
|
||||
** Any current audio connection will also be closed
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientClose(UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfCllientAudioOpen
|
||||
**
|
||||
** Description Opens an audio connection to the currently connected
|
||||
** audio gateway
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientAudioOpen(UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientAudioClose
|
||||
**
|
||||
** Description Close the currently active audio connection to an audio
|
||||
** gateway. The data connection remains open
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientAudioClose(UINT16 handle);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_HfClientSendAT
|
||||
**
|
||||
** Description send AT command
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_HfClientSendAT(UINT16 handle, tBTA_HF_CLIENT_AT_CMD_TYPE at, UINT32 val1, UINT32 val2, const char *str);
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
void BTA_HfClientCiData(void);
|
||||
#endif /*#if (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
|
||||
int BTA_HfClientGetCbDataSize(tBTA_HF_CLIENT_EVT event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* #if (BTA_HF_INCLUDED == TRUE) */
|
||||
#endif /* BTA_HF_CLIENT_API_H */
|
115
tools/sdk/include/bluedroid/bta/bta_hf_client_co.h
Normal file
115
tools/sdk/include/bluedroid/bta/bta_hf_client_co.h
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the interface file for hf client call-out functions.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_HF_CLIENT_CO_H
|
||||
#define BTA_HF_CLIENT_CO_H
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_hf_client_api.h"
|
||||
|
||||
#if (BTA_HF_INCLUDED == TRUE)
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_co_audio_state
|
||||
**
|
||||
** Description This function is called by the HF CLIENT before the audio connection
|
||||
** is brought up, after it comes up, and after it goes down.
|
||||
**
|
||||
** Parameters handle - handle of the AG instance
|
||||
** state - Audio state
|
||||
** codec - if WBS support is compiled in, codec to going to be used is provided
|
||||
** and when in SCO_STATE_SETUP, BTM_I2SPCMConfig() must be called with
|
||||
** the correct platform parameters.
|
||||
** in the other states codec type should not be ignored
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hf_client_co_audio_state(UINT16 handle, UINT8 state, tBTA_HFP_PEER_CODEC codec);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_co_init
|
||||
**
|
||||
** Description This function can be used by the phone to initialize audio
|
||||
** codec or for other initialization purposes before SCO connection
|
||||
** is opened.
|
||||
**
|
||||
**
|
||||
** Returns Void.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_HFP_SCO_ROUTE_TYPE bta_hf_client_sco_co_init(UINT32 rx_bw, UINT32 tx_bw,
|
||||
tBTA_HFP_CODEC_INFO *p_codec_info, UINT8 app_id);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_co_open
|
||||
**
|
||||
** Description This function is executed when a SCO connection is open.
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hf_client_sco_co_open(UINT16 handle, UINT8 pkt_size, UINT16 event);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_co_close
|
||||
**
|
||||
** Description This function is called when a SCO connection is closed
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hf_client_sco_co_close(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_co_out_data
|
||||
**
|
||||
** Description This function is called to send SCO data over HCI.
|
||||
**
|
||||
** Returns number of bytes got from application
|
||||
**
|
||||
*******************************************************************************/
|
||||
uint32_t bta_hf_client_sco_co_out_data(uint8_t *p_buf, uint32_t sz);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_hf_client_sco_co_in_data
|
||||
**
|
||||
** Description This function is called to send incoming SCO data to application.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void bta_hf_client_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status);
|
||||
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
|
||||
|
||||
#endif /* #if (BTA_HF_INCLUDED == TRUE) */
|
||||
#endif /* BTA_HF_CLIENT_CO_H */
|
47
tools/sdk/include/bluedroid/bta/bta_hfp_defs.h
Normal file
47
tools/sdk/include/bluedroid/bta/bta_hfp_defs.h
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __BTA_HFP_DEFS_H__
|
||||
#define __BTA_HFP_DEFS_H__
|
||||
|
||||
#include "stack/btm_api.h"
|
||||
|
||||
#define BTA_HFP_CODEC_NONE BTM_SCO_CODEC_NONE
|
||||
#define BTA_HFP_CODEC_CVSD BTM_SCO_CODEC_CVSD /* CVSD */
|
||||
#define BTA_HFP_CODEC_MSBC BTM_SCO_CODEC_MSBC /* mSBC */
|
||||
|
||||
typedef UINT16 tBTA_HFP_PEER_CODEC;
|
||||
|
||||
#ifndef BTA_HFP_SCO_OUT_PKT_SIZE
|
||||
#define BTA_HFP_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
|
||||
#endif
|
||||
|
||||
#define BTA_HFP_SCO_CODEC_PCM 0 /* used for regular SCO */
|
||||
#define BTA_HFP_SCO_CODEC_SBC 1 /* used for WBS */
|
||||
typedef UINT8 tBTA_HFP_SCO_CODEC_TYPE;
|
||||
|
||||
#define BTA_HFP_SCO_SAMP_RATE_8K 8000
|
||||
#define BTA_HFP_SCO_SAMP_RATE_16K 16000
|
||||
|
||||
/* SCO codec information */
|
||||
typedef struct {
|
||||
tBTA_HFP_SCO_CODEC_TYPE codec_type;
|
||||
} tBTA_HFP_CODEC_INFO;
|
||||
|
||||
#define BTA_HFP_SCO_ROUTE_PCM BTM_SCO_ROUTE_PCM
|
||||
#define BTA_HFP_SCO_ROUTE_HCI BTM_SCO_ROUTE_HCI
|
||||
|
||||
typedef tBTM_SCO_ROUTE_TYPE tBTA_HFP_SCO_ROUTE_TYPE;
|
||||
|
||||
#endif /* __BTA_HFP_DEFS_H__ */
|
@ -18,12 +18,12 @@
|
||||
#ifndef BTA_HH_API_H
|
||||
#define BTA_HH_API_H
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "hidh_api.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "stack/hidh_api.h"
|
||||
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
|
||||
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
#include "gatt_api.h"
|
||||
#include "stack/gatt_api.h"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_HH_CO_H
|
||||
#define BTA_HH_CO_H
|
||||
|
||||
#include "bta_hh_api.h"
|
||||
#include "bta/bta_hh_api.h"
|
||||
|
||||
typedef struct {
|
||||
UINT16 rpt_uuid;
|
@ -24,13 +24,13 @@
|
||||
#ifndef BTA_JV_API_H
|
||||
#define BTA_JV_API_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_api.h"
|
||||
#include "btm_api.h"
|
||||
#include "l2c_api.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "sdp_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "stack/btm_api.h"
|
||||
#include "stack/l2c_api.h"
|
||||
#include "stack/rfcdefs.h"
|
||||
#include "stack/sdp_api.h"
|
||||
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
@ -24,7 +24,7 @@
|
||||
#ifndef BTA_JV_CO_H
|
||||
#define BTA_JV_CO_H
|
||||
|
||||
#include "bta_jv_api.h"
|
||||
#include "bta/bta_jv_api.h"
|
||||
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
@ -25,10 +25,10 @@
|
||||
#define BTA_SDP_API_H
|
||||
|
||||
#include "bt_sdp.h"
|
||||
#include "bt_target.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_api.h"
|
||||
#include "btm_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "stack/btm_api.h"
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
/* status values */
|
@ -24,8 +24,8 @@
|
||||
#ifndef BTA_SYS_H
|
||||
#define BTA_SYS_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bt_defs.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
@ -24,7 +24,7 @@
|
||||
#ifndef UTL_H
|
||||
#define UTL_H
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "stack/bt_types.h"
|
||||
// #include "bt_utils.h"
|
||||
|
||||
/*****************************************************************************
|
||||
@ -136,6 +136,21 @@ extern void utl_freebuf(void **p);
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN utl_set_device_class(tBTA_UTL_COD *p_cod, UINT8 cmd);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function utl_get_device_class
|
||||
**
|
||||
** Description This function get the local Device Class.
|
||||
**
|
||||
** Parameters:
|
||||
** p_cod - Pointer to the device class to get to
|
||||
**
|
||||
**
|
||||
** Returns TRUE if successful, Otherwise FALSE
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN utl_get_device_class(tBTA_UTL_COD *p_cod);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function utl_isintstr
|
@ -1,66 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2008-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private interface file for the BTA audio/video registration
|
||||
* module.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_AR_INT_H
|
||||
#define BTA_AR_INT_H
|
||||
|
||||
#include "bta_av_api.h"
|
||||
|
||||
#if (BTA_AR_INCLUDED == TRUE)
|
||||
|
||||
#ifndef BTA_AR_DEBUG
|
||||
#define BTA_AR_DEBUG FALSE
|
||||
#endif
|
||||
|
||||
#define BTA_AR_AV_MASK 0x01
|
||||
#define BTA_AR_AVK_MASK 0x02
|
||||
|
||||
/* data associated with BTA_AR */
|
||||
typedef struct {
|
||||
tAVDT_CTRL_CBACK *p_av_conn_cback; /* av connection callback function */
|
||||
tAVDT_CTRL_CBACK *p_avk_conn_cback; /* avk connection callback function */
|
||||
UINT8 avdt_registered;
|
||||
UINT8 avct_registered;
|
||||
UINT32 sdp_tg_handle;
|
||||
UINT32 sdp_ct_handle;
|
||||
UINT16 ct_categories[2];
|
||||
UINT8 tg_registered;
|
||||
tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */
|
||||
} tBTA_AR_CB;
|
||||
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
|
||||
/* control block declaration */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_AR_CB bta_ar_cb;
|
||||
#else
|
||||
extern tBTA_AR_CB *bta_ar_cb_ptr;
|
||||
#define bta_ar_cb (*bta_ar_cb_ptr)
|
||||
#endif
|
||||
|
||||
#endif ///BTA_AR_INCLUDED == TRUE
|
||||
|
||||
#endif /* BTA_AR_INT_H */
|
@ -1,708 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2004-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private interface file for the BTA advanced audio/video.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_AV_INT_H
|
||||
#define BTA_AV_INT_H
|
||||
|
||||
#include "bta_sys.h"
|
||||
#include "bta_api.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "avdt_api.h"
|
||||
#include "bta_av_co.h"
|
||||
#include "list.h"
|
||||
|
||||
#if (BTA_AV_INCLUDED == TRUE)
|
||||
|
||||
#define BTA_AV_DEBUG TRUE
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
enum {
|
||||
/* these events are handled by the AV main state machine */
|
||||
BTA_AV_API_DISABLE_EVT = BTA_SYS_EVT_START(BTA_ID_AV),
|
||||
BTA_AV_API_REMOTE_CMD_EVT,
|
||||
BTA_AV_API_VENDOR_CMD_EVT,
|
||||
BTA_AV_API_VENDOR_RSP_EVT,
|
||||
BTA_AV_API_META_RSP_EVT,
|
||||
BTA_AV_API_RC_CLOSE_EVT,
|
||||
BTA_AV_AVRC_OPEN_EVT,
|
||||
BTA_AV_AVRC_MSG_EVT,
|
||||
BTA_AV_AVRC_NONE_EVT,
|
||||
|
||||
/* these events are handled by the AV stream state machine */
|
||||
BTA_AV_API_OPEN_EVT,
|
||||
BTA_AV_API_CLOSE_EVT,
|
||||
BTA_AV_AP_START_EVT, /* the following 2 events must be in the same order as the *API_*EVT */
|
||||
BTA_AV_AP_STOP_EVT,
|
||||
BTA_AV_API_RECONFIG_EVT,
|
||||
BTA_AV_API_PROTECT_REQ_EVT,
|
||||
BTA_AV_API_PROTECT_RSP_EVT,
|
||||
BTA_AV_API_RC_OPEN_EVT,
|
||||
BTA_AV_SRC_DATA_READY_EVT,
|
||||
BTA_AV_CI_SETCONFIG_OK_EVT,
|
||||
BTA_AV_CI_SETCONFIG_FAIL_EVT,
|
||||
BTA_AV_SDP_DISC_OK_EVT,
|
||||
BTA_AV_SDP_DISC_FAIL_EVT,
|
||||
BTA_AV_STR_DISC_OK_EVT,
|
||||
BTA_AV_STR_DISC_FAIL_EVT,
|
||||
BTA_AV_STR_GETCAP_OK_EVT,
|
||||
BTA_AV_STR_GETCAP_FAIL_EVT,
|
||||
BTA_AV_STR_OPEN_OK_EVT,
|
||||
BTA_AV_STR_OPEN_FAIL_EVT,
|
||||
BTA_AV_STR_START_OK_EVT,
|
||||
BTA_AV_STR_START_FAIL_EVT,
|
||||
BTA_AV_STR_CLOSE_EVT,
|
||||
BTA_AV_STR_CONFIG_IND_EVT,
|
||||
BTA_AV_STR_SECURITY_IND_EVT,
|
||||
BTA_AV_STR_SECURITY_CFM_EVT,
|
||||
BTA_AV_STR_WRITE_CFM_EVT,
|
||||
BTA_AV_STR_SUSPEND_CFM_EVT,
|
||||
BTA_AV_STR_RECONFIG_CFM_EVT,
|
||||
BTA_AV_AVRC_TIMER_EVT,
|
||||
BTA_AV_AVDT_CONNECT_EVT,
|
||||
BTA_AV_AVDT_DISCONNECT_EVT,
|
||||
BTA_AV_ROLE_CHANGE_EVT,
|
||||
BTA_AV_AVDT_DELAY_RPT_EVT,
|
||||
BTA_AV_ACP_CONNECT_EVT,
|
||||
|
||||
/* these events are handled outside of the state machine */
|
||||
BTA_AV_API_ENABLE_EVT,
|
||||
BTA_AV_API_REGISTER_EVT,
|
||||
BTA_AV_API_DEREGISTER_EVT,
|
||||
BTA_AV_API_DISCONNECT_EVT,
|
||||
BTA_AV_CI_SRC_DATA_READY_EVT,
|
||||
BTA_AV_SIG_CHG_EVT,
|
||||
BTA_AV_SIG_TIMER_EVT,
|
||||
BTA_AV_SDP_AVRC_DISC_EVT,
|
||||
BTA_AV_AVRC_CLOSE_EVT,
|
||||
BTA_AV_CONN_CHG_EVT,
|
||||
BTA_AV_DEREG_COMP_EVT,
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
BTA_AV_API_SINK_ENABLE_EVT,
|
||||
#endif
|
||||
#if (AVDT_REPORTING == TRUE)
|
||||
BTA_AV_AVDT_RPT_CONN_EVT,
|
||||
#endif
|
||||
BTA_AV_API_START_EVT, /* the following 2 events must be in the same order as the *AP_*EVT */
|
||||
BTA_AV_API_STOP_EVT
|
||||
};
|
||||
|
||||
/* events for AV control block state machine */
|
||||
#define BTA_AV_FIRST_SM_EVT BTA_AV_API_DISABLE_EVT
|
||||
#define BTA_AV_LAST_SM_EVT BTA_AV_AVRC_NONE_EVT
|
||||
|
||||
/* events for AV stream control block state machine */
|
||||
#define BTA_AV_FIRST_SSM_EVT BTA_AV_API_OPEN_EVT
|
||||
|
||||
/* events that do not go through state machine */
|
||||
#define BTA_AV_FIRST_NSM_EVT BTA_AV_API_ENABLE_EVT
|
||||
#define BTA_AV_LAST_NSM_EVT BTA_AV_API_STOP_EVT
|
||||
|
||||
/* API events passed to both SSMs (by bta_av_api_to_ssm) */
|
||||
#define BTA_AV_FIRST_A2S_API_EVT BTA_AV_API_START_EVT
|
||||
#define BTA_AV_FIRST_A2S_SSM_EVT BTA_AV_AP_START_EVT
|
||||
|
||||
#define BTA_AV_LAST_EVT BTA_AV_API_STOP_EVT
|
||||
|
||||
/* maximum number of SEPS in stream discovery results */
|
||||
#define BTA_AV_NUM_SEPS 32
|
||||
|
||||
/* initialization value for AVRC handle */
|
||||
#define BTA_AV_RC_HANDLE_NONE 0xFF
|
||||
|
||||
/* size of database for service discovery */
|
||||
#define BTA_AV_DISC_BUF_SIZE 1000
|
||||
|
||||
/* offset of media type in codec info byte array */
|
||||
#define BTA_AV_MEDIA_TYPE_IDX 1
|
||||
|
||||
/* maximum length of AVDTP security data */
|
||||
#define BTA_AV_SECURITY_MAX_LEN 400
|
||||
|
||||
/* check number of buffers queued at L2CAP when this amount of buffers are queued to L2CAP */
|
||||
#define BTA_AV_QUEUE_DATA_CHK_NUM L2CAP_HIGH_PRI_MIN_XMIT_QUOTA
|
||||
|
||||
/* the number of ACL links with AVDT */
|
||||
#define BTA_AV_NUM_LINKS AVDT_NUM_LINKS
|
||||
|
||||
#define BTA_AV_CO_ID_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); }
|
||||
#define BTA_AV_BE_STREAM_TO_CO_ID(u32, p) {u32 = (((UINT32)(*((p) + 2))) + (((UINT32)(*((p) + 1))) << 8) + (((UINT32)(*(p))) << 16)); (p) += 3;}
|
||||
|
||||
/* these bits are defined for bta_av_cb.multi_av */
|
||||
#define BTA_AV_MULTI_AV_SUPPORTED 0x01
|
||||
#define BTA_AV_MULTI_AV_IN_USE 0x02
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Data types
|
||||
*****************************************************************************/
|
||||
#if 0
|
||||
/* function types for call-out functions */
|
||||
typedef BOOLEAN (*tBTA_AV_CO_INIT) (UINT8 *p_codec_type, UINT8 *p_codec_info,
|
||||
UINT8 *p_num_protect, UINT8 *p_protect_info, UINT8 index);
|
||||
typedef void (*tBTA_AV_CO_DISC_RES) (tBTA_AV_HNDL hndl, UINT8 num_seps,
|
||||
UINT8 num_snk, UINT8 num_src, BD_ADDR addr, UINT16 uuid_local);
|
||||
typedef UINT8 (*tBTA_AV_CO_GETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
UINT8 *p_codec_info, UINT8 *p_sep_info_idx, UINT8 seid,
|
||||
UINT8 *p_num_protect, UINT8 *p_protect_info);
|
||||
typedef void (*tBTA_AV_CO_SETCFG) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type,
|
||||
UINT8 *p_codec_info, UINT8 seid, BD_ADDR addr,
|
||||
UINT8 num_protect, UINT8 *p_protect_info,
|
||||
UINT8 t_local_sep, UINT8 avdt_handle);
|
||||
typedef void (*tBTA_AV_CO_OPEN) (tBTA_AV_HNDL hndl,
|
||||
tBTA_AV_CODEC codec_type, UINT8 *p_codec_info,
|
||||
UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_CLOSE) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT16 mtu);
|
||||
typedef void (*tBTA_AV_CO_START) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type, UINT8 *p_codec_info, BOOLEAN *p_no_rtp_hdr);
|
||||
typedef void (*tBTA_AV_CO_STOP) (tBTA_AV_HNDL hndl, tBTA_AV_CODEC codec_type);
|
||||
typedef void *(*tBTA_AV_CO_DATAPATH) (tBTA_AV_CODEC codec_type,
|
||||
UINT32 *p_len, UINT32 *p_timestamp);
|
||||
typedef void (*tBTA_AV_CO_DELAY) (tBTA_AV_HNDL hndl, UINT16 delay);
|
||||
|
||||
/* the call-out functions for one stream */
|
||||
typedef struct {
|
||||
tBTA_AV_CO_INIT init;
|
||||
tBTA_AV_CO_DISC_RES disc_res;
|
||||
tBTA_AV_CO_GETCFG getcfg;
|
||||
tBTA_AV_CO_SETCFG setcfg;
|
||||
tBTA_AV_CO_OPEN open;
|
||||
tBTA_AV_CO_CLOSE close;
|
||||
tBTA_AV_CO_START start;
|
||||
tBTA_AV_CO_STOP stop;
|
||||
tBTA_AV_CO_DATAPATH data;
|
||||
tBTA_AV_CO_DELAY delay;
|
||||
} tBTA_AV_CO_FUNCTS;
|
||||
#endif
|
||||
|
||||
/* data type for BTA_AV_API_ENABLE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_CBACK *p_cback;
|
||||
tBTA_AV_FEAT features;
|
||||
tBTA_SEC sec_mask;
|
||||
} tBTA_AV_API_ENABLE;
|
||||
|
||||
/* data type for BTA_AV_API_REG_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
char p_service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
UINT8 app_id;
|
||||
tBTA_AV_DATA_CBACK *p_app_data_cback;
|
||||
tBTA_AV_CO_FUNCTS *bta_av_cos;
|
||||
} tBTA_AV_API_REG;
|
||||
|
||||
|
||||
enum {
|
||||
BTA_AV_RS_NONE, /* straight API call */
|
||||
BTA_AV_RS_OK, /* the role switch result - successful */
|
||||
BTA_AV_RS_FAIL, /* the role switch result - failed */
|
||||
BTA_AV_RS_DONE /* the role switch is done - continue */
|
||||
};
|
||||
typedef UINT8 tBTA_AV_RS_RES;
|
||||
/* data type for BTA_AV_API_OPEN_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
BOOLEAN use_rc;
|
||||
tBTA_SEC sec_mask;
|
||||
tBTA_AV_RS_RES switch_res;
|
||||
UINT16 uuid; /* uuid of initiator */
|
||||
} tBTA_AV_API_OPEN;
|
||||
|
||||
/* data type for BTA_AV_API_STOP_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN suspend;
|
||||
BOOLEAN flush;
|
||||
} tBTA_AV_API_STOP;
|
||||
|
||||
/* data type for BTA_AV_API_DISCONNECT_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
} tBTA_AV_API_DISCNT;
|
||||
|
||||
/* data type for BTA_AV_API_PROTECT_REQ_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
} tBTA_AV_API_PROTECT_REQ;
|
||||
|
||||
/* data type for BTA_AV_API_PROTECT_RSP_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
UINT8 error_code;
|
||||
} tBTA_AV_API_PROTECT_RSP;
|
||||
|
||||
/* data type for BTA_AV_API_REMOTE_CMD_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG_PASS msg;
|
||||
UINT8 label;
|
||||
} tBTA_AV_API_REMOTE_CMD;
|
||||
|
||||
/* data type for BTA_AV_API_VENDOR_CMD_EVT and RSP */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG_VENDOR msg;
|
||||
UINT8 label;
|
||||
} tBTA_AV_API_VENDOR;
|
||||
|
||||
/* data type for BTA_AV_API_RC_OPEN_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_AV_API_OPEN_RC;
|
||||
|
||||
/* data type for BTA_AV_API_RC_CLOSE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_AV_API_CLOSE_RC;
|
||||
|
||||
/* data type for BTA_AV_API_META_RSP_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN is_rsp;
|
||||
UINT8 label;
|
||||
tBTA_AV_CODE rsp_code;
|
||||
BT_HDR *p_pkt;
|
||||
} tBTA_AV_API_META_RSP;
|
||||
|
||||
|
||||
/* data type for BTA_AV_API_RECONFIG_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 codec_info[AVDT_CODEC_SIZE]; /* codec configuration */
|
||||
UINT8 *p_protect_info;
|
||||
UINT8 num_protect;
|
||||
BOOLEAN suspend;
|
||||
UINT8 sep_info_idx;
|
||||
} tBTA_AV_API_RCFG;
|
||||
|
||||
/* data type for BTA_AV_CI_SETCONFIG_OK_EVT and BTA_AV_CI_SETCONFIG_FAIL_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_HNDL hndl;
|
||||
UINT8 err_code;
|
||||
UINT8 category;
|
||||
UINT8 num_seid;
|
||||
UINT8 *p_seid;
|
||||
BOOLEAN recfg_needed;
|
||||
UINT8 avdt_handle; /* local sep type for which this stream will be set up */
|
||||
} tBTA_AV_CI_SETCONFIG;
|
||||
|
||||
/* data type for all stream events from AVDTP */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVDT_CFG cfg; /* configuration/capabilities parameters */
|
||||
tAVDT_CTRL msg; /* AVDTP callback message parameters */
|
||||
BD_ADDR bd_addr; /* bd address */
|
||||
UINT8 handle;
|
||||
UINT8 avdt_event;
|
||||
BOOLEAN initiator; /* TRUE, if local device initiates the SUSPEND */
|
||||
} tBTA_AV_STR_MSG;
|
||||
|
||||
/* data type for BTA_AV_AVRC_MSG_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tAVRC_MSG msg;
|
||||
UINT8 handle;
|
||||
UINT8 label;
|
||||
UINT8 opcode;
|
||||
} tBTA_AV_RC_MSG;
|
||||
|
||||
/* data type for BTA_AV_AVRC_OPEN_EVT, BTA_AV_AVRC_CLOSE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_addr;
|
||||
UINT8 handle;
|
||||
} tBTA_AV_RC_CONN_CHG;
|
||||
|
||||
/* data type for BTA_AV_CONN_CHG_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_addr;
|
||||
BOOLEAN is_up;
|
||||
} tBTA_AV_CONN_CHG;
|
||||
|
||||
/* data type for BTA_AV_ROLE_CHANGE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 new_role;
|
||||
UINT8 hci_status;
|
||||
} tBTA_AV_ROLE_RES;
|
||||
|
||||
/* data type for BTA_AV_SDP_DISC_OK_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 avdt_version; /* AVDTP protocol version */
|
||||
} tBTA_AV_SDP_RES;
|
||||
|
||||
/* type for SEP control block */
|
||||
typedef struct {
|
||||
UINT8 av_handle; /* AVDTP handle */
|
||||
tBTA_AV_CODEC codec_type; /* codec type */
|
||||
UINT8 tsep; /* SEP type of local SEP */
|
||||
tBTA_AV_DATA_CBACK *p_app_data_cback; /* Application callback for media packets */
|
||||
} tBTA_AV_SEP;
|
||||
|
||||
|
||||
/* initiator/acceptor role for adaption */
|
||||
#define BTA_AV_ROLE_AD_INT 0x00 /* initiator */
|
||||
#define BTA_AV_ROLE_AD_ACP 0x01 /* acceptor */
|
||||
|
||||
/* initiator/acceptor signaling roles */
|
||||
#define BTA_AV_ROLE_START_ACP 0x00
|
||||
#define BTA_AV_ROLE_START_INT 0x10 /* do not change this value */
|
||||
|
||||
#define BTA_AV_ROLE_SUSPEND 0x20 /* suspending on start */
|
||||
#define BTA_AV_ROLE_SUSPEND_OPT 0x40 /* Suspend on Start option is set */
|
||||
|
||||
/* union of all event datatypes */
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
tBTA_AV_API_ENABLE api_enable;
|
||||
tBTA_AV_API_REG api_reg;
|
||||
tBTA_AV_API_OPEN api_open;
|
||||
tBTA_AV_API_STOP api_stop;
|
||||
tBTA_AV_API_DISCNT api_discnt;
|
||||
tBTA_AV_API_PROTECT_REQ api_protect_req;
|
||||
tBTA_AV_API_PROTECT_RSP api_protect_rsp;
|
||||
tBTA_AV_API_REMOTE_CMD api_remote_cmd;
|
||||
tBTA_AV_API_VENDOR api_vendor;
|
||||
tBTA_AV_API_RCFG api_reconfig;
|
||||
tBTA_AV_CI_SETCONFIG ci_setconfig;
|
||||
tBTA_AV_STR_MSG str_msg;
|
||||
tBTA_AV_RC_MSG rc_msg;
|
||||
tBTA_AV_RC_CONN_CHG rc_conn_chg;
|
||||
tBTA_AV_CONN_CHG conn_chg;
|
||||
tBTA_AV_ROLE_RES role_res;
|
||||
tBTA_AV_SDP_RES sdp_res;
|
||||
tBTA_AV_API_META_RSP api_meta_rsp;
|
||||
} tBTA_AV_DATA;
|
||||
|
||||
typedef void (tBTA_AV_VDP_DATA_ACT)(void *p_scb);
|
||||
|
||||
typedef struct {
|
||||
tBTA_AV_VDP_DATA_ACT *p_act;
|
||||
UINT8 *p_frame;
|
||||
UINT16 buf_size;
|
||||
UINT32 len;
|
||||
UINT32 offset;
|
||||
UINT32 timestamp;
|
||||
} tBTA_AV_VF_INFO;
|
||||
|
||||
typedef union {
|
||||
tBTA_AV_VF_INFO vdp; /* used for video channels only */
|
||||
tBTA_AV_API_OPEN open; /* used only before open and role switch
|
||||
is needed on another AV channel */
|
||||
} tBTA_AV_Q_INFO;
|
||||
|
||||
#define BTA_AV_Q_TAG_OPEN 0x01 /* after API_OPEN, before STR_OPENED */
|
||||
#define BTA_AV_Q_TAG_START 0x02 /* before start sending media packets */
|
||||
#define BTA_AV_Q_TAG_STREAM 0x03 /* during streaming */
|
||||
|
||||
#define BTA_AV_WAIT_ACP_CAPS_ON 0x01 /* retriving the peer capabilities */
|
||||
#define BTA_AV_WAIT_ACP_CAPS_STARTED 0x02 /* started while retriving peer capabilities */
|
||||
#define BTA_AV_WAIT_ROLE_SW_RES_OPEN 0x04 /* waiting for role switch result after API_OPEN, before STR_OPENED */
|
||||
#define BTA_AV_WAIT_ROLE_SW_RES_START 0x08 /* waiting for role switch result before streaming */
|
||||
#define BTA_AV_WAIT_ROLE_SW_STARTED 0x10 /* started while waiting for role switch result */
|
||||
#define BTA_AV_WAIT_ROLE_SW_RETRY 0x20 /* set when retry on timeout */
|
||||
#define BTA_AV_WAIT_CHECK_RC 0x40 /* set when the timer is used by role switch */
|
||||
#define BTA_AV_WAIT_ROLE_SW_FAILED 0x80 /* role switch failed */
|
||||
|
||||
#define BTA_AV_WAIT_ROLE_SW_BITS (BTA_AV_WAIT_ROLE_SW_RES_OPEN|BTA_AV_WAIT_ROLE_SW_RES_START|BTA_AV_WAIT_ROLE_SW_STARTED|BTA_AV_WAIT_ROLE_SW_RETRY)
|
||||
|
||||
/* Bitmap for collision, coll_mask */
|
||||
#define BTA_AV_COLL_INC_TMR 0x01 /* Timer is running for incoming L2C connection */
|
||||
#define BTA_AV_COLL_API_CALLED 0x02 /* API open was called while incoming timer is running */
|
||||
|
||||
/* type for AV stream control block */
|
||||
typedef struct {
|
||||
const tBTA_AV_ACT *p_act_tbl; /* the action table for stream state machine */
|
||||
const tBTA_AV_CO_FUNCTS *p_cos; /* the associated callout functions */
|
||||
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
|
||||
tBTA_AV_SEP seps[BTA_AV_MAX_SEPS];
|
||||
tAVDT_CFG *p_cap; /* buffer used for get capabilities */
|
||||
list_t *a2d_list; /* used for audio channels only */
|
||||
tBTA_AV_Q_INFO q_info;
|
||||
tAVDT_SEP_INFO sep_info[BTA_AV_NUM_SEPS]; /* stream discovery results */
|
||||
tAVDT_CFG cfg; /* local SEP configuration */
|
||||
TIMER_LIST_ENT timer; /* delay timer for AVRC CT */
|
||||
BD_ADDR peer_addr; /* peer BD address */
|
||||
UINT16 l2c_cid; /* L2CAP channel ID */
|
||||
UINT16 stream_mtu; /* MTU of stream */
|
||||
UINT16 avdt_version; /* the avdt version of peer device */
|
||||
tBTA_SEC sec_mask; /* security mask */
|
||||
tBTA_AV_CODEC codec_type; /* codec type */
|
||||
UINT8 media_type; /* Media type */
|
||||
BOOLEAN cong; /* TRUE if AVDTP congested */
|
||||
tBTA_AV_STATUS open_status; /* open failure status */
|
||||
tBTA_AV_CHNL chnl; /* the channel: audio/video */
|
||||
tBTA_AV_HNDL hndl; /* the handle: ((hdi + 1)|chnl) */
|
||||
UINT16 cur_psc_mask; /* Protocol service capabilities mask for current connection */
|
||||
UINT8 avdt_handle; /* AVDTP handle */
|
||||
UINT8 hdi; /* the index to SCB[] */
|
||||
UINT8 num_seps; /* number of seps returned by stream discovery */
|
||||
UINT8 num_disc_snks; /* number of discovered snks */
|
||||
UINT8 num_disc_srcs; /* number of discovered srcs */
|
||||
UINT8 sep_info_idx; /* current index into sep_info */
|
||||
UINT8 sep_idx; /* current index into local seps[] */
|
||||
UINT8 rcfg_idx; /* reconfig requested index into sep_info */
|
||||
UINT8 state; /* state machine state */
|
||||
UINT8 avdt_label; /* AVDTP label */
|
||||
UINT8 app_id; /* application id */
|
||||
UINT8 num_recfg; /* number of reconfigure sent */
|
||||
UINT8 role;
|
||||
UINT8 l2c_bufs; /* the number of buffers queued to L2CAP */
|
||||
UINT8 rc_handle; /* connected AVRCP handle */
|
||||
BOOLEAN use_rc; /* TRUE if AVRCP is allowed */
|
||||
BOOLEAN started; /* TRUE if stream started */
|
||||
UINT8 co_started; /* non-zero, if stream started from call-out perspective */
|
||||
BOOLEAN recfg_sup; /* TRUE if the first attempt to reconfigure the stream was successfull, else False if command fails */
|
||||
BOOLEAN suspend_sup; /* TRUE if Suspend stream is supported, else FALSE if suspend command fails */
|
||||
BOOLEAN deregistring; /* TRUE if deregistering */
|
||||
BOOLEAN sco_suspend; /* TRUE if SUSPEND is issued automatically for SCO */
|
||||
UINT8 coll_mask; /* Mask to check incoming and outgoing collision */
|
||||
tBTA_AV_API_OPEN open_api; /* Saved OPEN api message */
|
||||
UINT8 wait; /* set 0x1, when getting Caps as ACP, set 0x2, when started */
|
||||
UINT8 q_tag; /* identify the associated q_info union member */
|
||||
BOOLEAN no_rtp_hdr; /* TRUE if add no RTP header*/
|
||||
UINT8 disc_rsn; /* disconenction reason */
|
||||
UINT16 uuid_int; /*intended UUID of Initiator to connect to */
|
||||
} tBTA_AV_SCB;
|
||||
|
||||
#define BTA_AV_RC_ROLE_MASK 0x10
|
||||
#define BTA_AV_RC_ROLE_INT 0x00
|
||||
#define BTA_AV_RC_ROLE_ACP 0x10
|
||||
|
||||
#define BTA_AV_RC_CONN_MASK 0x20
|
||||
|
||||
/* type for AV RCP control block */
|
||||
/* index to this control block is the rc handle */
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT8 handle;
|
||||
UINT8 shdl; /* stream handle (hdi + 1) */
|
||||
UINT8 lidx; /* (index+1) to LCB */
|
||||
tBTA_AV_FEAT peer_features; /* peer features mask */
|
||||
} tBTA_AV_RCB;
|
||||
#define BTA_AV_NUM_RCB (BTA_AV_NUM_STRS + 2)
|
||||
|
||||
enum {
|
||||
BTA_AV_LCB_FREE,
|
||||
BTA_AV_LCB_FIND
|
||||
};
|
||||
|
||||
/* type for AV ACL Link control block */
|
||||
typedef struct {
|
||||
BD_ADDR addr; /* peer BD address */
|
||||
UINT8 conn_msk; /* handle mask of connected stream handle */
|
||||
UINT8 lidx; /* index + 1 */
|
||||
} tBTA_AV_LCB;
|
||||
|
||||
/* type for stream state machine action functions */
|
||||
typedef void (*tBTA_AV_SACT)(tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
|
||||
|
||||
/* type for AV control block */
|
||||
typedef struct {
|
||||
tBTA_AV_SCB *p_scb[BTA_AV_NUM_STRS]; /* stream control block */
|
||||
tSDP_DISCOVERY_DB *p_disc_db; /* pointer to discovery database */
|
||||
tBTA_AV_CBACK *p_cback; /* application callback function */
|
||||
tBTA_AV_RCB rcb[BTA_AV_NUM_RCB]; /* RCB control block */
|
||||
tBTA_AV_LCB lcb[BTA_AV_NUM_LINKS + 1]; /* link control block */
|
||||
TIMER_LIST_ENT sig_tmr; /* link timer */
|
||||
TIMER_LIST_ENT acp_sig_tmr; /* timer to monitor signalling when accepting */
|
||||
UINT32 sdp_a2d_handle; /* SDP record handle for audio src */
|
||||
#if (BTA_AV_SINK_INCLUDED == TRUE)
|
||||
UINT32 sdp_a2d_snk_handle; /* SDP record handle for audio snk */
|
||||
#endif
|
||||
UINT32 sdp_vdp_handle; /* SDP record handle for video src */
|
||||
tBTA_AV_FEAT features; /* features mask */
|
||||
tBTA_SEC sec_mask; /* security mask */
|
||||
tBTA_AV_HNDL handle; /* the handle for SDP activity */
|
||||
BOOLEAN disabling; /* TRUE if api disabled called */
|
||||
UINT8 disc; /* (hdi+1) or (rc_handle|BTA_AV_CHNL_MSK) if p_disc_db is in use */
|
||||
UINT8 state; /* state machine state */
|
||||
UINT8 conn_rc; /* handle mask of connected RCP channels */
|
||||
UINT8 conn_audio; /* handle mask of connected audio channels */
|
||||
UINT8 conn_video; /* handle mask of connected video channels */
|
||||
UINT8 conn_lcb; /* index mask of used LCBs */
|
||||
UINT8 audio_open_cnt; /* number of connected audio channels */
|
||||
UINT8 reg_audio; /* handle mask of registered audio channels */
|
||||
UINT8 reg_video; /* handle mask of registered video channels */
|
||||
UINT8 rc_acp_handle;
|
||||
UINT8 rc_acp_idx; /* (index + 1) to RCB */
|
||||
UINT8 rs_idx; /* (index + 1) to SCB for the one waiting for RS on open */
|
||||
BOOLEAN sco_occupied; /* TRUE if SCO is being used or call is in progress */
|
||||
UINT8 audio_streams; /* handle mask of streaming audio channels */
|
||||
UINT8 video_streams; /* handle mask of streaming video channels */
|
||||
} tBTA_AV_CB;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
|
||||
/* control block declaration */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_AV_CB bta_av_cb;
|
||||
#else
|
||||
extern tBTA_AV_CB *bta_av_cb_ptr;
|
||||
#define bta_av_cb (*bta_av_cb_ptr)
|
||||
#endif
|
||||
|
||||
/* config struct */
|
||||
extern tBTA_AV_CFG *p_bta_av_cfg;
|
||||
|
||||
/* rc id config struct */
|
||||
extern UINT16 *p_bta_av_rc_id;
|
||||
extern UINT16 *p_bta_av_rc_id_ac;
|
||||
|
||||
extern const tBTA_AV_SACT bta_av_a2d_action[];
|
||||
// extern const tBTA_AV_CO_FUNCTS bta_av_a2d_cos;
|
||||
extern const tBTA_AV_SACT bta_av_vdp_action[];
|
||||
extern tAVDT_CTRL_CBACK *const bta_av_dt_cback[];
|
||||
extern void bta_av_stream_data_cback(UINT8 handle, BT_HDR *p_pkt, UINT32 time_stamp, UINT8 m_pt);
|
||||
|
||||
/*****************************************************************************
|
||||
** Function prototypes
|
||||
*****************************************************************************/
|
||||
/* utility functions */
|
||||
extern tBTA_AV_SCB *bta_av_hndl_to_scb(UINT16 handle);
|
||||
extern BOOLEAN bta_av_chk_start(tBTA_AV_SCB *p_scb);
|
||||
extern void bta_av_restore_switch (void);
|
||||
extern UINT16 bta_av_chk_mtu(tBTA_AV_SCB *p_scb, UINT16 mtu);
|
||||
extern void bta_av_conn_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data);
|
||||
extern UINT8 bta_av_rc_create(tBTA_AV_CB *p_cb, UINT8 role, UINT8 shdl, UINT8 lidx);
|
||||
extern void bta_av_stream_chg(tBTA_AV_SCB *p_scb, BOOLEAN started);
|
||||
extern BOOLEAN bta_av_is_scb_opening (tBTA_AV_SCB *p_scb);
|
||||
extern BOOLEAN bta_av_is_scb_incoming (tBTA_AV_SCB *p_scb);
|
||||
extern void bta_av_set_scb_sst_init (tBTA_AV_SCB *p_scb);
|
||||
extern BOOLEAN bta_av_is_scb_init (tBTA_AV_SCB *p_scb);
|
||||
extern void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb);
|
||||
extern tBTA_AV_LCB *bta_av_find_lcb(BD_ADDR addr, UINT8 op);
|
||||
|
||||
|
||||
/* main functions */
|
||||
extern void bta_av_api_deregister(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_dup_audio_buf(tBTA_AV_SCB *p_scb, BT_HDR *p_buf);
|
||||
extern void bta_av_sm_execute(tBTA_AV_CB *p_cb, UINT16 event, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_ssm_execute(tBTA_AV_SCB *p_scb, UINT16 event, tBTA_AV_DATA *p_data);
|
||||
extern BOOLEAN bta_av_hdl_event(BT_HDR *p_msg);
|
||||
#if (defined(BTA_AV_DEBUG) && BTA_AV_DEBUG == TRUE)
|
||||
extern char *bta_av_evt_code(UINT16 evt_code);
|
||||
#endif
|
||||
extern BOOLEAN bta_av_switch_if_needed(tBTA_AV_SCB *p_scb);
|
||||
extern BOOLEAN bta_av_link_role_ok(tBTA_AV_SCB *p_scb, UINT8 bits);
|
||||
extern BOOLEAN bta_av_is_rcfg_sst(tBTA_AV_SCB *p_scb);
|
||||
|
||||
/* nsm action functions */
|
||||
extern void bta_av_api_disconnect(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_sig_chg(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_sig_timer(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_disc_done(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_closed(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_disc(UINT8 disc);
|
||||
extern void bta_av_conn_chg(tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_dereg_comp(tBTA_AV_DATA *p_data);
|
||||
|
||||
/* sm action functions */
|
||||
extern void bta_av_disable (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_opened (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_remote_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_vendor_cmd (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_vendor_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_close (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_meta_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_free_rsp (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rc_free_msg (tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data);
|
||||
|
||||
extern tBTA_AV_RCB *bta_av_get_rcb_by_shdl(UINT8 shdl);
|
||||
extern void bta_av_del_rc(tBTA_AV_RCB *p_rcb);
|
||||
|
||||
/* ssm action functions */
|
||||
extern void bta_av_do_disc_a2d (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_cleanup (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_free_sdb (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_config_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_disconnect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_security_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_security_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_security_ind (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_security_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_do_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_connect_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_sdp_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_disc_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_disc_res_as_acp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_open_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_getcap_results (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_setconfig_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_discover_req (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_conn_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_do_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_str_stopped (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_reconfig (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_data_path (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_start_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_start_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_str_closed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_clr_cong (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_suspend_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_str_ok (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_failed (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_connect (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_discntd (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_suspend_cont (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_cfm (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rcfg_open (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_security_rej (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_open_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_chk_2nd_start (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_save_caps (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_rej_conn (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_set_use_rc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_cco_close (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_switch_role (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_role_res (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_delay_co (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_open_at_inc (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
|
||||
/* ssm action functions - vdp specific */
|
||||
extern void bta_av_do_disc_vdp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_vdp_str_opened (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data);
|
||||
extern void bta_av_reg_vdp (tAVDT_CS *p_cs, char *p_service_name, void *p_data);
|
||||
|
||||
#endif ///BTA_AV_INCLUDED == TRUE
|
||||
|
||||
#endif /* BTA_AV_INT_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,522 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private file for the file transfer client (FTC).
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_GATTC_INT_H
|
||||
#define BTA_GATTC_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bta_sys.h"
|
||||
#include "bta_gatt_api.h"
|
||||
#include "bta_gattc_ci.h"
|
||||
#include "bta_gattc_co.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "mutex.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
enum {
|
||||
BTA_GATTC_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_GATTC),
|
||||
BTA_GATTC_INT_OPEN_FAIL_EVT,
|
||||
BTA_GATTC_API_CANCEL_OPEN_EVT,
|
||||
BTA_GATTC_INT_CANCEL_OPEN_OK_EVT,
|
||||
|
||||
BTA_GATTC_API_READ_EVT,
|
||||
BTA_GATTC_API_WRITE_EVT,
|
||||
BTA_GATTC_API_EXEC_EVT,
|
||||
BTA_GATTC_API_CFG_MTU_EVT,
|
||||
|
||||
BTA_GATTC_API_CLOSE_EVT,
|
||||
|
||||
BTA_GATTC_API_SEARCH_EVT,
|
||||
BTA_GATTC_API_CONFIRM_EVT,
|
||||
BTA_GATTC_API_READ_MULTI_EVT,
|
||||
BTA_GATTC_API_REFRESH_EVT,
|
||||
|
||||
BTA_GATTC_INT_CONN_EVT,
|
||||
BTA_GATTC_INT_DISCOVER_EVT,
|
||||
BTA_GATTC_DISCOVER_CMPL_EVT,
|
||||
BTA_GATTC_OP_CMPL_EVT,
|
||||
BTA_GATTC_INT_DISCONN_EVT,
|
||||
|
||||
BTA_GATTC_INT_START_IF_EVT,
|
||||
BTA_GATTC_API_REG_EVT,
|
||||
BTA_GATTC_API_DEREG_EVT,
|
||||
BTA_GATTC_API_LISTEN_EVT,
|
||||
BTA_GATTC_API_BROADCAST_EVT,
|
||||
BTA_GATTC_API_DISABLE_EVT,
|
||||
BTA_GATTC_ENC_CMPL_EVT
|
||||
};
|
||||
typedef UINT16 tBTA_GATTC_INT_EVT;
|
||||
|
||||
#define BTA_GATTC_SERVICE_CHANGED_LEN 4
|
||||
|
||||
/* max client application GATTC can support */
|
||||
#ifndef BTA_GATTC_CL_MAX
|
||||
#if (GATT_MAX_PHY_CHANNEL > 3)
|
||||
#define BTA_GATTC_CL_MAX GATT_MAX_PHY_CHANNEL
|
||||
#else
|
||||
#define BTA_GATTC_CL_MAX 3 // The origin value is 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* max known devices GATTC can support */
|
||||
#ifndef BTA_GATTC_KNOWN_SR_MAX
|
||||
#if (GATT_MAX_PHY_CHANNEL > 3)
|
||||
#define BTA_GATTC_KNOWN_SR_MAX GATT_MAX_PHY_CHANNEL
|
||||
#else
|
||||
#define BTA_GATTC_KNOWN_SR_MAX 3 // The origin value is 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BTA_GATTC_CONN_MAX GATT_MAX_PHY_CHANNEL
|
||||
|
||||
#ifndef BTA_GATTC_CLCB_MAX
|
||||
#define BTA_GATTC_CLCB_MAX GATT_CL_MAX_LCB
|
||||
#endif
|
||||
|
||||
#define BTA_GATTC_WRITE_PREPARE GATT_WRITE_PREPARE
|
||||
#define BTA_GATTC_INVALID_HANDLE 0
|
||||
|
||||
/* internal strucutre for GATTC register API */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBT_UUID app_uuid;
|
||||
tBTA_GATTC_CBACK *p_cback;
|
||||
} tBTA_GATTC_API_REG;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATTC_IF client_if;
|
||||
} tBTA_GATTC_INT_START_IF;
|
||||
|
||||
typedef tBTA_GATTC_INT_START_IF tBTA_GATTC_API_DEREG;
|
||||
typedef tBTA_GATTC_INT_START_IF tBTA_GATTC_INT_DEREG;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_ADDR_TYPE remote_addr_type;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BOOLEAN is_direct;
|
||||
tBTA_TRANSPORT transport;
|
||||
} tBTA_GATTC_API_OPEN;
|
||||
|
||||
typedef tBTA_GATTC_API_OPEN tBTA_GATTC_API_CANCEL_OPEN;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
UINT16 handle;
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
} tBTA_GATTC_API_READ;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
UINT16 handle;
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
tBTA_GATTC_WRITE_TYPE write_type;
|
||||
UINT16 offset;
|
||||
UINT16 len;
|
||||
UINT8 *p_value;
|
||||
} tBTA_GATTC_API_WRITE;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BOOLEAN is_execute;
|
||||
} tBTA_GATTC_API_EXEC;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 handle;
|
||||
} tBTA_GATTC_API_CONFIRM;
|
||||
|
||||
typedef tGATT_CL_COMPLETE tBTA_GATTC_CMPL;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 op_code;
|
||||
tGATT_STATUS status;
|
||||
tBTA_GATTC_CMPL *p_cmpl;
|
||||
} tBTA_GATTC_OP_CMPL;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBT_UUID *p_srvc_uuid;
|
||||
} tBTA_GATTC_API_SEARCH;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
UINT8 num_attr;
|
||||
UINT16 handles[GATT_MAX_READ_MULTI_HANDLES];
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
}tBTA_GATTC_API_READ_MULTI;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR_PTR remote_bda;
|
||||
tBTA_GATTC_IF client_if;
|
||||
BOOLEAN start;
|
||||
} tBTA_GATTC_API_LISTEN;
|
||||
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_GATTC_API_CFG_MTU;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATTC_IF client_if;
|
||||
UINT8 role;
|
||||
tBT_TRANSPORT transport;
|
||||
tGATT_DISCONN_REASON reason;
|
||||
BOOLEAN already_connect;
|
||||
} tBTA_GATTC_INT_CONN;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATTC_IF client_if;
|
||||
} tBTA_GATTC_ENC_CMPL;
|
||||
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATTC_API_REG api_reg;
|
||||
tBTA_GATTC_API_DEREG api_dereg;
|
||||
tBTA_GATTC_API_OPEN api_conn;
|
||||
tBTA_GATTC_API_CANCEL_OPEN api_cancel_conn;
|
||||
tBTA_GATTC_API_READ api_read;
|
||||
tBTA_GATTC_API_SEARCH api_search;
|
||||
tBTA_GATTC_API_WRITE api_write;
|
||||
tBTA_GATTC_API_CONFIRM api_confirm;
|
||||
tBTA_GATTC_API_EXEC api_exec;
|
||||
tBTA_GATTC_API_READ_MULTI api_read_multi;
|
||||
tBTA_GATTC_API_CFG_MTU api_mtu;
|
||||
tBTA_GATTC_OP_CMPL op_cmpl;
|
||||
tBTA_GATTC_INT_CONN int_conn;
|
||||
tBTA_GATTC_ENC_CMPL enc_cmpl;
|
||||
|
||||
tBTA_GATTC_INT_START_IF int_start_if;
|
||||
tBTA_GATTC_INT_DEREG int_dereg;
|
||||
/* if peripheral role is supported */
|
||||
tBTA_GATTC_API_LISTEN api_listen;
|
||||
|
||||
} tBTA_GATTC_DATA;
|
||||
|
||||
|
||||
/* GATT server cache on the client */
|
||||
typedef struct {
|
||||
tBT_UUID uuid;
|
||||
UINT16 s_handle;
|
||||
UINT16 e_handle;
|
||||
// this field is set only for characteristic
|
||||
UINT16 char_decl_handle;
|
||||
BOOLEAN is_primary;
|
||||
tBTA_GATT_CHAR_PROP property;
|
||||
} tBTA_GATTC_ATTR_REC;
|
||||
|
||||
|
||||
#define BTA_GATTC_MAX_CACHE_CHAR 40
|
||||
#define BTA_GATTC_ATTR_LIST_SIZE (BTA_GATTC_MAX_CACHE_CHAR * sizeof(tBTA_GATTC_ATTR_REC))
|
||||
|
||||
#ifndef BTA_GATTC_CACHE_SRVR_SIZE
|
||||
#define BTA_GATTC_CACHE_SRVR_SIZE 600
|
||||
#endif
|
||||
|
||||
enum {
|
||||
BTA_GATTC_IDLE_ST = 0, /* Idle */
|
||||
BTA_GATTC_W4_CONN_ST, /* Wait for connection - (optional) */
|
||||
BTA_GATTC_CONN_ST, /* connected state */
|
||||
BTA_GATTC_DISCOVER_ST /* discover is in progress */
|
||||
};
|
||||
typedef UINT8 tBTA_GATTC_STATE;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR server_bda;
|
||||
BOOLEAN connected;
|
||||
|
||||
#define BTA_GATTC_SERV_IDLE 0
|
||||
#define BTA_GATTC_SERV_LOAD 1
|
||||
#define BTA_GATTC_SERV_SAVE 2
|
||||
#define BTA_GATTC_SERV_DISC 3
|
||||
#define BTA_GATTC_SERV_DISC_ACT 4
|
||||
|
||||
UINT8 state;
|
||||
|
||||
list_t *p_srvc_cache; /* list of tBTA_GATTC_SERVICE */
|
||||
UINT8 update_count; /* indication received */
|
||||
UINT8 num_clcb; /* number of associated CLCB */
|
||||
|
||||
|
||||
tBTA_GATTC_ATTR_REC *p_srvc_list;
|
||||
UINT8 cur_srvc_idx;
|
||||
UINT8 cur_char_idx;
|
||||
UINT8 next_avail_idx;
|
||||
UINT8 total_srvc;
|
||||
UINT8 total_char;
|
||||
UINT16 total_attr;
|
||||
UINT8 srvc_hdl_chg; /* service handle change indication pending */
|
||||
UINT16 attr_index; /* cahce NV saving/loading attribute index */
|
||||
|
||||
UINT16 mtu;
|
||||
} tBTA_GATTC_SERV;
|
||||
|
||||
#ifndef BTA_GATTC_NOTIF_REG_MAX
|
||||
#define BTA_GATTC_NOTIF_REG_MAX 7//15
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
UINT16 handle;
|
||||
}tBTA_GATTC_NOTIF_REG;
|
||||
|
||||
typedef struct {
|
||||
tBTA_GATTC_CBACK *p_cback;
|
||||
BOOLEAN in_use;
|
||||
tBTA_GATTC_IF client_if; /* client interface with BTE stack for this application */
|
||||
UINT8 num_clcb; /* number of associated CLCB */
|
||||
BOOLEAN dereg_pending;
|
||||
tBT_UUID app_uuid;
|
||||
tBTA_GATTC_NOTIF_REG notif_reg[BTA_GATTC_NOTIF_REG_MAX];
|
||||
} tBTA_GATTC_RCB;
|
||||
|
||||
/* client channel is a mapping between a BTA client(cl_id) and a remote BD address */
|
||||
typedef struct {
|
||||
UINT16 bta_conn_id; /* client channel ID, unique for clcb */
|
||||
BD_ADDR bda;
|
||||
tBTA_TRANSPORT transport; /* channel transport */
|
||||
tBTA_GATTC_RCB *p_rcb; /* pointer to the registration CB */
|
||||
tBTA_GATTC_SERV *p_srcb; /* server cache CB */
|
||||
tBTA_GATTC_DATA *p_q_cmd; /* command in queue waiting for execution */
|
||||
list_t *p_cmd_list; /* The list to store the command to be sent */
|
||||
BOOLEAN is_full; /* The gattc command queue is full or not */
|
||||
#define BTA_GATTC_NO_SCHEDULE 0
|
||||
#define BTA_GATTC_DISC_WAITING 0x01
|
||||
#define BTA_GATTC_REQ_WAITING 0x10
|
||||
|
||||
UINT8 auto_update; /* auto update is waiting */
|
||||
BOOLEAN disc_active;
|
||||
BOOLEAN in_use;
|
||||
tBTA_GATTC_STATE state;
|
||||
tBTA_GATT_STATUS status;
|
||||
UINT16 reason;
|
||||
} tBTA_GATTC_CLCB;
|
||||
|
||||
/* background connection tracking information */
|
||||
#if GATT_MAX_APPS <= 8
|
||||
typedef UINT8 tBTA_GATTC_CIF_MASK ;
|
||||
#elif GATT_MAX_APPS <= 16
|
||||
typedef UINT16 tBTA_GATTC_CIF_MASK;
|
||||
#elif GATT_MAX_APPS <= 32
|
||||
typedef UINT32 tBTA_GATTC_CIF_MASK;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATTC_CIF_MASK cif_mask;
|
||||
tBTA_GATTC_CIF_MASK cif_adv_mask;
|
||||
|
||||
} tBTA_GATTC_BG_TCK;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BD_ADDR remote_bda;
|
||||
TIMER_LIST_ENT service_change_ccc_timer; /* wait for discovering remote device's service change ccc handle */
|
||||
BOOLEAN ccc_timer_used; /* service_change_ccc_timer started */
|
||||
BOOLEAN service_change_ccc_written; /* has written remote device's service change ccc */
|
||||
} tBTA_GATTC_CONN;
|
||||
|
||||
enum {
|
||||
BTA_GATTC_STATE_DISABLED,
|
||||
BTA_GATTC_STATE_ENABLING,
|
||||
BTA_GATTC_STATE_ENABLED,
|
||||
BTA_GATTC_STATE_DISABLING
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
UINT8 state;
|
||||
osi_mutex_t write_ccc_mutex;
|
||||
tBTA_GATTC_CONN conn_track[BTA_GATTC_CONN_MAX];
|
||||
tBTA_GATTC_BG_TCK bg_track[BTA_GATTC_KNOWN_SR_MAX];
|
||||
tBTA_GATTC_RCB cl_rcb[BTA_GATTC_CL_MAX];
|
||||
|
||||
tBTA_GATTC_CLCB clcb[BTA_GATTC_CLCB_MAX];
|
||||
tBTA_GATTC_SERV known_server[BTA_GATTC_KNOWN_SR_MAX];
|
||||
}tBTA_GATTC_CB;
|
||||
|
||||
typedef enum {
|
||||
SERVICE_CHANGE_CCC_WRITTEN_SUCCESS = 0,
|
||||
SERVICE_CHANGE_CACHE_NOT_FOUND,
|
||||
SERVICE_CHANGE_SERVICE_NOT_FOUND,
|
||||
SERVICE_CHANGE_CHAR_NOT_FOUND,
|
||||
SERVICE_CHANGE_CCC_NOT_FOUND,
|
||||
SERVICE_CHANGE_WRITE_CCC_FAILED
|
||||
}tBTA_GATTC_FIND_SERVICE_CB;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
|
||||
/* GATTC control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_GATTC_CB bta_gattc_cb;
|
||||
#else
|
||||
extern tBTA_GATTC_CB *bta_gattc_cb_ptr;
|
||||
#define bta_gattc_cb (*bta_gattc_cb_ptr)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
** Function prototypes
|
||||
*****************************************************************************/
|
||||
extern BOOLEAN bta_gattc_hdl_event(BT_HDR *p_msg);
|
||||
extern BOOLEAN bta_gattc_sm_execute(tBTA_GATTC_CLCB *p_clcb, UINT16 event, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
/* function processed outside SM */
|
||||
extern void bta_gattc_disable(tBTA_GATTC_CB *p_cb);
|
||||
extern void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_start_if(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_process_api_open (tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_process_api_open_cancel (tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_deregister(tBTA_GATTC_CB *p_cb, tBTA_GATTC_RCB *p_clreg);
|
||||
extern void bta_gattc_process_enc_cmpl(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
|
||||
/* function within state machine */
|
||||
extern void bta_gattc_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_open_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_open_error(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern void bta_gattc_cancel_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_cancel_open_ok(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_cancel_open_error(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_disconncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_close_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_disc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern void bta_gattc_start_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_q_cmd(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_free_command_data(tBTA_GATTC_CLCB *p_clcb);
|
||||
extern void bta_gattc_search(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_confirm(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_execute(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_open(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ci_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_ignore_op_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
extern void bta_gattc_restart_discover(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_init_bk_conn(tBTA_GATTC_API_OPEN *p_data, tBTA_GATTC_RCB *p_clreg);
|
||||
extern void bta_gattc_cancel_bk_conn(tBTA_GATTC_API_CANCEL_OPEN *p_data);
|
||||
extern void bta_gattc_send_open_cback( tBTA_GATTC_RCB *p_clreg, tBTA_GATT_STATUS status,
|
||||
BD_ADDR remote_bda, UINT16 conn_id, tBTA_TRANSPORT transport, UINT16 mtu);
|
||||
extern void bta_gattc_send_connect_cback( tBTA_GATTC_RCB *p_clreg, BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_send_disconnect_cback( tBTA_GATTC_RCB *p_clreg, tGATT_DISCONN_REASON reason,
|
||||
BD_ADDR remote_bda, UINT16 conn_id);
|
||||
extern void bta_gattc_process_api_refresh(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_cfg_mtu(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
#if BLE_INCLUDED == TRUE
|
||||
extern void bta_gattc_listen(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
extern void bta_gattc_broadcast(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg);
|
||||
#endif
|
||||
/* utility functions */
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_find_clcb_by_cif (UINT8 client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport);
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_find_clcb_by_conn_id (UINT16 conn_id);
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_clcb_alloc(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport);
|
||||
extern void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB *p_clcb);
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_find_alloc_clcb(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, tBTA_TRANSPORT transport);
|
||||
extern tBTA_GATTC_RCB *bta_gattc_cl_get_regcb(UINT8 client_if);
|
||||
extern tBTA_GATTC_SERV *bta_gattc_find_srcb(BD_ADDR bda);
|
||||
extern tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda);
|
||||
extern tBTA_GATTC_SERV *bta_gattc_find_scb_by_cid (UINT16 conn_id);
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_find_int_conn_clcb(tBTA_GATTC_DATA *p_msg);
|
||||
extern tBTA_GATTC_CLCB *bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg);
|
||||
|
||||
extern BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data);
|
||||
|
||||
extern BOOLEAN bta_gattc_uuid_compare (const tBT_UUID *p_src, const tBT_UUID *p_tar, BOOLEAN is_precise);
|
||||
extern BOOLEAN bta_gattc_check_notif_registry(tBTA_GATTC_RCB *p_clreg, tBTA_GATTC_SERV *p_srcb, tBTA_GATTC_NOTIFY *p_notify);
|
||||
extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR remote_bda, BOOLEAN add, BOOLEAN is_listen);
|
||||
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
|
||||
extern UINT8 bta_gattc_num_reg_app(void);
|
||||
extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id, UINT16 start_handle, UINT16 end_handle);
|
||||
extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda);
|
||||
|
||||
/* discovery functions */
|
||||
extern void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_RES *p_data);
|
||||
extern void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_STATUS status);
|
||||
extern tBTA_GATT_STATUS bta_gattc_discover_procedure(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
|
||||
extern tBTA_GATT_STATUS bta_gattc_discover_pri_service(UINT16 conn_id, tBTA_GATTC_SERV *p_server_cb, UINT8 disc_type);
|
||||
extern void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid);
|
||||
extern const list_t* bta_gattc_get_services(UINT16 conn_id);
|
||||
extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle);
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
|
||||
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
|
||||
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count);
|
||||
|
||||
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
bt_gatt_get_db_op_t op,
|
||||
UINT16 char_handle,
|
||||
tBT_UUID *incl_uuid,
|
||||
tBT_UUID *char_uuid,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count);
|
||||
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
|
||||
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
|
||||
extern void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
|
||||
extern void bta_gattc_reset_discover_st(tBTA_GATTC_SERV *p_srcb, tBTA_GATT_STATUS status);
|
||||
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_alloc(BD_ADDR remote_bda);
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_find(BD_ADDR remote_bda);
|
||||
extern tBTA_GATTC_CONN *bta_gattc_conn_find_alloc(BD_ADDR remote_bda);
|
||||
extern BOOLEAN bta_gattc_conn_dealloc(BD_ADDR remote_bda);
|
||||
|
||||
extern bool bta_gattc_cache_load(tBTA_GATTC_CLCB *p_clcb);
|
||||
extern void bta_gattc_cache_reset(BD_ADDR server_bda);
|
||||
extern void bta_gattc_deinit(void);
|
||||
|
||||
#endif /* BTA_GATTC_INT_H */
|
@ -1,255 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private file for the BTA GATT server.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_GATTS_INT_H
|
||||
#define BTA_GATTS_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bta_sys.h"
|
||||
#include "bta_gatt_api.h"
|
||||
#include "gatt_api.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and data types
|
||||
*****************************************************************************/
|
||||
enum {
|
||||
BTA_GATTS_API_REG_EVT = BTA_SYS_EVT_START(BTA_ID_GATTS),
|
||||
BTA_GATTS_INT_START_IF_EVT,
|
||||
BTA_GATTS_API_DEREG_EVT,
|
||||
BTA_GATTS_API_CREATE_SRVC_EVT,
|
||||
BTA_GATTS_API_INDICATION_EVT,
|
||||
|
||||
BTA_GATTS_API_ADD_INCL_SRVC_EVT,
|
||||
BTA_GATTS_API_ADD_CHAR_EVT,
|
||||
BTA_GATTS_API_ADD_DESCR_EVT,
|
||||
BTA_GATTS_API_DEL_SRVC_EVT,
|
||||
BTA_GATTS_API_START_SRVC_EVT,
|
||||
BTA_GATTS_API_STOP_SRVC_EVT,
|
||||
BTA_GATTS_API_RSP_EVT,
|
||||
BTA_GATTS_API_SET_ATTR_VAL_EVT,
|
||||
BTA_GATTS_API_OPEN_EVT,
|
||||
BTA_GATTS_API_CANCEL_OPEN_EVT,
|
||||
BTA_GATTS_API_CLOSE_EVT,
|
||||
BTA_GATTS_API_LISTEN_EVT,
|
||||
BTA_GATTS_API_DISABLE_EVT
|
||||
};
|
||||
typedef UINT16 tBTA_GATTS_INT_EVT;
|
||||
|
||||
/* max number of application allowed on device */
|
||||
#define BTA_GATTS_MAX_APP_NUM GATT_MAX_SR_PROFILES
|
||||
|
||||
/* max number of services allowed in the device */
|
||||
#define BTA_GATTS_MAX_SRVC_NUM GATT_MAX_SR_PROFILES
|
||||
|
||||
/* internal strucutre for GATTC register API */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBT_UUID app_uuid;
|
||||
tBTA_GATTS_CBACK *p_cback;
|
||||
} tBTA_GATTS_API_REG;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATTS_IF server_if;
|
||||
} tBTA_GATTS_INT_START_IF;
|
||||
|
||||
typedef tBTA_GATTS_INT_START_IF tBTA_GATTS_API_DEREG;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATTS_IF server_if;
|
||||
tBT_UUID service_uuid;
|
||||
UINT16 num_handle;
|
||||
UINT8 inst;
|
||||
BOOLEAN is_pri;
|
||||
|
||||
} tBTA_GATTS_API_CREATE_SRVC;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBT_UUID char_uuid;
|
||||
tBTA_GATT_PERM perm;
|
||||
tBTA_GATT_CHAR_PROP property;
|
||||
tBTA_GATTS_ATTR_CONTROL control;
|
||||
tBTA_GATT_ATTR_VAL attr_val;
|
||||
} tBTA_GATTS_API_ADD_CHAR;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 included_service_id;
|
||||
} tBTA_GATTS_API_ADD_INCL_SRVC;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBT_UUID descr_uuid;
|
||||
tBTA_GATT_PERM perm;
|
||||
tBTA_GATTS_ATTR_CONTROL control;
|
||||
tBTA_GATT_ATTR_VAL attr_val;
|
||||
} tBTA_GATTS_API_ADD_DESCR;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 attr_id;
|
||||
UINT16 len;
|
||||
BOOLEAN need_confirm;
|
||||
UINT8 value[BTA_GATT_MAX_ATTR_LEN];
|
||||
} tBTA_GATTS_API_INDICATION;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 trans_id;
|
||||
tBTA_GATT_STATUS status;
|
||||
tBTA_GATTS_RSP *p_rsp;
|
||||
} tBTA_GATTS_API_RSP;
|
||||
|
||||
typedef struct{
|
||||
BT_HDR hdr;
|
||||
UINT16 length;
|
||||
UINT8 *value;
|
||||
}tBTA_GATTS_API_SET_ATTR_VAL;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATT_TRANSPORT transport;
|
||||
} tBTA_GATTS_API_START;
|
||||
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR remote_bda;
|
||||
tBTA_GATTS_IF server_if;
|
||||
BOOLEAN is_direct;
|
||||
tBTA_GATT_TRANSPORT transport;
|
||||
|
||||
} tBTA_GATTS_API_OPEN;
|
||||
|
||||
typedef tBTA_GATTS_API_OPEN tBTA_GATTS_API_CANCEL_OPEN;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR_PTR remote_bda;
|
||||
tBTA_GATTS_IF server_if;
|
||||
BOOLEAN start;
|
||||
} tBTA_GATTS_API_LISTEN;
|
||||
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
tBTA_GATTS_API_REG api_reg;
|
||||
tBTA_GATTS_API_DEREG api_dereg;
|
||||
tBTA_GATTS_API_CREATE_SRVC api_create_svc;
|
||||
tBTA_GATTS_API_ADD_INCL_SRVC api_add_incl_srvc;
|
||||
tBTA_GATTS_API_ADD_CHAR api_add_char;
|
||||
tBTA_GATTS_API_ADD_DESCR api_add_char_descr;
|
||||
tBTA_GATTS_API_START api_start;
|
||||
tBTA_GATTS_API_INDICATION api_indicate;
|
||||
tBTA_GATTS_API_RSP api_rsp;
|
||||
tBTA_GATTS_API_SET_ATTR_VAL api_set_val;
|
||||
tBTA_GATTS_API_OPEN api_open;
|
||||
tBTA_GATTS_API_CANCEL_OPEN api_cancel_open;
|
||||
|
||||
tBTA_GATTS_INT_START_IF int_start_if;
|
||||
/* if peripheral role is supported */
|
||||
tBTA_GATTS_API_LISTEN api_listen;
|
||||
} tBTA_GATTS_DATA;
|
||||
|
||||
/* application registration control block */
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
tBT_UUID app_uuid;
|
||||
tBTA_GATTS_CBACK *p_cback;
|
||||
tBTA_GATTS_IF gatt_if;
|
||||
} tBTA_GATTS_RCB;
|
||||
|
||||
/* service registration control block */
|
||||
typedef struct {
|
||||
tBT_UUID service_uuid; /* service UUID */
|
||||
UINT16 service_id; /* service handle */
|
||||
UINT8 inst_num; /* instance ID */
|
||||
UINT8 rcb_idx;
|
||||
UINT8 idx; /* self index of serviec CB */
|
||||
BOOLEAN in_use;
|
||||
|
||||
} tBTA_GATTS_SRVC_CB;
|
||||
|
||||
|
||||
/* GATT server control block */
|
||||
typedef struct {
|
||||
BOOLEAN enabled;
|
||||
tBTA_GATTS_RCB rcb[BTA_GATTS_MAX_APP_NUM];
|
||||
tBTA_GATTS_SRVC_CB srvc_cb[BTA_GATTS_MAX_SRVC_NUM];
|
||||
} tBTA_GATTS_CB;
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
|
||||
/* GATTC control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_GATTS_CB bta_gatts_cb;
|
||||
#else
|
||||
extern tBTA_GATTS_CB *bta_gatts_cb_ptr;
|
||||
#define bta_gatts_cb (*bta_gatts_cb_ptr)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
** Function prototypes
|
||||
*****************************************************************************/
|
||||
extern BOOLEAN bta_gatts_hdl_event(BT_HDR *p_msg);
|
||||
|
||||
extern void bta_gatts_api_disable(tBTA_GATTS_CB *p_cb);
|
||||
extern void bta_gatts_api_enable(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_data);
|
||||
extern void bta_gatts_register(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_start_if(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_deregister(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_create_srvc(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_add_include_srvc(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_add_char(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_add_char_descr(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_set_attr_value(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern tGATT_STATUS bta_gatts_get_attr_value(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
extern void bta_gatts_delete_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_start_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_stop_service(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg);
|
||||
|
||||
extern void bta_gatts_send_rsp(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
|
||||
|
||||
extern void bta_gatts_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_cancel_open (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_close (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
extern void bta_gatts_listen(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg);
|
||||
|
||||
extern BOOLEAN bta_gatts_uuid_compare(tBT_UUID tar, tBT_UUID src);
|
||||
extern tBTA_GATTS_RCB *bta_gatts_find_app_rcb_by_app_if(tBTA_GATTS_IF server_if);
|
||||
extern UINT8 bta_gatts_find_app_rcb_idx_by_app_if(tBTA_GATTS_CB *p_cb, tBTA_GATTS_IF server_if);
|
||||
extern UINT8 bta_gatts_alloc_srvc_cb(tBTA_GATTS_CB *p_cb, UINT8 rcb_idx);
|
||||
extern tBTA_GATTS_SRVC_CB *bta_gatts_find_srvc_cb_by_srvc_id(tBTA_GATTS_CB *p_cb, UINT16 service_id);
|
||||
extern tBTA_GATTS_SRVC_CB *bta_gatts_find_srvc_cb_by_attr_id(tBTA_GATTS_CB *p_cb, UINT16 attr_id);
|
||||
extern void bta_gatts_deinit(void);
|
||||
|
||||
#endif /* BTA_GATTS_INT_H */
|
||||
|
@ -1,401 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2005-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This file contains BTA HID Host internal definitions
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BTA_HH_INT_H
|
||||
#define BTA_HH_INT_H
|
||||
|
||||
#include "bta_sys.h"
|
||||
#include "utl.h"
|
||||
#include "bta_hh_api.h"
|
||||
|
||||
//#if BTA_HH_LE_INCLUDED == TRUE
|
||||
#include "bta_gatt_api.h"
|
||||
//#endif
|
||||
#if defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
|
||||
|
||||
/* can be moved to bta_api.h */
|
||||
#define BTA_HH_MAX_RPT_CHARS 8
|
||||
|
||||
#if (BTA_GATT_INCLUDED == FALSE || BLE_INCLUDED == FALSE)
|
||||
#undef BTA_HH_LE_INCLUDED
|
||||
#define BTA_HH_LE_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* state machine events, these events are handled by the state machine */
|
||||
enum {
|
||||
BTA_HH_API_OPEN_EVT = BTA_SYS_EVT_START(BTA_ID_HH),
|
||||
BTA_HH_API_CLOSE_EVT,
|
||||
BTA_HH_INT_OPEN_EVT,
|
||||
BTA_HH_INT_CLOSE_EVT,
|
||||
BTA_HH_INT_DATA_EVT,
|
||||
BTA_HH_INT_CTRL_DATA,
|
||||
BTA_HH_INT_HANDSK_EVT,
|
||||
BTA_HH_SDP_CMPL_EVT,
|
||||
BTA_HH_API_WRITE_DEV_EVT,
|
||||
BTA_HH_API_GET_DSCP_EVT,
|
||||
BTA_HH_API_MAINT_DEV_EVT,
|
||||
BTA_HH_OPEN_CMPL_EVT,
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
BTA_HH_GATT_CLOSE_EVT,
|
||||
BTA_HH_GATT_OPEN_EVT,
|
||||
BTA_HH_START_ENC_EVT,
|
||||
BTA_HH_ENC_CMPL_EVT,
|
||||
BTA_HH_GATT_READ_CHAR_CMPL_EVT,
|
||||
BTA_HH_GATT_WRITE_CHAR_CMPL_EVT,
|
||||
BTA_HH_GATT_READ_DESCR_CMPL_EVT,
|
||||
BTA_HH_GATT_WRITE_DESCR_CMPL_EVT,
|
||||
BTA_HH_API_SCPP_UPDATE_EVT,
|
||||
BTA_HH_GATT_ENC_CMPL_EVT,
|
||||
#endif
|
||||
|
||||
/* not handled by execute state machine */
|
||||
BTA_HH_API_ENABLE_EVT,
|
||||
BTA_HH_API_DISABLE_EVT,
|
||||
BTA_HH_DISC_CMPL_EVT
|
||||
};
|
||||
typedef UINT16 tBTA_HH_INT_EVT; /* HID host internal events */
|
||||
|
||||
#define BTA_HH_INVALID_EVT (BTA_HH_DISC_CMPL_EVT + 1)
|
||||
|
||||
/* event used to map between BTE event and BTA event */
|
||||
#define BTA_HH_FST_TRANS_CB_EVT BTA_HH_GET_RPT_EVT
|
||||
#define BTA_HH_FST_BTE_TRANS_EVT HID_TRANS_GET_REPORT
|
||||
|
||||
/* sub event code used for device maintainence API call */
|
||||
#define BTA_HH_ADD_DEV 0
|
||||
#define BTA_HH_REMOVE_DEV 1
|
||||
|
||||
/* state machine states */
|
||||
enum {
|
||||
BTA_HH_NULL_ST,
|
||||
BTA_HH_IDLE_ST,
|
||||
BTA_HH_W4_CONN_ST,
|
||||
BTA_HH_CONN_ST
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
, BTA_HH_W4_SEC
|
||||
#endif
|
||||
, BTA_HH_INVALID_ST /* Used to check invalid states before executing SM function */
|
||||
|
||||
};
|
||||
typedef UINT8 tBTA_HH_STATE;
|
||||
|
||||
/* data structure used to send a command/data to HID device */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 t_type;
|
||||
UINT8 param;
|
||||
UINT8 rpt_id;
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
UINT8 srvc_id;
|
||||
#endif
|
||||
UINT16 data;
|
||||
BT_HDR *p_data;
|
||||
} tBTA_HH_CMD_DATA;
|
||||
|
||||
/* data type for BTA_HH_API_ENABLE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT8 sec_mask;
|
||||
UINT8 service_name[BTA_SERVICE_NAME_LEN + 1];
|
||||
tBTA_HH_CBACK *p_cback;
|
||||
} tBTA_HH_API_ENABLE;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
UINT8 sec_mask;
|
||||
tBTA_HH_PROTO_MODE mode;
|
||||
} tBTA_HH_API_CONN;
|
||||
|
||||
/* internal event data from BTE HID callback */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR addr;
|
||||
UINT32 data;
|
||||
BT_HDR *p_data;
|
||||
} tBTA_HH_CBACK_DATA;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bda;
|
||||
UINT16 attr_mask;
|
||||
UINT16 sub_event;
|
||||
UINT8 sub_class;
|
||||
UINT8 app_id;
|
||||
tBTA_HH_DEV_DSCP_INFO dscp_info;
|
||||
} tBTA_HH_MAINT_DEV;
|
||||
|
||||
#if BTA_HH_LE_INCLUDED == TRUE
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 conn_id;
|
||||
tBTA_GATT_REASON reason; /* disconnect reason code, not useful when connect event is reported */
|
||||
|
||||
} tBTA_HH_LE_CLOSE;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 scan_int;
|
||||
UINT16 scan_win;
|
||||
} tBTA_HH_SCPP_UPDATE;
|
||||
#endif
|
||||
/* union of all event data types */
|
||||
typedef union {
|
||||
BT_HDR hdr;
|
||||
tBTA_HH_API_ENABLE api_enable;
|
||||
tBTA_HH_API_CONN api_conn;
|
||||
tBTA_HH_CMD_DATA api_sndcmd;
|
||||
tBTA_HH_CBACK_DATA hid_cback;
|
||||
tBTA_HH_STATUS status;
|
||||
tBTA_HH_MAINT_DEV api_maintdev;
|
||||
#if BTA_HH_LE_INCLUDED == TRUE
|
||||
tBTA_HH_LE_CLOSE le_close;
|
||||
tBTA_GATTC_OPEN le_open;
|
||||
tBTA_HH_SCPP_UPDATE le_scpp_update;
|
||||
tBTA_GATTC_ENC_CMPL_CB le_enc_cmpl;
|
||||
#endif
|
||||
} tBTA_HH_DATA;
|
||||
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
typedef struct {
|
||||
UINT8 index;
|
||||
BOOLEAN in_use;
|
||||
UINT8 inst_id; /* share service instance ID and report instance ID, as
|
||||
hi 4 for service instance ID, low 4 as charatceristic instance ID */
|
||||
tBTA_HH_RPT_TYPE rpt_type;
|
||||
UINT16 uuid;
|
||||
UINT8 prop;
|
||||
UINT8 rpt_id;
|
||||
BOOLEAN client_cfg_exist;
|
||||
UINT16 client_cfg_value;
|
||||
} tBTA_HH_LE_RPT;
|
||||
|
||||
#ifndef BTA_HH_LE_RPT_MAX
|
||||
#define BTA_HH_LE_RPT_MAX 20
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
tBTA_HH_LE_RPT report[BTA_HH_LE_RPT_MAX];
|
||||
|
||||
#define BTA_HH_LE_PROTO_MODE_BIT 0x01
|
||||
#define BTA_HH_LE_CP_BIT 0x02
|
||||
UINT8 option_char; /* control point char exisit or not */
|
||||
|
||||
BOOLEAN expl_incl_srvc;
|
||||
UINT8 incl_srvc_inst; /* assuming only one included service : battery service */
|
||||
UINT8 cur_expl_char_idx; /* currently discovering service index */
|
||||
UINT8 *rpt_map;
|
||||
UINT16 ext_rpt_ref;
|
||||
tBTA_HH_DEV_DESCR descriptor;
|
||||
|
||||
} tBTA_HH_LE_HID_SRVC;
|
||||
|
||||
#ifndef BTA_HH_LE_HID_SRVC_MAX
|
||||
#define BTA_HH_LE_HID_SRVC_MAX 1
|
||||
#endif
|
||||
|
||||
/* convert a HID handle to the LE CB index */
|
||||
#define BTA_HH_GET_LE_CB_IDX(x) (((x) >> 4) - 1)
|
||||
/* convert a GATT connection ID to HID device handle, it is the hi 4 bits of a UINT8 */
|
||||
#define BTA_HH_GET_LE_DEV_HDL(x) (UINT8)(((x) + 1) << 4)
|
||||
/* check to see if th edevice handle is a LE device handle */
|
||||
#define BTA_HH_IS_LE_DEV_HDL(x) ((x) & 0xf0)
|
||||
#define BTA_HH_IS_LE_DEV_HDL_VALID(x) (((x)>>4) <= BTA_HH_LE_MAX_KNOWN)
|
||||
#endif
|
||||
|
||||
/* device control block */
|
||||
typedef struct {
|
||||
tBTA_HH_DEV_DSCP_INFO dscp_info; /* report descriptor and DI information */
|
||||
BD_ADDR addr; /* BD-Addr of the HID device */
|
||||
UINT16 attr_mask; /* attribute mask */
|
||||
UINT16 w4_evt; /* W4_handshake event name */
|
||||
UINT8 index; /* index number referenced to handle index */
|
||||
UINT8 sub_class; /* Cod sub class */
|
||||
UINT8 sec_mask; /* security mask */
|
||||
UINT8 app_id; /* application ID for this connection */
|
||||
UINT8 hid_handle; /* device handle : low 4 bits for regular HID: HID_HOST_MAX_DEVICES can not exceed 15;
|
||||
high 4 bits for LE HID: GATT_MAX_PHY_CHANNEL can not exceed 15 */
|
||||
BOOLEAN vp; /* virtually unplug flag */
|
||||
BOOLEAN in_use; /* control block currently in use */
|
||||
BOOLEAN incoming_conn; /* is incoming connection? */
|
||||
UINT8 incoming_hid_handle; /* temporary handle for incoming connection? */
|
||||
BOOLEAN opened; /* TRUE if device successfully opened HID connection */
|
||||
tBTA_HH_PROTO_MODE mode; /* protocol mode */
|
||||
tBTA_HH_STATE state; /* CB state */
|
||||
|
||||
#if (BTA_HH_LE_INCLUDED == TRUE)
|
||||
#define BTA_HH_LE_DISC_NONE 0x00
|
||||
#define BTA_HH_LE_DISC_HIDS 0x01
|
||||
#define BTA_HH_LE_DISC_DIS 0x02
|
||||
#define BTA_HH_LE_DISC_SCPS 0x04
|
||||
|
||||
UINT8 disc_active;
|
||||
tBTA_HH_STATUS status;
|
||||
tBTA_GATT_REASON reason;
|
||||
BOOLEAN is_le_device;
|
||||
tBTA_HH_LE_HID_SRVC hid_srvc[BTA_HH_LE_HID_SRVC_MAX];
|
||||
UINT16 conn_id;
|
||||
BOOLEAN in_bg_conn;
|
||||
UINT8 total_srvc;
|
||||
UINT8 clt_cfg_idx;
|
||||
UINT8 cur_srvc_index; /* currently discovering service index */
|
||||
BOOLEAN scps_supported;
|
||||
|
||||
#define BTA_HH_LE_SCPS_NOTIFY_NONE 0
|
||||
#define BTA_HH_LE_SCPS_NOTIFY_SPT 0x01
|
||||
#define BTA_HH_LE_SCPS_NOTIFY_ENB 0x02
|
||||
UINT8 scps_notify; /* scan refresh supported/notification enabled */
|
||||
#endif
|
||||
|
||||
BOOLEAN security_pending;
|
||||
} tBTA_HH_DEV_CB;
|
||||
|
||||
/* key board parsing control block */
|
||||
typedef struct {
|
||||
BOOLEAN mod_key[4]; /* ctrl, shift(upper), Alt, GUI */
|
||||
BOOLEAN num_lock;
|
||||
BOOLEAN caps_lock;
|
||||
UINT8 last_report[BTA_HH_MAX_RPT_CHARS];
|
||||
} tBTA_HH_KB_CB;
|
||||
|
||||
/******************************************************************************
|
||||
** Main Control Block
|
||||
*******************************************************************************/
|
||||
typedef struct {
|
||||
tBTA_HH_KB_CB kb_cb; /* key board control block,
|
||||
suppose BTA will connect
|
||||
to only one keyboard at
|
||||
the same time */
|
||||
tBTA_HH_DEV_CB kdev[BTA_HH_MAX_DEVICE]; /* device control block */
|
||||
tBTA_HH_DEV_CB *p_cur; /* current device control
|
||||
block idx, used in sdp */
|
||||
UINT8 cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index
|
||||
map to dev handle */
|
||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||
UINT8 le_cb_index[BTA_HH_MAX_DEVICE]; /* maintain a CB index map to LE dev handle */
|
||||
tBTA_GATTC_IF gatt_if;
|
||||
#endif
|
||||
tBTA_HH_CBACK *p_cback; /* Application callbacks */
|
||||
tSDP_DISCOVERY_DB *p_disc_db;
|
||||
UINT8 trace_level; /* tracing level */
|
||||
UINT8 cnt_num; /* connected device number */
|
||||
BOOLEAN w4_disable; /* w4 disable flag */
|
||||
}
|
||||
tBTA_HH_CB;
|
||||
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_HH_CB bta_hh_cb;
|
||||
#else
|
||||
extern tBTA_HH_CB *bta_hh_cb_ptr;
|
||||
#define bta_hh_cb (*bta_hh_cb_ptr)
|
||||
#endif
|
||||
|
||||
/* from bta_hh_cfg.c */
|
||||
extern tBTA_HH_CFG *p_bta_hh_cfg;
|
||||
|
||||
/*****************************************************************************
|
||||
** Function prototypes
|
||||
*****************************************************************************/
|
||||
extern BOOLEAN bta_hh_hdl_event(BT_HDR *p_msg);
|
||||
extern void bta_hh_sm_execute(tBTA_HH_DEV_CB *p_cb, UINT16 event,
|
||||
tBTA_HH_DATA *p_data);
|
||||
|
||||
/* action functions */
|
||||
extern void bta_hh_api_disc_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_open_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_close_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_data_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_start_sdp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_handsk_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_open_failure(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
|
||||
/* utility functions */
|
||||
extern UINT8 bta_hh_find_cb(BD_ADDR bda);
|
||||
extern void bta_hh_parse_keybd_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
|
||||
UINT8 *p_report, UINT16 report_len);
|
||||
extern void bta_hh_parse_mice_rpt(tBTA_HH_BOOT_RPT *p_kb_data,
|
||||
UINT8 *p_report, UINT16 report_len);
|
||||
extern BOOLEAN bta_hh_tod_spt(tBTA_HH_DEV_CB *p_cb, UINT8 sub_class);
|
||||
extern void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb);
|
||||
|
||||
extern void bta_hh_add_device_to_list(tBTA_HH_DEV_CB *p_cb, UINT8 handle,
|
||||
UINT16 attr_mask,
|
||||
tHID_DEV_DSCP_INFO *p_dscp_info,
|
||||
UINT8 sub_class, UINT16 max_latency, UINT16 min_tout, UINT8 app_id);
|
||||
extern void bta_hh_update_di_info(tBTA_HH_DEV_CB *p_cb, UINT16 vendor_id, UINT16 product_id,
|
||||
UINT16 version, UINT8 flag);
|
||||
extern void bta_hh_cleanup_disable(tBTA_HH_STATUS status);
|
||||
|
||||
extern UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle);
|
||||
|
||||
/* action functions used outside state machine */
|
||||
extern void bta_hh_api_enable(tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_api_disable(void);
|
||||
extern void bta_hh_disc_cmpl(void);
|
||||
|
||||
extern tBTA_HH_STATUS bta_hh_read_ssr_param(BD_ADDR bd_addr, UINT16 *p_max_ssr_lat, UINT16 *p_min_ssr_tout);
|
||||
|
||||
/* functions for LE HID */
|
||||
extern void bta_hh_le_enable(void);
|
||||
extern BOOLEAN bta_hh_le_is_hh_gatt_if(tBTA_GATTC_IF client_if);
|
||||
extern void bta_hh_le_deregister(void);
|
||||
extern BOOLEAN bta_hh_is_le_device(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
|
||||
extern void bta_hh_le_open_conn(tBTA_HH_DEV_CB *p_cb, BD_ADDR remote_bda);
|
||||
extern void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB *p_cb);
|
||||
extern void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB *p_cb);
|
||||
extern void bta_hh_le_write_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern UINT8 bta_hh_le_add_device(tBTA_HH_DEV_CB *p_cb, tBTA_HH_MAINT_DEV *p_dev_info);
|
||||
extern void bta_hh_le_remove_dev_bg_conn(tBTA_HH_DEV_CB *p_cb);
|
||||
extern void bta_hh_le_open_fail(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_gatt_open(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_gatt_close(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_start_security(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_start_srvc_discovery(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_w4_le_read_char_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_read_char_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_w4_le_read_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_read_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_w4_le_write_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_write_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_write_char_descr_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_start_security(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_security_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_update_scpp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
extern void bta_hh_le_notify_enc_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
|
||||
extern void bta_hh_ci_load_rpt (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
|
||||
|
||||
#if BTA_HH_DEBUG
|
||||
extern void bta_hh_trace_dev_db(void);
|
||||
#endif
|
||||
|
||||
#endif ///defined(BTA_HH_INCLUDED) && (BTA_HH_INCLUDED == TRUE)
|
||||
#endif
|
||||
|
@ -1,429 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2006-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private interface file for the BTA Java I/F
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_JV_INT_H
|
||||
#define BTA_JV_INT_H
|
||||
|
||||
#include "bta_sys.h"
|
||||
#include "bta_api.h"
|
||||
#include "bta_jv_api.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "port_api.h"
|
||||
#include "sdp_api.h"
|
||||
|
||||
#include "bt_target.h"
|
||||
#if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
enum {
|
||||
/* these events are handled by the state machine */
|
||||
BTA_JV_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_JV),
|
||||
BTA_JV_API_DISABLE_EVT,
|
||||
BTA_JV_API_GET_CHANNEL_EVT,
|
||||
BTA_JV_API_FREE_SCN_EVT,
|
||||
BTA_JV_API_START_DISCOVERY_EVT,
|
||||
BTA_JV_API_CREATE_RECORD_EVT,
|
||||
BTA_JV_API_DELETE_RECORD_EVT,
|
||||
BTA_JV_API_L2CAP_CONNECT_EVT,
|
||||
BTA_JV_API_L2CAP_CLOSE_EVT,
|
||||
BTA_JV_API_L2CAP_START_SERVER_EVT,
|
||||
BTA_JV_API_L2CAP_STOP_SERVER_EVT,
|
||||
BTA_JV_API_L2CAP_READ_EVT,
|
||||
BTA_JV_API_L2CAP_WRITE_EVT,
|
||||
BTA_JV_API_RFCOMM_CONNECT_EVT,
|
||||
BTA_JV_API_RFCOMM_CLOSE_EVT,
|
||||
BTA_JV_API_RFCOMM_START_SERVER_EVT,
|
||||
BTA_JV_API_RFCOMM_STOP_SERVER_EVT,
|
||||
BTA_JV_API_RFCOMM_READ_EVT,
|
||||
BTA_JV_API_RFCOMM_WRITE_EVT,
|
||||
BTA_JV_API_SET_PM_PROFILE_EVT,
|
||||
BTA_JV_API_PM_STATE_CHANGE_EVT,
|
||||
BTA_JV_API_L2CAP_CONNECT_LE_EVT,
|
||||
BTA_JV_API_L2CAP_START_SERVER_LE_EVT,
|
||||
BTA_JV_API_L2CAP_STOP_SERVER_LE_EVT,
|
||||
BTA_JV_API_L2CAP_WRITE_FIXED_EVT,
|
||||
BTA_JV_API_L2CAP_CLOSE_FIXED_EVT,
|
||||
BTA_JV_MAX_INT_EVT
|
||||
};
|
||||
|
||||
#ifndef BTA_JV_RFC_EV_MASK
|
||||
#define BTA_JV_RFC_EV_MASK (PORT_EV_RXCHAR | PORT_EV_TXEMPTY | PORT_EV_FC | PORT_EV_FCS)
|
||||
#endif
|
||||
|
||||
/* data type for BTA_JV_API_ENABLE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_JV_DM_CBACK *p_cback;
|
||||
} tBTA_JV_API_ENABLE;
|
||||
|
||||
/* data type for BTA_JV_API_START_DISCOVERY_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
UINT16 num_uuid;
|
||||
tSDP_UUID uuid_list[BTA_JV_MAX_UUIDS];
|
||||
UINT16 num_attr;
|
||||
UINT16 attr_list[BTA_JV_MAX_ATTRS];
|
||||
void *user_data; /* piggyback caller's private data*/
|
||||
} tBTA_JV_API_START_DISCOVERY;
|
||||
|
||||
enum {
|
||||
BTA_JV_PM_FREE_ST = 0, /* empty PM slot */
|
||||
BTA_JV_PM_IDLE_ST,
|
||||
BTA_JV_PM_BUSY_ST
|
||||
};
|
||||
|
||||
/* BTA JV PM control block */
|
||||
typedef struct {
|
||||
UINT32 handle; /* The connection handle */
|
||||
UINT8 state; /* state: see above enum */
|
||||
tBTA_JV_PM_ID app_id; /* JV app specific id indicating power table to use */
|
||||
BD_ADDR peer_bd_addr; /* Peer BD address */
|
||||
} tBTA_JV_PM_CB;
|
||||
|
||||
enum {
|
||||
BTA_JV_ST_NONE = 0,
|
||||
BTA_JV_ST_CL_OPENING,
|
||||
BTA_JV_ST_CL_OPEN,
|
||||
BTA_JV_ST_CL_CLOSING,
|
||||
BTA_JV_ST_SR_LISTEN,
|
||||
BTA_JV_ST_SR_OPEN,
|
||||
BTA_JV_ST_SR_CLOSING
|
||||
} ;
|
||||
typedef UINT8 tBTA_JV_STATE;
|
||||
#define BTA_JV_ST_CL_MAX BTA_JV_ST_CL_CLOSING
|
||||
/* JV L2CAP control block */
|
||||
typedef struct {
|
||||
tBTA_JV_L2CAP_CBACK *p_cback; /* the callback function */
|
||||
UINT16 psm; /* the psm used for this server connection */
|
||||
tBTA_JV_STATE state; /* the state of this control block */
|
||||
tBTA_SERVICE_ID sec_id; /* service id */
|
||||
UINT32 handle; /* the handle reported to java app (same as gap handle) */
|
||||
BOOLEAN cong; /* TRUE, if congested */
|
||||
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
|
||||
void *user_data; /* user data for callback from higher layers */
|
||||
} tBTA_JV_L2C_CB;
|
||||
|
||||
#define BTA_JV_RFC_HDL_MASK 0xFF
|
||||
#define BTA_JV_RFCOMM_MASK 0x80
|
||||
#define BTA_JV_ALL_APP_ID 0xFF
|
||||
#define BTA_JV_RFC_HDL_TO_SIDX(r) (((r)&0xFF00) >> 8)
|
||||
#define BTA_JV_RFC_H_S_TO_HDL(h, s) ((h)|(s<<8))
|
||||
|
||||
/* port control block */
|
||||
typedef struct {
|
||||
UINT32 handle; /* the rfcomm session handle at jv */
|
||||
UINT16 port_handle;/* port handle */
|
||||
tBTA_JV_STATE state; /* the state of this control block */
|
||||
UINT8 max_sess; /* max sessions */
|
||||
void *user_data; /* piggyback caller's private data*/
|
||||
BOOLEAN cong; /* TRUE, if congested */
|
||||
tBTA_JV_PM_CB *p_pm_cb; /* ptr to pm control block, NULL: unused */
|
||||
} tBTA_JV_PCB;
|
||||
|
||||
/* JV RFCOMM control block */
|
||||
typedef struct {
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback; /* the callback function */
|
||||
UINT16 rfc_hdl[BTA_JV_MAX_RFC_SR_SESSION];
|
||||
tBTA_SERVICE_ID sec_id; /* service id */
|
||||
UINT8 handle; /* index: the handle reported to java app */
|
||||
UINT8 scn; /* the scn of the server */
|
||||
UINT8 max_sess; /* max sessions */
|
||||
int curr_sess; /* current sessions count*/
|
||||
} tBTA_JV_RFC_CB;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_CONNECT_EVT & BTA_JV_API_L2CAP_CONNECT_LE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_SEC sec_mask;
|
||||
tBTA_JV_ROLE role;
|
||||
union {
|
||||
UINT16 remote_psm;
|
||||
UINT16 remote_chan;
|
||||
};
|
||||
UINT16 rx_mtu;
|
||||
BD_ADDR peer_bd_addr;
|
||||
INT32 has_cfg;
|
||||
tL2CAP_CFG_INFO cfg;
|
||||
INT32 has_ertm_info;
|
||||
tL2CAP_ERTM_INFO ertm_info;
|
||||
tBTA_JV_L2CAP_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_CONNECT;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_SERVER_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_SEC sec_mask;
|
||||
tBTA_JV_ROLE role;
|
||||
union {
|
||||
UINT16 local_psm;
|
||||
UINT16 local_chan;
|
||||
};
|
||||
UINT16 rx_mtu;
|
||||
INT32 has_cfg;
|
||||
tL2CAP_CFG_INFO cfg;
|
||||
INT32 has_ertm_info;
|
||||
tL2CAP_ERTM_INFO ertm_info;
|
||||
tBTA_JV_L2CAP_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_SERVER;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_CLOSE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
tBTA_JV_L2C_CB *p_cb;
|
||||
} tBTA_JV_API_L2CAP_CLOSE;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_READ_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
UINT32 req_id;
|
||||
tBTA_JV_L2CAP_CBACK *p_cback;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_READ;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_WRITE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
UINT32 req_id;
|
||||
tBTA_JV_L2C_CB *p_cb;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_WRITE;
|
||||
|
||||
/* data type for BTA_JV_API_L2CAP_WRITE_FIXED_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 channel;
|
||||
BD_ADDR addr;
|
||||
UINT32 req_id;
|
||||
tBTA_JV_L2CAP_CBACK *p_cback;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_L2CAP_WRITE_FIXED;
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_CONNECT_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_SEC sec_mask;
|
||||
tBTA_JV_ROLE role;
|
||||
UINT8 remote_scn;
|
||||
BD_ADDR peer_bd_addr;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_RFCOMM_CONNECT;
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_SERVER_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_SEC sec_mask;
|
||||
tBTA_JV_ROLE role;
|
||||
UINT8 local_scn;
|
||||
UINT8 max_session;
|
||||
UINT32 handle;
|
||||
tBTA_JV_RFCOMM_CBACK *p_cback;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_RFCOMM_SERVER;
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_READ_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
UINT32 req_id;
|
||||
UINT8 *p_data;
|
||||
UINT16 len;
|
||||
tBTA_JV_RFC_CB *p_cb;
|
||||
tBTA_JV_PCB *p_pcb;
|
||||
} tBTA_JV_API_RFCOMM_READ;
|
||||
|
||||
/* data type for BTA_JV_API_SET_PM_PROFILE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
tBTA_JV_PM_ID app_id;
|
||||
tBTA_JV_CONN_STATE init_st;
|
||||
} tBTA_JV_API_SET_PM_PROFILE;
|
||||
|
||||
/* data type for BTA_JV_API_PM_STATE_CHANGE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_JV_PM_CB *p_cb;
|
||||
tBTA_JV_CONN_STATE state;
|
||||
} tBTA_JV_API_PM_STATE_CHANGE;
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_WRITE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
UINT32 req_id;
|
||||
UINT8 *p_data;
|
||||
int len;
|
||||
tBTA_JV_RFC_CB *p_cb;
|
||||
tBTA_JV_PCB *p_pcb;
|
||||
} tBTA_JV_API_RFCOMM_WRITE;
|
||||
|
||||
/* data type for BTA_JV_API_RFCOMM_CLOSE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
tBTA_JV_RFC_CB *p_cb;
|
||||
tBTA_JV_PCB *p_pcb;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_RFCOMM_CLOSE;
|
||||
|
||||
/* data type for BTA_JV_API_CREATE_RECORD_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
#define ESP_SDP_SERVER_NAME_MAX (32)
|
||||
char name[ESP_SDP_SERVER_NAME_MAX + 1];
|
||||
INT32 channel;
|
||||
void *user_data;
|
||||
} tBTA_JV_API_CREATE_RECORD;
|
||||
|
||||
/* data type for BTA_JV_API_ADD_ATTRIBUTE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT32 handle;
|
||||
UINT16 attr_id;
|
||||
UINT8 *p_value;
|
||||
INT32 value_size;
|
||||
} tBTA_JV_API_ADD_ATTRIBUTE;
|
||||
|
||||
/* data type for BTA_JV_API_FREE_SCN_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
|
||||
UINT16 scn;
|
||||
} tBTA_JV_API_FREE_CHANNEL;
|
||||
|
||||
/* data type for BTA_JV_API_ALLOC_CHANNEL_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
INT32 type; /* One of BTA_JV_CONN_TYPE_ */
|
||||
INT32 channel; /* optionally request a specific channel */
|
||||
void *user_data;
|
||||
} tBTA_JV_API_ALLOC_CHANNEL;
|
||||
/* union of all data types */
|
||||
typedef union {
|
||||
/* GKI event buffer header */
|
||||
BT_HDR hdr;
|
||||
tBTA_JV_API_ENABLE enable;
|
||||
tBTA_JV_API_START_DISCOVERY start_discovery;
|
||||
tBTA_JV_API_ALLOC_CHANNEL alloc_channel;
|
||||
tBTA_JV_API_FREE_CHANNEL free_channel;
|
||||
tBTA_JV_API_CREATE_RECORD create_record;
|
||||
tBTA_JV_API_ADD_ATTRIBUTE add_attr;
|
||||
tBTA_JV_API_L2CAP_CONNECT l2cap_connect;
|
||||
tBTA_JV_API_L2CAP_READ l2cap_read;
|
||||
tBTA_JV_API_L2CAP_WRITE l2cap_write;
|
||||
tBTA_JV_API_L2CAP_CLOSE l2cap_close;
|
||||
tBTA_JV_API_L2CAP_SERVER l2cap_server;
|
||||
tBTA_JV_API_RFCOMM_CONNECT rfcomm_connect;
|
||||
tBTA_JV_API_RFCOMM_READ rfcomm_read;
|
||||
tBTA_JV_API_RFCOMM_WRITE rfcomm_write;
|
||||
tBTA_JV_API_SET_PM_PROFILE set_pm;
|
||||
tBTA_JV_API_PM_STATE_CHANGE change_pm_state;
|
||||
tBTA_JV_API_RFCOMM_CLOSE rfcomm_close;
|
||||
tBTA_JV_API_RFCOMM_SERVER rfcomm_server;
|
||||
tBTA_JV_API_L2CAP_WRITE_FIXED l2cap_write_fixed;
|
||||
} tBTA_JV_MSG;
|
||||
|
||||
/* JV control block */
|
||||
typedef struct {
|
||||
/* the SDP handle reported to JV user is the (index + 1) to sdp_handle[].
|
||||
* if sdp_handle[i]==0, it's not used.
|
||||
* otherwise sdp_handle[i] is the stack SDP handle. */
|
||||
UINT32 sdp_handle[BTA_JV_MAX_SDP_REC]; /* SDP records created */
|
||||
UINT8 *p_sel_raw_data;/* the raw data of last service select */
|
||||
tBTA_JV_DM_CBACK *p_dm_cback;
|
||||
tBTA_JV_L2C_CB l2c_cb[BTA_JV_MAX_L2C_CONN]; /* index is GAP handle (index) */
|
||||
tBTA_JV_RFC_CB rfc_cb[BTA_JV_MAX_RFC_CONN];
|
||||
tBTA_JV_PCB port_cb[MAX_RFC_PORTS]; /* index of this array is
|
||||
the port_handle, */
|
||||
UINT8 sec_id[BTA_JV_NUM_SERVICE_ID]; /* service ID */
|
||||
BOOLEAN scn[BTA_JV_MAX_SCN]; /* SCN allocated by java */
|
||||
UINT16 free_psm_list[BTA_JV_MAX_L2C_CONN]; /* PSMs freed by java
|
||||
(can be reused) */
|
||||
UINT8 sdp_active; /* see BTA_JV_SDP_ACT_* */
|
||||
tSDP_UUID uuid; /* current uuid of sdp discovery*/
|
||||
tBTA_JV_PM_CB pm_cb[BTA_JV_PM_MAX_NUM]; /* PM on a per JV handle bases */
|
||||
} tBTA_JV_CB;
|
||||
|
||||
enum {
|
||||
BTA_JV_SDP_ACT_NONE = 0,
|
||||
BTA_JV_SDP_ACT_YES, /* waiting for SDP result */
|
||||
BTA_JV_SDP_ACT_CANCEL /* waiting for cancel complete */
|
||||
};
|
||||
|
||||
/* JV control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_JV_CB bta_jv_cb;
|
||||
#else
|
||||
extern tBTA_JV_CB *bta_jv_cb_ptr;
|
||||
#define bta_jv_cb (*bta_jv_cb_ptr)
|
||||
#endif
|
||||
|
||||
/* config struct */
|
||||
extern tBTA_JV_CFG *p_bta_jv_cfg;
|
||||
|
||||
extern BOOLEAN bta_jv_sm_execute(BT_HDR *p_msg);
|
||||
|
||||
extern void bta_jv_enable (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_disable (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_get_channel_id (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_free_scn (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_start_discovery (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_create_record (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_delete_record (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_connect (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_close (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_start_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_stop_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_read (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_write (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_connect (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_close (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_start_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_stop_server (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_read (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_rfcomm_write (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_set_pm_profile (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_change_pm_state(tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_connect_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_start_server_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_stop_server_le (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_write_fixed (tBTA_JV_MSG *p_data);
|
||||
extern void bta_jv_l2cap_close_fixed (tBTA_JV_MSG *p_data);
|
||||
|
||||
#endif ///defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE
|
||||
#endif /* BTA_JV_INT_H */
|
@ -1,112 +0,0 @@
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
* Copyright (C) 2003-2012 Broadcom Corporation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* This is the private interface file for the BTA SDP I/F
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_SDP_INT_H
|
||||
#define BTA_SDP_INT_H
|
||||
|
||||
#include "bta_sys.h"
|
||||
#include "bta_api.h"
|
||||
#include "bta_sdp_api.h"
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
*****************************************************************************/
|
||||
|
||||
enum {
|
||||
/* these events are handled by the state machine */
|
||||
BTA_SDP_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_SDP),
|
||||
BTA_SDP_API_SEARCH_EVT,
|
||||
BTA_SDP_API_CREATE_RECORD_USER_EVT,
|
||||
BTA_SDP_API_REMOVE_RECORD_USER_EVT,
|
||||
BTA_SDP_MAX_INT_EVT
|
||||
};
|
||||
|
||||
enum {
|
||||
BTA_SDP_ACTIVE_NONE = 0,
|
||||
BTA_SDP_ACTIVE_YES /* waiting for SDP result */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* data type for BTA_SDP_API_ENABLE_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBTA_SDP_DM_CBACK *p_cback;
|
||||
} tBTA_SDP_API_ENABLE;
|
||||
|
||||
/* data type for BTA_SDP_API_SEARCH_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR bd_addr;
|
||||
tSDP_UUID uuid;
|
||||
} tBTA_SDP_API_SEARCH;
|
||||
|
||||
/* data type for BTA_SDP_API_SEARCH_EVT */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
void *user_data;
|
||||
} tBTA_SDP_API_RECORD_USER;
|
||||
|
||||
/* union of all data types */
|
||||
typedef union {
|
||||
/* event buffer header */
|
||||
BT_HDR hdr;
|
||||
tBTA_SDP_API_ENABLE enable;
|
||||
tBTA_SDP_API_SEARCH get_search;
|
||||
tBTA_SDP_API_RECORD_USER record;
|
||||
} tBTA_SDP_MSG;
|
||||
|
||||
/* SDP control block */
|
||||
typedef struct {
|
||||
UINT8 sdp_active; /* see BTA_SDP_SDP_ACT_* */
|
||||
BD_ADDR remote_addr;
|
||||
tBTA_SDP_DM_CBACK *p_dm_cback;
|
||||
} tBTA_SDP_CB;
|
||||
|
||||
|
||||
/* SDP control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
extern tBTA_SDP_CB bta_sdp_cb;
|
||||
#else
|
||||
extern tBTA_SDP_CB *bta_sdp_cb_ptr;
|
||||
#define bta_sdp_cb (*bta_sdp_cb_ptr)
|
||||
#endif
|
||||
|
||||
/* config struct */
|
||||
extern tBTA_SDP_CFG *p_bta_sdp_cfg;
|
||||
|
||||
extern BOOLEAN bta_sdp_sm_execute(BT_HDR *p_msg);
|
||||
|
||||
extern void bta_sdp_enable (tBTA_SDP_MSG *p_data);
|
||||
extern void bta_sdp_search (tBTA_SDP_MSG *p_data);
|
||||
extern void bta_sdp_create_record(tBTA_SDP_MSG *p_data);
|
||||
extern void bta_sdp_remove_record(tBTA_SDP_MSG *p_data);
|
||||
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
|
||||
#endif /* BTA_SDP_INT_H */
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define __BTC_ALARM_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "alarm.h"
|
||||
#include "osi/alarm.h"
|
||||
|
||||
/* btc_alarm_args_t */
|
||||
typedef struct {
|
@ -13,8 +13,8 @@
|
||||
// limitations under the License.
|
||||
#ifndef __BTC_BLE_STORAGE_H__
|
||||
#define __BTC_BLE_STORAGE_H__
|
||||
#include "bt_types.h"
|
||||
#include "bt_target.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "esp_gap_ble_api.h"
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
@ -16,9 +16,9 @@
|
||||
#ifndef __BTC_COMMON_H__
|
||||
#define __BTC_COMMON_H__
|
||||
|
||||
#include "bt_trace.h"
|
||||
#include "bt_types.h"
|
||||
#include "osi.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "osi/osi.h"
|
||||
|
||||
#define BTC_ASSERTC(cond, msg, val) if (!(cond)) { LOG_ERROR( \
|
||||
"### ASSERT : %s line %d %s (%d) ###", __FILE__, __LINE__, msg, val);}
|
@ -18,7 +18,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
typedef struct btc_config_section_iter_t btc_config_section_iter_t;
|
||||
|
||||
@ -49,7 +49,7 @@ int btc_config_clear(void);
|
||||
|
||||
// TODO(zachoverflow): Eww...we need to move these out. These are peer specific, not config general.
|
||||
bool btc_get_address_type(const BD_ADDR bd_addr, int *p_addr_type);
|
||||
bool btc_compare_address_key_value(const char *section, char *key_type, void *key_value, int key_length);
|
||||
bool btc_compare_address_key_value(const char *section, const char *key_type, void *key_value, int key_length);
|
||||
bool btc_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
|
||||
|
||||
void btc_config_lock(void);
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_bt_device.h"
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
||||
typedef enum {
|
||||
BTC_DEV_ACT_SET_DEVICE_NAME
|
@ -15,9 +15,9 @@
|
||||
#ifndef __BTC_DM_H__
|
||||
#define __BTC_DM_H__
|
||||
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "bta_api.h"
|
||||
#include "bta/bta_api.h"
|
||||
|
||||
typedef enum {
|
||||
BTC_DM_SEC_ACT
|
@ -15,11 +15,11 @@
|
||||
#ifndef __BTC_BT_MAIN_H__
|
||||
#define __BTC_BT_MAIN_H__
|
||||
|
||||
#include "future.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_main.h"
|
||||
#include "btc_task.h"
|
||||
#include "osi/future.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_main.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
||||
typedef enum {
|
||||
BTC_MAIN_ACT_INIT = 0,
|
@ -15,8 +15,8 @@
|
||||
#ifndef __BTC_MANAGE_H__
|
||||
#define __BTC_MANAGE_H__
|
||||
|
||||
#include "bta_api.h"
|
||||
#include "btc_task.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
/* reset gatt callback table */
|
@ -14,7 +14,7 @@
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_profile_queue.h
|
||||
* Filename: btc/btc_profile_queue.h
|
||||
*
|
||||
* Description: Bluetooth remote device connection queuing
|
||||
*
|
||||
@ -23,8 +23,8 @@
|
||||
#ifndef __BTC_PROFILE_QUEUE_H__
|
||||
#define __BTC_PROFILE_QUEUE_H__
|
||||
|
||||
#include "bt_defs.h"
|
||||
#include "btc_task.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
||||
typedef enum {
|
||||
BTC_PRF_QUE_CONNECT = 0,
|
@ -15,7 +15,7 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Filename: btc_sm.h
|
||||
* Filename: btc/btc_sm.h
|
||||
*
|
||||
* Description: Generic BTC state machine API
|
||||
*
|
@ -16,8 +16,9 @@
|
||||
#define __BTC_STORAGE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bt_defs.h"
|
||||
#include "bt_types.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
|
||||
|
||||
#define BTC_STORAGE_DEV_CLASS_STR "DevClass"
|
||||
@ -65,4 +66,27 @@ bt_status_t btc_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr);
|
||||
*******************************************************************************/
|
||||
bt_status_t btc_storage_load_bonded_devices(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_storage_get_num_bt_bond_devices
|
||||
**
|
||||
** Description BTC storage API - get the num of the bonded device from NVRAM
|
||||
**
|
||||
** Returns the num of the bonded device
|
||||
**
|
||||
*******************************************************************************/
|
||||
int btc_storage_get_num_bt_bond_devices(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_storage_get_bonded_bt_devices_list
|
||||
**
|
||||
** Description BTC storage API - get the list of the bonded device from NVRAM
|
||||
**
|
||||
** Returns BT_STATUS_SUCCESS if get the list successful,
|
||||
** BT_STATUS_FAIL otherwise
|
||||
**
|
||||
*******************************************************************************/
|
||||
bt_status_t btc_storage_get_bonded_bt_devices_list(bt_bdaddr_t *bond_dev, int dev_num);
|
||||
|
||||
#endif /* BTC_STORAGE_H */
|
@ -16,9 +16,9 @@
|
||||
#define __BTC_TASK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "bt_target.h"
|
||||
#include "bt_defs.h"
|
||||
#include "thread.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "osi/thread.h"
|
||||
|
||||
typedef struct btc_msg {
|
||||
uint8_t sig; //event signal
|
||||
@ -54,6 +54,9 @@ typedef enum {
|
||||
BTC_PID_A2DP,
|
||||
BTC_PID_AVRC,
|
||||
BTC_PID_SPP,
|
||||
#if BTC_HF_CLIENT_INCLUDED
|
||||
BTC_PID_HF_CLIENT,
|
||||
#endif /* BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* CONFIG_CLASSIC_BT_ENABLED */
|
||||
BTC_PID_NUM,
|
||||
} btc_pid_t; //btc profile id
|
@ -16,8 +16,8 @@
|
||||
#define __BTC_UTIL_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_types.h"
|
||||
#include "bt_defs.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
/*******************************************************************************
|
||||
@ -44,4 +44,7 @@ void uuid128_be_to_esp_uuid(esp_bt_uuid_t *u, uint8_t* uuid128);
|
||||
|
||||
void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
|
||||
|
||||
esp_bt_status_t btc_hci_to_esp_status(uint8_t hci_status);
|
||||
esp_bt_status_t btc_btm_status_to_esp_status (uint8_t btm_status);
|
||||
|
||||
#endif /* __BTC_UTIL_H__ */
|
@ -24,8 +24,8 @@
|
||||
#define __BTC_A2DP_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#define __BTC_A2DP_CONTROL_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#define __BTC_A2DP_SINK_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
|
@ -22,8 +22,8 @@
|
||||
#define __BTC_A2DP_SOURCE_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "bt_target.h"
|
||||
#include "bta_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc_av_api.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
|
||||
|
@ -25,12 +25,12 @@
|
||||
#ifndef __BTC_AV_H__
|
||||
#define __BTC_AV_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "esp_a2dp_api.h"
|
||||
#include "btc_task.h"
|
||||
#include "btc_common.h"
|
||||
#include "btc_sm.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "btc/btc_common.h"
|
||||
#include "btc/btc_sm.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
@ -203,6 +203,18 @@ BOOLEAN btc_av_is_peer_edr(void);
|
||||
********************************************************************************/
|
||||
void btc_av_clear_remote_suspend_flag(void);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Function btc_av_get_service_id
|
||||
*
|
||||
* Description Get the current AV service ID.
|
||||
*
|
||||
* Returns The stream endpoint type: either BTA_A2DP_SOURCE_SERVICE_ID or
|
||||
* BTA_A2DP_SINK_SERVICE_ID.
|
||||
*
|
||||
******************************************************************************/
|
||||
uint8_t btc_av_get_service_id(void);
|
||||
|
||||
#endif ///BTC_AV_INCLUDED == TRUE
|
||||
|
||||
#endif /* __BTC_AV_H__ */
|
||||
|
@ -25,10 +25,10 @@
|
||||
#ifndef __BTC_AV_API_H__
|
||||
#define __BTC_AV_API_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "a2d_api.h"
|
||||
#include "a2d_sbc.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
#include "stack/a2d_api.h"
|
||||
#include "stack/a2d_sbc.h"
|
||||
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "bt_defs.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_av_api.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_av_api.h"
|
||||
|
||||
#if (BTC_AV_INCLUDED == TRUE)
|
||||
#ifndef BTC_AVRC_TGT_INCLUDED
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef __BTC_BLUFI_PRF_H__
|
||||
#define __BTC_BLUFI_PRF_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "btc_task.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_blufi_api.h"
|
||||
|
||||
typedef enum {
|
||||
|
@ -31,6 +31,7 @@ typedef enum {
|
||||
BTC_GAP_BLE_ACT_SET_PKT_DATA_LEN,
|
||||
BTC_GAP_BLE_ACT_SET_RAND_ADDRESS,
|
||||
BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
||||
BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON,
|
||||
BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST,
|
||||
BTC_GAP_BLE_ACT_SET_CONN_PARAMS,
|
||||
BTC_GAP_BLE_ACT_SET_DEV_NAME,
|
||||
@ -83,6 +84,10 @@ typedef union {
|
||||
struct cfg_local_privacy_args {
|
||||
bool privacy_enable;
|
||||
} cfg_local_privacy;
|
||||
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_ICON,
|
||||
struct cfg_local_icon_args {
|
||||
uint16_t icon;
|
||||
} cfg_local_icon;
|
||||
//BTC_GAP_BLE_ACT_UPDATE_WHITE_LIST
|
||||
struct update_white_list_args {
|
||||
bool add_remove;
|
||||
|
@ -15,23 +15,30 @@
|
||||
#ifndef __BTC_GAP_BT_H__
|
||||
#define __BTC_GAP_BT_H__
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "bta/utl.h"
|
||||
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
typedef enum {
|
||||
BTC_GAP_BT_SEARCH_DEVICES_EVT = 0,
|
||||
BTC_GAP_BT_SEARCH_SERVICES_EVT,
|
||||
BTC_GAP_BT_SEARCH_SERVICE_RECORD_EVT,
|
||||
BTC_GAP_BT_READ_RSSI_DELTA_EVT,
|
||||
BTC_GAP_BT_AUTH_CMPL_EVT,
|
||||
}btc_gap_bt_evt_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_GAP_BT_ACT_SET_SCAN_MODE = 0,
|
||||
BTC_GAP_BT_ACT_REG_CB,
|
||||
BTC_GAP_BT_ACT_START_DISCOVERY,
|
||||
BTC_GAP_BT_ACT_SEARCH_DEVICES,
|
||||
BTC_GAP_BT_ACT_CANCEL_DISCOVERY,
|
||||
BTC_GAP_BT_ACT_GET_REMOTE_SERVICES,
|
||||
BTC_GAP_BT_ACT_SEARCH_SERVICES,
|
||||
BTC_GAP_BT_ACT_GET_REMOTE_SERVICE_RECORD,
|
||||
BTC_GAP_BT_ACT_SEARCH_SERVICE_RECORD,
|
||||
BTC_GAP_BT_ACT_SET_COD,
|
||||
BTC_GAP_BT_ACT_READ_RSSI_DELTA,
|
||||
BTC_GAP_BT_ACT_REMOVE_BOND_DEVICE,
|
||||
} btc_gap_bt_act_t;
|
||||
|
||||
/* btc_bt_gap_args_t */
|
||||
@ -48,20 +55,38 @@ typedef union {
|
||||
uint8_t num_rsps;
|
||||
} start_disc;
|
||||
|
||||
// BTC_BT_GAP_ACT_GET_REMOTE_SERVICES
|
||||
// BTC_GAP_BT_ACT_GET_REMOTE_SERVICES
|
||||
bt_bdaddr_t bda;
|
||||
|
||||
// BTC_BT_GAP_ACT_GET_REMTOE_SERVICE_RECORD
|
||||
// BTC_GAP_BT_ACT_GET_REMOTE_SERVICE_RECORD
|
||||
struct get_rmt_srv_rcd_args {
|
||||
bt_bdaddr_t bda;
|
||||
esp_bt_uuid_t uuid;
|
||||
} get_rmt_srv_rcd;
|
||||
|
||||
// BTC_GAP_BT_ACT_SET_COD
|
||||
struct set_cod_args {
|
||||
esp_bt_cod_t cod;
|
||||
esp_bt_cod_mode_t mode;
|
||||
} set_cod;
|
||||
|
||||
//BTC_GAP_BT_ACT_READ_RSSI_DELTA,
|
||||
struct bt_read_rssi_delta_args {
|
||||
bt_bdaddr_t bda;
|
||||
} read_rssi_delta;
|
||||
|
||||
// BTC_GAP_BT_ACT_REMOVE_BOND_DEVICE
|
||||
struct rm_bond_device_args {
|
||||
bt_bdaddr_t bda;
|
||||
} rm_bond_device;
|
||||
} btc_gap_bt_args_t;
|
||||
|
||||
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
||||
void btc_gap_bt_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_gap_bt_busy_level_updated(uint8_t bl_flags);
|
||||
|
||||
esp_err_t btc_gap_bt_get_cod(esp_bt_cod_t *cod);
|
||||
#endif /* #if BTC_GAP_BT_INCLUDED */
|
||||
|
||||
#endif /* __BTC_GAP_BT_H__ */
|
||||
|
@ -15,11 +15,11 @@
|
||||
#ifndef __BTC_GATT_COMMON_H__
|
||||
#define __BTC_GATT_COMMON_H__
|
||||
|
||||
#include "future.h"
|
||||
#include "bt_types.h"
|
||||
#include "bta_api.h"
|
||||
#include "btc_main.h"
|
||||
#include "btc_task.h"
|
||||
#include "osi/future.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_main.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
||||
typedef enum {
|
||||
BTC_GATT_ACT_SET_LOCAL_MTU = 0,
|
||||
|
@ -15,8 +15,8 @@
|
||||
#ifndef __BTC_GATT_UTIL_H__
|
||||
#define __BTC_GATT_UTIL_H__
|
||||
|
||||
#include "bt_types.h"
|
||||
#include "bta_gatt_api.h"
|
||||
#include "stack/bt_types.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
#include "esp_gattc_api.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef __BTC_GATTC_H__
|
||||
#define __BTC_GATTC_H__
|
||||
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
#include "esp_gattc_api.h"
|
||||
@ -38,6 +38,8 @@ typedef enum {
|
||||
BTC_GATTC_ACT_REG_FOR_NOTIFY,
|
||||
BTC_GATTC_ACT_UNREG_FOR_NOTIFY,
|
||||
BTC_GATTC_ACT_CACHE_REFRESH,
|
||||
BTC_GATTC_ACT_CACHE_ASSOC,
|
||||
BTC_GATTC_ATC_CACHE_GET_ADDR_LIST,
|
||||
} btc_gattc_act_t;
|
||||
|
||||
/* btc_ble_gattc_args_t */
|
||||
@ -167,6 +169,17 @@ typedef union {
|
||||
struct cache_refresh_arg {
|
||||
esp_bd_addr_t remote_bda;
|
||||
} cache_refresh;
|
||||
//BTC_GATTC_ACT_CACHE_ASSOC
|
||||
struct cache_assoc_arg {
|
||||
esp_gatt_if_t gattc_if;
|
||||
esp_bd_addr_t src_addr;
|
||||
esp_bd_addr_t assoc_addr;
|
||||
bool is_assoc;
|
||||
} cache_assoc;
|
||||
//BTC_GATTC_ATC_CACHE_GET_ADDR_LIST
|
||||
struct cache_get_addr_list_arg {
|
||||
esp_gatt_if_t gattc_if;
|
||||
}get_addr_list;
|
||||
} btc_ble_gattc_args_t;
|
||||
|
||||
void btc_gattc_call_handler(btc_msg_t *msg);
|
||||
|
@ -15,7 +15,7 @@
|
||||
#ifndef __BTC_GATTS_H__
|
||||
#define __BTC_GATTS_H__
|
||||
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
#include "esp_gatts_api.h"
|
||||
|
128
tools/sdk/include/bluedroid/btc_hf_client.h
Normal file
128
tools/sdk/include/bluedroid/btc_hf_client.h
Normal file
@ -0,0 +1,128 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Filename: btc_hf_client.h
|
||||
*
|
||||
* Description: Main API header file for all BTC HF client functions accessed
|
||||
* from internal stack.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef __BTC_HF_CLIENT_H__
|
||||
#define __BTC_HF_CLIENT_H__
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "esp_hf_client_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "btc/btc_common.h"
|
||||
#include "bta/bta_hf_client_api.h"
|
||||
|
||||
#if (BTC_HF_CLIENT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
** Type definitions for callback functions
|
||||
********************************************************************************/
|
||||
typedef enum {
|
||||
BTC_HF_CLIENT_INIT_EVT,
|
||||
BTC_HF_CLIENT_DEINIT_EVT,
|
||||
BTC_HF_CLIENT_CONNECT_EVT,
|
||||
BTC_HF_CLIENT_DISCONNECT_EVT,
|
||||
BTC_HF_CLIENT_CONNECT_AUDIO_EVT,
|
||||
BTC_HF_CLIENT_DISCONNECT_AUDIO_EVT,
|
||||
BTC_HF_CLIENT_START_VOICE_RECOGNITION_EVT,
|
||||
BTC_HF_CLIENT_STOP_VOICE_RECOGNITION_EVT,
|
||||
BTC_HF_CLIENT_VOLUME_UPDATE_EVT,
|
||||
BTC_HF_CLIENT_DIAL_EVT,
|
||||
BTC_HF_CLIENT_DIAL_MEMORY_EVT,
|
||||
BTC_HF_CLIENT_SEND_CHLD_CMD_EVT,
|
||||
BTC_HF_CLIENT_SEND_BTRH_CMD_EVT,
|
||||
BTC_HF_CLIENT_ANSWER_CALL_EVT,
|
||||
BTC_HF_CLIENT_REJECT_CALL_EVT,
|
||||
BTC_HF_CLIENT_QUERY_CURRENT_CALLS_EVT,
|
||||
BTC_HF_CLIENT_QUERY_CURRENT_OPERATOR_NAME_EVT,
|
||||
BTC_HF_CLIENT_RETRIEVE_SUBSCRIBER_INFO_EVT,
|
||||
BTC_HF_CLIENT_SEND_DTMF_EVT,
|
||||
BTC_HF_CLIENT_REQUEST_LAST_VOICE_TAG_NUMBER_EVT,
|
||||
BTC_HF_CLIENT_REGISTER_DATA_CALLBACK_EVT,
|
||||
} btc_hf_client_act_t;
|
||||
|
||||
/* btc_hf_client_args_t */
|
||||
typedef union {
|
||||
// BTC_HF_CLIENT_CONNECT_EVT
|
||||
bt_bdaddr_t connect;
|
||||
|
||||
// BTC_HF_CLIENT_DISCONNECT_EVT
|
||||
bt_bdaddr_t disconnect;
|
||||
|
||||
// BTC_HF_CLIENT_CONNECT_AUDIO_EVT
|
||||
bt_bdaddr_t connect_audio;
|
||||
|
||||
// BTC_HF_CLIENT_DISCONNECT_AUDIO_EVT
|
||||
bt_bdaddr_t disconnect_audio;
|
||||
|
||||
// BTC_HF_CLIENT_VOLUME_UPDATE_EVT,
|
||||
struct volume_update_args {
|
||||
esp_hf_volume_control_target_t type;
|
||||
int volume;
|
||||
} volume_update;
|
||||
|
||||
// BTC_HF_CLIENT_DIAL_EVT
|
||||
struct dial_args {
|
||||
char number[ESP_BT_HF_CLIENT_NUMBER_LEN + 1];
|
||||
} dial;
|
||||
|
||||
// BTC_HF_CLIENT_DIAL_MEMORY_EVT
|
||||
struct dial_memory_args {
|
||||
int location;
|
||||
} dial_memory;
|
||||
|
||||
// BTC_HF_CLIENT_SEND_CHLD_CMD_EVT
|
||||
struct send_chld_cmd_args {
|
||||
esp_hf_chld_type_t type;
|
||||
int idx;
|
||||
} chld;
|
||||
|
||||
// BTC_HF_CLIENT_SEND_BTRH_CMD_EVT
|
||||
struct send_btrh_cmd_args {
|
||||
esp_hf_btrh_cmd_t cmd;
|
||||
} btrh;
|
||||
|
||||
// BTC_HF_CLIENT_SEND_DTMF_EVT
|
||||
struct send_dtmf {
|
||||
char code;
|
||||
} send_dtmf;
|
||||
|
||||
// BTC_HF_CLIENT_REGISTER_DATA_CALLBACK_EVT
|
||||
struct reg_data_callback {
|
||||
esp_hf_client_incoming_data_cb_t recv;
|
||||
esp_hf_client_outgoing_data_cb_t send;
|
||||
} reg_data_cb;
|
||||
} btc_hf_client_args_t;
|
||||
|
||||
/*******************************************************************************
|
||||
** BTC HF AG API
|
||||
********************************************************************************/
|
||||
|
||||
void btc_hf_client_call_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_hf_client_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void btc_hf_client_incoming_data_cb_to_app(const uint8_t *data, uint32_t len);
|
||||
|
||||
uint32_t btc_hf_client_outgoing_data_cb_to_app(uint8_t *data, uint32_t len);
|
||||
#endif ///BTC_HF_CLIENT_INCLUDED == TRUE
|
||||
|
||||
#endif /* __BTC_HF_CLIENT_H__ */
|
@ -15,17 +15,19 @@
|
||||
#ifndef __BTC_SPP_H__
|
||||
#define __BTC_SPP_H__
|
||||
|
||||
#include "btc_task.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_spp_api.h"
|
||||
#include "bt_target.h"
|
||||
#include "bta_jv_api.h"
|
||||
#include "common/bt_target.h"
|
||||
#include "bta/bta_jv_api.h"
|
||||
|
||||
#if (defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE)
|
||||
|
||||
#define ESP_SPP_MAX_SESSION BTA_JV_MAX_RFC_SR_SESSION
|
||||
#define ESP_SPP_SERVER_NAME_MAX 32
|
||||
|
||||
#define ESP_SPP_RINGBUF_SIZE 1000
|
||||
|
||||
typedef enum {
|
||||
BTC_SPP_ACT_INIT = 0,
|
||||
BTC_SPP_ACT_UNINIT,
|
||||
@ -40,6 +42,7 @@ typedef enum {
|
||||
typedef union {
|
||||
//BTC_SPP_ACT_INIT
|
||||
struct init_arg {
|
||||
esp_spp_mode_t mode;
|
||||
} init;
|
||||
//BTC_SPP_ACT_UNINIT
|
||||
struct uninit_arg {
|
||||
@ -84,6 +87,6 @@ void btc_spp_call_handler(btc_msg_t *msg);
|
||||
void btc_spp_cb_handler(btc_msg_t *msg);
|
||||
void btc_spp_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
|
||||
esp_err_t btc_spp_vfs_register(void);
|
||||
#endif ///defined BTC_SPP_INCLUDED && BTC_SPP_INCLUDED == TRUE
|
||||
#endif ///__BTC_SPP_H__
|
||||
#endif ///__BTC_SPP_H__
|
||||
|
@ -1,497 +0,0 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 Manager (BTM) internal
|
||||
* definitions.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BTM_BLE_INT_H
|
||||
#define BTM_BLE_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "fixed_queue.h"
|
||||
#include "hcidefs.h"
|
||||
#include "btm_ble_api.h"
|
||||
#include "btm_int.h"
|
||||
|
||||
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
#include "smp_api.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* scanning enable status */
|
||||
#define BTM_BLE_SCAN_ENABLE 0x01
|
||||
#define BTM_BLE_SCAN_DISABLE 0x00
|
||||
|
||||
/* advertising enable status */
|
||||
#define BTM_BLE_ADV_ENABLE 0x01
|
||||
#define BTM_BLE_ADV_DISABLE 0x00
|
||||
|
||||
/* use the high 4 bits unused by inquiry mode */
|
||||
#define BTM_BLE_SELECT_SCAN 0x20
|
||||
#define BTM_BLE_NAME_REQUEST 0x40
|
||||
#define BTM_BLE_OBSERVE 0x80
|
||||
|
||||
#define BTM_BLE_MAX_WL_ENTRY 1
|
||||
#define BTM_BLE_AD_DATA_LEN 31
|
||||
|
||||
#define BTM_BLE_ENC_MASK 0x03
|
||||
|
||||
#define BTM_BLE_DUPLICATE_ENABLE 1
|
||||
#define BTM_BLE_DUPLICATE_DISABLE 0
|
||||
|
||||
#define BTM_BLE_GAP_DISC_SCAN_INT 18 /* Interval(scan_int) = 11.25 ms= 0x0010 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_DISC_SCAN_WIN 18 /* scan_window = 11.25 ms= 0x0010 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_ADV_INT 512 /* Tgap(gen_disc) = 1.28 s= 512 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_LIM_TOUT 180 /* Tgap(lim_timeout) = 180s max */
|
||||
#define BTM_BLE_LOW_LATENCY_SCAN_INT 8000 /* Interval(scan_int) = 5s= 8000 * 0.625 ms */
|
||||
#define BTM_BLE_LOW_LATENCY_SCAN_WIN 8000 /* scan_window = 5s= 8000 * 0.625 ms */
|
||||
|
||||
|
||||
#define BTM_BLE_GAP_ADV_FAST_INT_1 48 /* TGAP(adv_fast_interval1) = 30(used) ~ 60 ms = 48 *0.625 */
|
||||
#define BTM_BLE_GAP_ADV_FAST_INT_2 160 /* TGAP(adv_fast_interval2) = 100(used) ~ 150 ms = 160 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_ADV_SLOW_INT 2048 /* Tgap(adv_slow_interval) = 1.28 s= 512 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_ADV_DIR_MAX_INT 800 /* Tgap(dir_conn_adv_int_max) = 500 ms = 800 * 0.625 ms */
|
||||
#define BTM_BLE_GAP_ADV_DIR_MIN_INT 400 /* Tgap(dir_conn_adv_int_min) = 250 ms = 400 * 0.625 ms */
|
||||
|
||||
#define BTM_BLE_GAP_FAST_ADV_TOUT 30
|
||||
|
||||
#define BTM_BLE_SEC_REQ_ACT_NONE 0
|
||||
#define BTM_BLE_SEC_REQ_ACT_ENCRYPT 1 /* encrypt the link using current key or key refresh */
|
||||
#define BTM_BLE_SEC_REQ_ACT_PAIR 2
|
||||
#define BTM_BLE_SEC_REQ_ACT_DISCARD 3 /* discard the sec request while encryption is started but not completed */
|
||||
typedef UINT8 tBTM_BLE_SEC_REQ_ACT;
|
||||
|
||||
#define BLE_STATIC_PRIVATE_MSB_MASK 0x3f
|
||||
#define BLE_RESOLVE_ADDR_MSB 0x40 /* most significant bit, bit7, bit6 is 01 to be resolvable random */
|
||||
#define BLE_RESOLVE_ADDR_MASK 0xc0 /* bit 6, and bit7 */
|
||||
#define BTM_BLE_IS_RESOLVE_BDA(x) ((x[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB)
|
||||
|
||||
/* LE scan activity bit mask, continue with LE inquiry bits */
|
||||
#define BTM_LE_SELECT_CONN_ACTIVE 0x0040 /* selection connection is in progress */
|
||||
#define BTM_LE_OBSERVE_ACTIVE 0x0080 /* observe is in progress */
|
||||
#define BTM_LE_DISCOVER_ACTIVE 0x0100 /* scan is in progress */
|
||||
|
||||
/* BLE scan activity mask checking */
|
||||
#define BTM_BLE_IS_SCAN_ACTIVE(x) ((x) & BTM_BLE_SCAN_ACTIVE_MASK)
|
||||
#define BTM_BLE_IS_INQ_ACTIVE(x) ((x) & BTM_BLE_INQUIRY_MASK)
|
||||
#define BTM_BLE_IS_OBS_ACTIVE(x) ((x) & BTM_LE_OBSERVE_ACTIVE)
|
||||
#define BTM_BLE_IS_DISCO_ACTIVE(x) ((x) & BTM_LE_DISCOVER_ACTIVE)
|
||||
#define BTM_BLE_IS_SEL_CONN_ACTIVE(x) ((x) & BTM_LE_SELECT_CONN_ACTIVE)
|
||||
|
||||
/* BLE ADDR type ID bit */
|
||||
#define BLE_ADDR_TYPE_ID_BIT 0x02
|
||||
|
||||
#define BTM_VSC_CHIP_CAPABILITY_L_VERSION 55
|
||||
#define BTM_VSC_CHIP_CAPABILITY_M_VERSION 95
|
||||
|
||||
typedef enum {
|
||||
BTM_BLE_IDLE,
|
||||
BTM_BLE_SCANNING,
|
||||
BTM_BLE_SCAN_PENDING,
|
||||
BTM_BLE_STOP_SCAN,
|
||||
BTM_BLE_ADVERTISING,
|
||||
BTM_BLE_ADV_PENDING,
|
||||
BTM_BLE_STOP_ADV,
|
||||
}tBTM_BLE_GAP_STATE;
|
||||
|
||||
typedef struct {
|
||||
UINT16 data_mask;
|
||||
UINT8 *p_flags;
|
||||
UINT8 ad_data[BTM_BLE_AD_DATA_LEN];
|
||||
UINT8 *p_pad;
|
||||
} tBTM_BLE_LOCAL_ADV_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT32 inq_count; /* Used for determining if a response has already been */
|
||||
/* received for the current inquiry operation. (We do not */
|
||||
/* want to flood the caller with multiple responses from */
|
||||
/* the same device. */
|
||||
BOOLEAN scan_rsp;
|
||||
tBLE_BD_ADDR le_bda;
|
||||
} tINQ_LE_BDADDR;
|
||||
|
||||
#define BTM_BLE_ADV_DATA_LEN_MAX 31
|
||||
#define BTM_BLE_CACHE_ADV_DATA_MAX 62
|
||||
|
||||
#define BTM_BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) || ((x) == BTM_BLE_CONN_PARAM_UNDEF))
|
||||
|
||||
#define BTM_BLE_PRIVATE_ADDR_INT 900 /* 15 minutes minimum for random address refreshing */
|
||||
|
||||
typedef struct {
|
||||
UINT16 discoverable_mode;
|
||||
UINT16 connectable_mode;
|
||||
BOOLEAN scan_params_set;
|
||||
UINT32 scan_window;
|
||||
UINT32 scan_interval;
|
||||
UINT8 scan_type; /* current scan type: active or passive */
|
||||
UINT8 scan_duplicate_filter; /* duplicate filter enabled for scan */
|
||||
UINT16 adv_interval_min;
|
||||
UINT16 adv_interval_max;
|
||||
tBTM_BLE_AFP afp; /* advertising filter policy */
|
||||
tBTM_BLE_SFP sfp; /* scanning filter policy */
|
||||
tBTM_START_ADV_CMPL_CBACK *p_adv_cb;
|
||||
tBTM_START_STOP_ADV_CMPL_CBACK *p_stop_adv_cb;
|
||||
tBLE_ADDR_TYPE adv_addr_type;
|
||||
BOOLEAN adv_callback_twice;
|
||||
UINT8 evt_type;
|
||||
UINT8 adv_mode;
|
||||
tBLE_BD_ADDR direct_bda;
|
||||
tBTM_BLE_EVT directed_conn;
|
||||
BOOLEAN fast_adv_on;
|
||||
TIMER_LIST_ENT fast_adv_timer;
|
||||
|
||||
UINT8 adv_len;
|
||||
UINT8 adv_data_cache[BTM_BLE_CACHE_ADV_DATA_MAX];
|
||||
|
||||
/* inquiry BD addr database */
|
||||
UINT8 num_bd_entries;
|
||||
UINT8 max_bd_entries;
|
||||
tBTM_BLE_LOCAL_ADV_DATA adv_data;
|
||||
tBTM_BLE_ADV_CHNL_MAP adv_chnl_map;
|
||||
|
||||
TIMER_LIST_ENT inq_timer_ent;
|
||||
BOOLEAN scan_rsp;
|
||||
tBTM_BLE_GAP_STATE state; /* Current state that the inquiry process is in */
|
||||
INT8 tx_power;
|
||||
} tBTM_BLE_INQ_CB;
|
||||
|
||||
|
||||
/* random address resolving complete callback */
|
||||
typedef void (tBTM_BLE_RESOLVE_CBACK) (void *match_rec, void *p);
|
||||
|
||||
typedef void (tBTM_BLE_ADDR_CBACK) (BD_ADDR_PTR static_random, void *p);
|
||||
|
||||
/* random address management control block */
|
||||
typedef struct {
|
||||
tBLE_ADDR_TYPE own_addr_type; /* local device LE address type */
|
||||
BD_ADDR private_addr;
|
||||
BD_ADDR random_bda;
|
||||
BOOLEAN busy;
|
||||
UINT16 index;
|
||||
tBTM_BLE_RESOLVE_CBACK *p_resolve_cback;
|
||||
tBTM_BLE_ADDR_CBACK *p_generate_cback;
|
||||
void *p;
|
||||
TIMER_LIST_ENT raddr_timer_ent;
|
||||
tBTM_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback;
|
||||
} tBTM_LE_RANDOM_CB;
|
||||
|
||||
#define BTM_BLE_MAX_BG_CONN_DEV_NUM 10
|
||||
|
||||
typedef struct {
|
||||
UINT16 min_conn_int;
|
||||
UINT16 max_conn_int;
|
||||
UINT16 slave_latency;
|
||||
UINT16 supervision_tout;
|
||||
|
||||
} tBTM_LE_CONN_PRAMS;
|
||||
|
||||
|
||||
typedef struct {
|
||||
BD_ADDR bd_addr;
|
||||
UINT8 attr;
|
||||
BOOLEAN is_connected;
|
||||
BOOLEAN in_use;
|
||||
} tBTM_LE_BG_CONN_DEV;
|
||||
|
||||
/* white list using state as a bit mask */
|
||||
#define BTM_BLE_WL_IDLE 0
|
||||
#define BTM_BLE_WL_INIT 1
|
||||
#define BTM_BLE_WL_SCAN 2
|
||||
#define BTM_BLE_WL_ADV 4
|
||||
typedef UINT8 tBTM_BLE_WL_STATE;
|
||||
|
||||
/* resolving list using state as a bit mask */
|
||||
#define BTM_BLE_RL_IDLE 0
|
||||
#define BTM_BLE_RL_INIT 1
|
||||
#define BTM_BLE_RL_SCAN 2
|
||||
#define BTM_BLE_RL_ADV 4
|
||||
typedef UINT8 tBTM_BLE_RL_STATE;
|
||||
|
||||
/* BLE connection state */
|
||||
#define BLE_CONN_IDLE 0
|
||||
#define BLE_DIR_CONN 1
|
||||
#define BLE_BG_CONN 2
|
||||
#define BLE_CONN_CANCEL 3
|
||||
typedef UINT8 tBTM_BLE_CONN_ST;
|
||||
|
||||
typedef struct {
|
||||
void *p_param;
|
||||
} tBTM_BLE_CONN_REQ;
|
||||
|
||||
/* LE state request */
|
||||
#define BTM_BLE_STATE_INVALID 0
|
||||
#define BTM_BLE_STATE_CONN_ADV 1
|
||||
#define BTM_BLE_STATE_INIT 2
|
||||
#define BTM_BLE_STATE_MASTER 3
|
||||
#define BTM_BLE_STATE_SLAVE 4
|
||||
#define BTM_BLE_STATE_LO_DUTY_DIR_ADV 5
|
||||
#define BTM_BLE_STATE_HI_DUTY_DIR_ADV 6
|
||||
#define BTM_BLE_STATE_NON_CONN_ADV 7
|
||||
#define BTM_BLE_STATE_PASSIVE_SCAN 8
|
||||
#define BTM_BLE_STATE_ACTIVE_SCAN 9
|
||||
#define BTM_BLE_STATE_SCAN_ADV 10
|
||||
#define BTM_BLE_STATE_MAX 11
|
||||
typedef UINT8 tBTM_BLE_STATE;
|
||||
|
||||
#define BTM_BLE_STATE_CONN_ADV_BIT 0x0001
|
||||
#define BTM_BLE_STATE_INIT_BIT 0x0002
|
||||
#define BTM_BLE_STATE_MASTER_BIT 0x0004
|
||||
#define BTM_BLE_STATE_SLAVE_BIT 0x0008
|
||||
#define BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT 0x0010
|
||||
#define BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT 0x0020
|
||||
#define BTM_BLE_STATE_NON_CONN_ADV_BIT 0x0040
|
||||
#define BTM_BLE_STATE_PASSIVE_SCAN_BIT 0x0080
|
||||
#define BTM_BLE_STATE_ACTIVE_SCAN_BIT 0x0100
|
||||
#define BTM_BLE_STATE_SCAN_ADV_BIT 0x0200
|
||||
typedef UINT16 tBTM_BLE_STATE_MASK;
|
||||
|
||||
#define BTM_BLE_STATE_ALL_MASK 0x03ff
|
||||
#define BTM_BLE_STATE_ALL_ADV_MASK (BTM_BLE_STATE_CONN_ADV_BIT|BTM_BLE_STATE_LO_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_HI_DUTY_DIR_ADV_BIT|BTM_BLE_STATE_SCAN_ADV_BIT)
|
||||
#define BTM_BLE_STATE_ALL_SCAN_MASK (BTM_BLE_STATE_PASSIVE_SCAN_BIT|BTM_BLE_STATE_ACTIVE_SCAN_BIT)
|
||||
#define BTM_BLE_STATE_ALL_CONN_MASK (BTM_BLE_STATE_MASTER_BIT|BTM_BLE_STATE_SLAVE_BIT)
|
||||
|
||||
#ifndef BTM_LE_RESOLVING_LIST_MAX
|
||||
#define BTM_LE_RESOLVING_LIST_MAX 0x20
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
BD_ADDR *resolve_q_random_pseudo;
|
||||
UINT8 *resolve_q_action;
|
||||
UINT8 q_next;
|
||||
UINT8 q_pending;
|
||||
} tBTM_BLE_RESOLVE_Q;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN in_use;
|
||||
BOOLEAN to_add;
|
||||
BD_ADDR bd_addr;
|
||||
UINT8 attr;
|
||||
} tBTM_BLE_WL_OP;
|
||||
|
||||
/* BLE privacy mode */
|
||||
#define BTM_PRIVACY_NONE 0 /* BLE no privacy */
|
||||
#define BTM_PRIVACY_1_1 1 /* BLE privacy 1.1, do not support privacy 1.0 */
|
||||
#define BTM_PRIVACY_1_2 2 /* BLE privacy 1.2 */
|
||||
#define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom propietary mode */
|
||||
typedef UINT8 tBTM_PRIVACY_MODE;
|
||||
|
||||
/* data length change event callback */
|
||||
typedef void (tBTM_DATA_LENGTH_CHANGE_CBACK) (UINT16 max_tx_length, UINT16 max_rx_length);
|
||||
|
||||
/* Define BLE Device Management control structure
|
||||
*/
|
||||
typedef struct {
|
||||
UINT16 scan_activity; /* LE scan activity mask */
|
||||
|
||||
/*****************************************************
|
||||
** BLE Inquiry
|
||||
*****************************************************/
|
||||
tBTM_BLE_INQ_CB inq_var;
|
||||
|
||||
/* observer callback and timer */
|
||||
tBTM_INQ_RESULTS_CB *p_obs_results_cb;
|
||||
tBTM_CMPL_CB *p_obs_cmpl_cb;
|
||||
TIMER_LIST_ENT obs_timer_ent;
|
||||
|
||||
/* scan callback and timer */
|
||||
tBTM_INQ_RESULTS_CB *p_scan_results_cb;
|
||||
tBTM_CMPL_CB *p_scan_cmpl_cb;
|
||||
TIMER_LIST_ENT scan_timer_ent;
|
||||
|
||||
/* background connection procedure cb value */
|
||||
tBTM_BLE_CONN_TYPE bg_conn_type;
|
||||
UINT32 scan_int;
|
||||
UINT32 scan_win;
|
||||
tBTM_BLE_SEL_CBACK *p_select_cback;
|
||||
/* white list information */
|
||||
UINT8 white_list_avail_size;
|
||||
tBTM_ADD_WHITELIST_CBACK *add_wl_cb;
|
||||
tBTM_BLE_WL_STATE wl_state;
|
||||
|
||||
fixed_queue_t *conn_pending_q;
|
||||
tBTM_BLE_CONN_ST conn_state;
|
||||
|
||||
/* random address management control block */
|
||||
tBTM_LE_RANDOM_CB addr_mgnt_cb;
|
||||
|
||||
BOOLEAN enabled;
|
||||
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
BOOLEAN mixed_mode; /* privacy 1.2 mixed mode is on or not */
|
||||
tBTM_PRIVACY_MODE privacy_mode; /* privacy mode */
|
||||
UINT8 resolving_list_avail_size; /* resolving list available size */
|
||||
tBTM_BLE_RESOLVE_Q resolving_list_pend_q; /* Resolving list queue */
|
||||
tBTM_BLE_RL_STATE suspended_rl_state; /* Suspended resolving list state */
|
||||
UINT8 *irk_list_mask; /* IRK list availability mask, up to max entry bits */
|
||||
tBTM_BLE_RL_STATE rl_state; /* Resolving list state */
|
||||
#endif
|
||||
|
||||
tBTM_BLE_WL_OP wl_op_q[BTM_BLE_MAX_BG_CONN_DEV_NUM];
|
||||
|
||||
/* current BLE link state */
|
||||
tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
|
||||
UINT8 link_count[2]; /* total link count master and slave*/
|
||||
} tBTM_BLE_CB;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void btm_ble_timeout(TIMER_LIST_ENT *p_tle);
|
||||
void btm_ble_process_adv_pkt (UINT8 *p);
|
||||
void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
|
||||
tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
|
||||
BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
|
||||
|
||||
tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode);
|
||||
tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode);
|
||||
tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8 duration);
|
||||
void btm_ble_stop_scan(void);
|
||||
void btm_clear_all_pending_le_entry(void);
|
||||
|
||||
BOOLEAN btm_ble_send_extended_scan_params(UINT8 scan_type, UINT32 scan_int,
|
||||
UINT32 scan_win, UINT8 addr_type_own,
|
||||
UINT8 scan_filter_policy);
|
||||
void btm_ble_stop_inquiry(void);
|
||||
void btm_ble_init (void);
|
||||
void btm_ble_free (void);
|
||||
void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
|
||||
void btm_ble_read_remote_features_complete(UINT8 *p);
|
||||
void btm_ble_write_adv_enable_complete(UINT8 *p);
|
||||
void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced);
|
||||
void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
|
||||
tBTM_BLE_CONN_ST btm_ble_get_conn_st(void);
|
||||
void btm_ble_set_conn_st(tBTM_BLE_CONN_ST new_st);
|
||||
UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
|
||||
tBTM_BLE_ADV_DATA *p_data);
|
||||
tBTM_STATUS btm_ble_start_adv(void);
|
||||
tBTM_STATUS btm_ble_stop_adv(void);
|
||||
tBTM_STATUS btm_ble_start_scan(void);
|
||||
void btm_ble_create_ll_conn_complete (UINT8 status);
|
||||
|
||||
/* LE security function from btm_sec.c */
|
||||
#if SMP_INCLUDED == TRUE
|
||||
void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act);
|
||||
void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk);
|
||||
UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data);
|
||||
tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 link_role);
|
||||
void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv);
|
||||
tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk);
|
||||
void btm_ble_link_encrypted(BD_ADDR bd_addr, UINT8 encr_enable);
|
||||
#endif
|
||||
|
||||
/* LE device management functions */
|
||||
void btm_ble_reset_id( void );
|
||||
|
||||
/* security related functions */
|
||||
void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local );
|
||||
BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div);
|
||||
BOOLEAN btm_ble_get_enc_key_type(BD_ADDR bd_addr, UINT8 *p_key_types);
|
||||
|
||||
void btm_ble_test_command_complete(UINT8 *p);
|
||||
void btm_ble_rand_enc_complete (UINT8 *p, UINT16 op_code, tBTM_RAND_ENC_CB *p_enc_cplt_cback);
|
||||
|
||||
void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys, BOOLEAN pass_to_application);
|
||||
void btm_ble_update_sec_key_size(BD_ADDR bd_addr, UINT8 enc_key_size);
|
||||
UINT8 btm_ble_read_sec_key_size(BD_ADDR bd_addr);
|
||||
|
||||
/* white list function */
|
||||
BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBTM_ADD_WHITELIST_CBACK *add_wl_cb);
|
||||
void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy);
|
||||
void btm_update_adv_filter_policy(tBTM_BLE_AFP adv_policy);
|
||||
void btm_ble_clear_white_list (void);
|
||||
void btm_read_white_list_size_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_add_2_white_list_complete(UINT8 status);
|
||||
void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_white_list_init(UINT8 white_list_size);
|
||||
|
||||
/* background connection function */
|
||||
BOOLEAN btm_ble_suspend_bg_conn(void);
|
||||
BOOLEAN btm_ble_resume_bg_conn(void);
|
||||
void btm_ble_initiate_select_conn(BD_ADDR bda);
|
||||
BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
|
||||
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback);
|
||||
BOOLEAN btm_ble_renew_bg_conn_params(BOOLEAN add, BD_ADDR bd_addr);
|
||||
void btm_write_dir_conn_wl(BD_ADDR target_addr);
|
||||
void btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bda, UINT8 status);
|
||||
BOOLEAN btm_execute_wl_dev_operation(void);
|
||||
void btm_ble_update_link_topology_mask(UINT8 role, BOOLEAN increase);
|
||||
|
||||
/* direct connection utility */
|
||||
BOOLEAN btm_send_pending_direct_conn(void);
|
||||
void btm_ble_enqueue_direct_conn_req(void *p_param);
|
||||
|
||||
/* BLE address management */
|
||||
void btm_gen_resolvable_private_addr (void *p_cmd_cplt_cback);
|
||||
void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p);
|
||||
void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK *p_cback, void *p);
|
||||
void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p);
|
||||
|
||||
/* privacy function */
|
||||
#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
|
||||
/* BLE address mapping with CS feature */
|
||||
BOOLEAN btm_identity_addr_to_random_pseudo(BD_ADDR bd_addr, UINT8 *p_addr_type, BOOLEAN refresh);
|
||||
BOOLEAN btm_random_pseudo_to_identity_addr(BD_ADDR random_pseudo, UINT8 *p_static_addr_type);
|
||||
void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rra, UINT8 rra_type);
|
||||
void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa);
|
||||
void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_read_ble_resolving_list_size_complete (UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_enable_resolving_list(UINT8);
|
||||
BOOLEAN btm_ble_disable_resolving_list(UINT8 rl_mask, BOOLEAN to_resume);
|
||||
void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask);
|
||||
void btm_ble_resolving_list_init(UINT8 max_irk_list_sz);
|
||||
void btm_ble_resolving_list_cleanup(void);
|
||||
#endif
|
||||
|
||||
void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
|
||||
void btm_ble_multi_adv_init(void);
|
||||
void *btm_ble_multi_adv_get_ref(UINT8 inst_id);
|
||||
void btm_ble_multi_adv_cleanup(void);
|
||||
void btm_ble_multi_adv_reenable(UINT8 inst_id);
|
||||
void btm_ble_multi_adv_enb_privacy(BOOLEAN enable);
|
||||
char btm_ble_map_adv_tx_power(int tx_power_index);
|
||||
void btm_ble_batchscan_init(void);
|
||||
void btm_ble_batchscan_cleanup(void);
|
||||
void btm_ble_adv_filter_init(void);
|
||||
void btm_ble_adv_filter_cleanup(void);
|
||||
BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request);
|
||||
BOOLEAN btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state);
|
||||
BOOLEAN btm_ble_set_topology_mask(tBTM_BLE_STATE_MASK request_state);
|
||||
|
||||
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
|
||||
void btm_ble_set_no_disc_if_pair_fail (BOOLEAN disble_disc);
|
||||
void btm_ble_set_test_mac_value (BOOLEAN enable, UINT8 *p_test_mac_val);
|
||||
void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr);
|
||||
void btm_set_random_address(BD_ADDR random_bda);
|
||||
void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu);
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user