Component/bt: add gattc and gatts coex example
This commit is contained in:
parent
0521296264
commit
f78eea97fe
7 changed files with 1072 additions and 0 deletions
6
examples/bluetooth/gattc_gatts_coex/CMakeLists.txt
Normal file
6
examples/bluetooth/gattc_gatts_coex/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||||
|
# in this exact order for cmake to work correctly
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(gattc_gatts_coex)
|
10
examples/bluetooth/gattc_gatts_coex/Makefile
Normal file
10
examples/bluetooth/gattc_gatts_coex/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#
|
||||||
|
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
|
||||||
|
# project subdirectory.
|
||||||
|
#
|
||||||
|
|
||||||
|
PROJECT_NAME := gattc_gatts_coex
|
||||||
|
|
||||||
|
COMPONENT_ADD_INCLUDEDIRS := components/include
|
||||||
|
|
||||||
|
include $(IDF_PATH)/make/project.mk
|
14
examples/bluetooth/gattc_gatts_coex/README.md
Normal file
14
examples/bluetooth/gattc_gatts_coex/README.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
ESP-IDF Gattc and Gatts Coexistence example
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
This example demonstrates the coexistence of gattc and gatts.
|
||||||
|
|
||||||
|
This example creates a GATT service and starts ADV. The ADV name is `ESP_GATTS_DEMO`, then waits to be connected. At the same time, a gatt client is created, the ADV name is `ESP_GATTS_DEMO`, the device is connected, and the data is exchanged. If the device is not found within 120 seconds, the example will stop scanning.
|
||||||
|
|
||||||
|
ESP-IDF also allows users to create a GATT service via an attribute table, rather than add attributes one by one. And it is recommended for users to use. For more information about this method, please refer to [gatt_server_service_table_demo](../gatt_server_service_table).
|
||||||
|
|
||||||
|
To test this example, you can run the [gatt_client_demo](../gatt_client), which can scan for and connect to this example automatically, and run [gatt_server_demo](../gatt_server), Waiting to be connected. They will start exchanging data once the GATT client has enabled the notification function of the GATT server.
|
||||||
|
|
||||||
|
Please check the [tutorial](tutorial/Gatt_Server_Example_Walkthrough.md) for more information about the gatts part of this example.
|
||||||
|
Please check the [tutorial](tutorial/Gatt_Client_Example_Walkthrough.md) for more information about the gattc part of this example.
|
||||||
|
|
4
examples/bluetooth/gattc_gatts_coex/main/CMakeLists.txt
Normal file
4
examples/bluetooth/gattc_gatts_coex/main/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
set(COMPONENT_SRCS "gattc_gatts_coex.c")
|
||||||
|
set(COMPONENT_ADD_INCLUDEDIRS ".")
|
||||||
|
|
||||||
|
register_component()
|
4
examples/bluetooth/gattc_gatts_coex/main/component.mk
Normal file
4
examples/bluetooth/gattc_gatts_coex/main/component.mk
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#
|
||||||
|
# "main" pseudo-component makefile.
|
||||||
|
#
|
||||||
|
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
|
1028
examples/bluetooth/gattc_gatts_coex/main/gattc_gatts_coex.c
Normal file
1028
examples/bluetooth/gattc_gatts_coex/main/gattc_gatts_coex.c
Normal file
File diff suppressed because it is too large
Load diff
6
examples/bluetooth/gattc_gatts_coex/sdkconfig.defaults
Normal file
6
examples/bluetooth/gattc_gatts_coex/sdkconfig.defaults
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# Override some defaults so BT stack is enabled
|
||||||
|
# by default in this example
|
||||||
|
CONFIG_BT_ENABLED=y
|
||||||
|
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
|
||||||
|
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=
|
||||||
|
CONFIG_BTDM_CTRL_MODE_BTDM=
|
Loading…
Reference in a new issue