Skip to content

Commit

Permalink
Merge branch 'feature/ble_services' into 'master'
Browse files Browse the repository at this point in the history
feat(ble_services): Add BLE services and examples

Closes AEG-486

See merge request ae_group/esp-iot-solution!759
  • Loading branch information
wujiangang committed Jan 22, 2024
2 parents 3327672 + b6e46aa commit 9114d92
Show file tree
Hide file tree
Showing 82 changed files with 6,607 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/upload_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
directories: >
components/audio/pwm_audio;
components/bluetooth/ble_conn_mgr;
components/bluetooth/ble_services;
components/bluetooth/ble_profiles/esp/ble_ota;
components/bluetooth/ble_profiles/std/ble_anp;
components/bluetooth/ble_profiles/std/ble_hrp;
Expand Down
78 changes: 78 additions & 0 deletions .gitlab/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,84 @@ build_example_bluetooth_ble_htp:
variables:
EXAMPLE_DIR: examples/bluetooth/ble_profiles/ble_htp

build_example_bluetooth_ble_services_ble_ans:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_ans

build_example_bluetooth_ble_services_ble_bas:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_bas

build_example_bluetooth_ble_services_ble_dis:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_dis

build_example_bluetooth_ble_services_ble_hrs:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_hrs

build_example_bluetooth_ble_services_ble_hts:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_hts

build_example_bluetooth_ble_services_ble_tps:
extends:
- .build_examples_template
- .rules:build:example_bluetooth_ble_services
parallel:
matrix:
- IMAGE: espressif/idf:release-v4.3
- IMAGE: espressif/idf:release-v4.4
- IMAGE: espressif/idf:release-v5.0
- IMAGE: espressif/idf:release-v5.1
variables:
EXAMPLE_DIR: examples/bluetooth/ble_services/ble_tps

build_example_bluetooth_ble_ota:
extends:
- .build_examples_template
Expand Down
25 changes: 25 additions & 0 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
- "components/bluetooth/ble_profiles/esp/ble_ota/**/*"
- "components/tools/cmake_utilities/package_manager.cmake"

.patterns-components_bluetooth_ble_services: &patterns-components_bluetooth_ble_services
- "components/bluetooth/ble_services/**/*"
- "components/tools/cmake_utilities/package_manager.cmake"

.patterns-components_bootloader_support_plus: &patterns-components_bootloader_support_plus
- "components/bootloader_support_plus/**/*"
- "components/utilities/xz/**/*"
Expand Down Expand Up @@ -251,6 +255,13 @@
- "components/usb/usb_device_uvc/include/usb_device_uvc.h"
- "components/usb/usb_stream/include/usb_stream.h"
- "components/zero_detection/include/zero_detection.h"
- "components/bluetooth/ble_conn_mgr/include/esp_ble_conn_mgr.h"
- "components/bluetooth/ble_services/ans/include/esp_ans.h"
- "components/bluetooth/ble_services/bas/include/esp_bas.h"
- "components/bluetooth/ble_services/dis/include/esp_dis.h"
- "components/bluetooth/ble_services/hrs/include/esp_hrs.h"
- "components/bluetooth/ble_services/hts/include/esp_hts.h"
- "components/bluetooth/ble_services/tps/include/esp_tps.h"

# examples folder, in the alphabetic order
.patterns-example_audio_wav_player: &patterns-example_audio_wav_player
Expand All @@ -271,6 +282,9 @@
.patterns-example_bluetooth_ble_ota: &patterns-example_bluetooth_ble_ota
- "examples/bluetooth/ble_ota/**/*"

.patterns-example_bluetooth_ble_services: &patterns-example_bluetooth_ble_services
- "examples/bluetooth/ble_services/**/*"

.patterns-example_bluetooth_ble_remote_control: &patterns-example_bluetooth_ble_remote_control
- "examples/bluetooth/ble_remote_control/**/*"

Expand Down Expand Up @@ -504,6 +518,17 @@
- <<: *if-dev-push
changes: *patterns-example_bluetooth_ble_htp

.rules:build:example_bluetooth_ble_services:
rules:
- <<: *if-protected
- <<: *if-label-build
- <<: *if-dev-push
changes: *patterns-build_system
- <<: *if-dev-push
changes: *patterns-components_bluetooth_ble_services
- <<: *if-dev-push
changes: *patterns-example_bluetooth_ble_services

.rules:build:example_bluetooth_ble_ota:
rules:
- <<: *if-protected
Expand Down
11 changes: 11 additions & 0 deletions components/bluetooth/ble_services/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## v0.1.0

This is the first release version for BLE services component in Espressif Component Registry, more detailed descriptions about the project, please refer to [User_Guide](https://docs.espressif.com/projects/espressif-esp-iot-solution/en/latest/bluetooth/ble_services.html).

Features:
- ANS: Support Alert Notification Service
- BAS: Support Battery Service
- DIS: Support Device Information Service
- HRS: Support Heart Rate Service
- HTS: Support Health Thermometer Service
- TPS: Support TX Power Service
43 changes: 43 additions & 0 deletions components/bluetooth/ble_services/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
set(srcs "")
set(req "")
set(include "")
set(priv_includes "")
set(priv_req "")

if(CONFIG_BLE_ANS)
list(APPEND srcs "ans/src/esp_ans.c")
list(APPEND include "ans/include")
endif()

if(CONFIG_BLE_DIS)
list(APPEND srcs "dis/src/esp_dis.c")
list(APPEND include "dis/include")
endif()

if(CONFIG_BLE_BAS)
list(APPEND srcs "bas/src/esp_bas.c")
list(APPEND include "bas/include")
endif()

if(CONFIG_BLE_HRS)
list(APPEND srcs "hrs/src/esp_hrs.c")
list(APPEND include "hrs/include")
endif()

if(CONFIG_BLE_HTS)
list(APPEND srcs "hts/src/esp_hts.c")
list(APPEND include "hts/include")
endif()

if(CONFIG_BLE_TPS)
list(APPEND srcs "tps/src/esp_tps.c")
list(APPEND include "tps/include")
endif()

list(APPEND req "ble_conn_mgr")

idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include}"
PRIV_INCLUDE_DIRS "${priv_includes}"
REQUIRES "${req}"
PRIV_REQUIRES "${priv_req}")
10 changes: 10 additions & 0 deletions components/bluetooth/ble_services/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
menu "BLE Standard Services"

orsource "./ans/Kconfig.in"
orsource "./dis/Kconfig.in"
orsource "./bas/Kconfig.in"
orsource "./hrs/Kconfig.in"
orsource "./hts/Kconfig.in"
orsource "./tps/Kconfig.in"

endmenu
45 changes: 45 additions & 0 deletions components/bluetooth/ble_services/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## BLE Services Component

[![Component Registry](https://components.espressif.com/components/espressif/ble_services/badge.svg)](https://components.espressif.com/components/espressif/ble_services)

- [User Guide](https://docs.espressif.com/projects/espressif-esp-iot-solution/en/latest/bluetooth/ble_services.html)

The ``ble_services`` component provides a simplified API interface for accessing commonly used standard and custom BLE services functionality on a GATT server.

### Adding the component to your project

Please use the component manager command `idf.py add-dependency` to add `ble_services` as a dependency to your project. The component will be downloaded automatically during the CMake step.

```
idf.py add-dependency "espressif/ble_services=*"
```

### Examples

To create a project from the example template, please use the component manager command `idf.py create-project-from-example`.

* BLE Device Information Service
```
idf.py create-project-from-example "espressif/ble_services=*:ble_dis"
```

The example will be downloaded to the current folder. You can navigate into it for building and flashing.

> You can use this command to download other examples. Or you can download examples from esp-iot-solution repository:
1. [ble_ans](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_ans)
2. [ble_bas](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_bas)
3. [ble_dis](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_dis)
4. [ble_hrs](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_hrs)
5. [ble_hts](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_hts)
5. [ble_tps](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_services/ble_tps)

### Q&A

Q1. I encountered the following problems when using the package manager

```
Executing action: create-project-from-example
CMakeLists.txt not found in project directory /home/username
```

A1. This is because an older version packege manager was used, please run `pip install -U idf-component-manager` in ESP-IDF environment to update.
8 changes: 8 additions & 0 deletions components/bluetooth/ble_services/ans/Kconfig.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GATT Alert Notification Service

menuconfig BLE_ANS
bool "GATT Alert Notification Service"

if BLE_ANS

endif # BLE_ANS
Loading

0 comments on commit 9114d92

Please sign in to comment.