espressif/ble_htp

0.1.0

uploaded 3 months ago
BLE standard profile support Health Thermometer

readme

## Health Thermometer Profile Component

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

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

``ble_htp`` is a component which provide a simplified API interface for accessing the commonly used BLE health thermometer profile functionality on a GATT Client.

### Add component to your project

Please use the component manager command `add-dependency` to add the `ble_htp` to your project's dependency, during the `CMake` step the component will be downloaded automatically

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

### Examples

Please use the component manager command `create-project-from-example` to create the project from example template

```
idf.py create-project-from-example "espressif/ble_htp=*:ble_htp"
```

Then the example will be downloaded in current folder, you can check into it for build and flash.

> You can use this command to download other examples. Or you can download examples from esp-iot-solution repository:
1. [ble_htp](https://github.com/espressif/esp-iot-solution/tree/master/examples/bluetooth/ble_profiles/ble_htp)

### Q&A

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

```
  HINT: Please check manifest file of the following component(s): main

  ERROR: Because project depends on esp-now (2.*) which doesn't match any
  versions, version solving failed.
```

A1. For the examples downloaded by using this command, you need to comment out the override_path line in the main/idf_component.yml of each example.

Q2. 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
```

A2. This is because an older version packege manager was used, please run `pip install -U idf-component-manager` in ESP-IDF environment to update.

changelog

## v0.1.0

This is the first release version for Health Thermometer Profile 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_profiles.html).

Features:
- HTP: Support Health Thermometer Profile.

readme of ble_profiles/ble_anp example

                                        
                                        | Supported Targets | ESP32 | ESP32-C3 | ESP32-C2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- |

# BLE Alert Notification Profile Example 

(See the README.md file in the upper level 'examples' directory for more information about examples.)

This example creates GATT client and performs passive scan, it then connects to peripheral device if the device advertises connectability and the device advertises support for the Alert Notification service (0x1811) as primary service UUID.

At the same time, it also creates an interactive shell and then controlled/interacted with over a serial interface to emulation the ANP behavior.

It performs three GATT operations against the specified peer:

* Reads the ANS Supported New Alert Category characteristic.
* After the read operation is completed, writes the ANS Alert Notification Control Point characteristic.
* After the write operation is completed, subscribes to notifications for the ANS Unread Alert Status characteristic.

If the peer does not support a required service, characteristic, or descriptor, then the peer lied when it claimed support for the alert notification service! When this happens, or if a GATT procedure fails, this function immediately terminates the connection.

It uses Bluetooth controller based on BLE connection management.

This example aims at understanding alert notification profile's characteristic operations and BLE connection management APIs

To test this demo, use any BLE GATT server app that advertises support for the Alert Notification service (0x1811) and includes it in the GATT database.

## Using Examples

### Functions Processing

Use the commands as follows can check the alert notification profile functions.

* anp

  * `-t (Mandatory)`: Get or Set function
  * `-c (Mandatory)`: Category ID
  * `-o (Mandatory)`: Enable, Disable and Recovery optional

* New Alert

  * Read the Value of Supported New Alert Category
```
anp -t 1 -c 1 -o 0
anp -t 1 -c 255 -o 0
```

  * Enable the specific category for New Alert to Notify when New Alert Count Changes
```
anp -t 2 -c 1 -o 0
```

  * Disable the specific category for New Alert to Notify when New Alert Count Changes
```
anp -t 2 -c 1 -o 1
```

  * Recovery from Connection Loss for New Alerts
```
anp -t 2 -c 1 -o 2
```

* Unread Alert

  * Read the Value of Supported Unread Alert Category
```
anp -t 3 -c 1 -o 0
anp -t 3 -c 255 -o 0
```

  * Enable the specific category for Unread Alert to Notify when Unread Alert Status Changes
```
anp -t 4 -c 1 -o 0
```

  * Disable the specific category for Unread Alert to Notify when Unread Alert Status Changes
```
anp -t 4 -c 1 -o 1
```

  * Recovery from Connection Loss for Unread Alert
```
anp -t 4 -c 1 -o 2
```

## How to Use Example

Before project configuration and build, be sure to set the correct chip target using:

```bash
idf.py set-target <chip_name>
```

### Hardware Required

* A development board with ESP32/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
* A USB cable for Power supply and programming

See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.

### Configure the Project

Open the project configuration menu: 

```bash
idf.py menuconfig
```

In the `Example Configuration` menu:

* Select advertisement name of device from `Example Configuration --> Advertisement name`, default is `BLE_ANS`.

### Build and Flash

Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.

(To exit the serial monitor, type ``Ctrl-]``.)

See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects.

## Example Output

This is the console output on successful connection:

```
This is an example of profile component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
Press Enter or Ctrl+C will terminate the console environment.
I (348) BTDM_INIT: BT controller compile version [80abacd]
I (368) phy_init: phy_version 950,11a46e9,Oct 21 2022,08:56:12
I (418) system_api: Base MAC address is not set
I (418) system_api: read default base MAC address from EFUSE
I (418) BTDM_INIT: Bluetooth MAC: 84:f7:03:08:21:1a

I (428) esp_nimble: BLE Host Task Started
I (428) NimBLE: GAP procedure initiated: stop advertising.

I (438) NimBLE: GAP procedure initiated: discovery; 
I (448) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1 
I (458) NimBLE: duration=forever
I (458) NimBLE: 

I (468) NimBLE: GAP procedure initiated: connect; 
I (468) NimBLE: peer_addr_type=0 peer_addr=
I (468) NimBLE: 84:f7:03:09:09:ca
I (478) NimBLE:  scan_itvl=18 scan_window=17 itvl_min=25 itvl_max=26 latency=1 supervision_timeout=20 min_ce_len=3 max_ce_len=4 own_addr_type=0
I (488) NimBLE: 

esp32c3> I (638) NimBLE: GATT procedure initiated: discover all services

I (638) app_main: ESP_BLE_CONN_EVENT_CONNECTED
I (698) NimBLE: GATT procedure initiated: discover all characteristics; 
I (698) NimBLE: start_handle=1 end_handle=5

I (858) NimBLE: GATT procedure initiated: discover all characteristics; 
I (858) NimBLE: start_handle=6 end_handle=9

I (1048) NimBLE: GATT procedure initiated: discover all characteristics; 
I (1058) NimBLE: start_handle=10 end_handle=65535

I (1348) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1348) NimBLE: chr_val_handle=8 end_handle=9

I (1438) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1448) NimBLE: chr_val_handle=12 end_handle=13

I (1538) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1538) NimBLE: chr_val_handle=15 end_handle=17

I (1638) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1638) NimBLE: chr_val_handle=19 end_handle=20

I (1738) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1738) NimBLE: chr_val_handle=22 end_handle=24

I (1828) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1838) NimBLE: chr_val_handle=26 end_handle=65535

I (2028) esp_nimble: Service discovery complete; rc=0, conn_handle=1
I (2028) app_main: ESP_BLE_CONN_EVENT_DISC_COMPLETE
esp32c3> 
esp32c3> help
help 
  Print the list of registered commands

anp  [-t <01~04>] [-c <01~255>] [-o <00~02>]
  Alert Notification Client
  -t, --type=<01~04>  01 Get supported new alert category
                      02 Set supported new alert category
                      03 Get supported unread alert status category
                      04 Set supported unread alert status category
  -c, --category=<01~255>  Category ID
  -o, --option=<00~02>  0: Enable, 1: Disable, 2: Recover

esp32c3> anp -t 2 -c 3 -o 0
I (27848) NimBLE: GATT procedure initiated: write; 
I (27848) NimBLE: att_handle=26 len=2

I (27928) esp_anp: Configure Alert Notification Control Point Success!
I (27928) esp_anp: 00 03 
I (27928) esp_anp: Request the New Alert in the server to notify immediately on current enabled categories 3
I (27938) NimBLE: GATT procedure initiated: write; 
I (27958) NimBLE: att_handle=26 len=2

I (28028) esp_nimble: received notification; conn_handle=1 attr_handle=15 attr_len=2

I (28028) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (28038) esp_anp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (28038) esp_anp: Receive Notification of New Alert on cat_id 3 which count change to 0
I (28048) app_anp: Get the current message counts 3 from category 0 of supported new alert
I (28028) esp_anp: Configure Alert Notification Control Point Success!
I (28068) esp_anp: 04 03 
I (28068) app_anp: 4.06 Request Category 3 of Supported New Alert Category to Notify
esp32c3> I (43338) esp_nimble: received notification; conn_handle=1 attr_handle=15 attr_len=2

I (43338) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (43348) esp_anp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (43348) esp_anp: Receive Notification of New Alert on cat_id 3 which count change to 1
I (43358) app_anp: Get the current message counts 3 from category 1 of supported new alert
```

## Troubleshooting

For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

                                    

readme of ble_profiles/ble_hrp example

                                        
                                        | Supported Targets | ESP32 | ESP32-C3 | ESP32-C2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- |

# BLE Heart Rate Profile Example 

(See the README.md file in the upper level 'examples' directory for more information about examples.)

This example creates GATT client and performs passive scan, it then connects to peripheral device if the device advertises connectability and the device advertises support for the heart rate service (0x180D) as primary service UUID.

At the same time, it also creates an interactive shell and then controlled/interacted with over a serial interface to emulation the HRP behavior.

If the peer does not support a required service, characteristic, or descriptor, then the peer lied when it claimed support for the heart rate service! When this happens, or if a GATT procedure fails, this function immediately terminates the connection.

It uses Bluetooth controller based on BLE connection management.

This example aims at understanding heart rate profile's characteristic operations and BLE connection management APIs

To test this demo, use any BLE GATT server app that advertises support for the heart rate service (0x180D) and includes it in the GATT database.

## Using Examples

### Functions Processing

Use the commands as follows can check the heart rate profile functions.

* hrp

  * `-t (Mandatory)`: Get or Set function
  * `-c (Optional)`: Command

* Read the Value of Body Sensor Location

```
hrp -t 1
```
> The command is valid when the Body Sensor Location characteristic is static in a connection.

* Reset or energy expended

```
hrp -t 2 -c 1
hrp -t 2 -c 10
```
> The command is valid when the server supports the Energy Expended feature.

## How to Use Example

Before project configuration and build, be sure to set the correct chip target using:

```bash
idf.py set-target <chip_name>
```

### Hardware Required

* A development board with ESP32/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
* A USB cable for Power supply and programming

See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.

### Configure the Project

Open the project configuration menu: 

```bash
idf.py menuconfig
```

In the `Example Configuration` menu:

* Select advertisement name of device from `Example Configuration --> Advertisement name`, default is `BLE_HTS`.

### Build and Flash

Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.

(To exit the serial monitor, type ``Ctrl-]``.)

See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects.

## Example Output

This is the console output on successful connection:

```
This is an example of profile component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
Press Enter or Ctrl+C will terminate the console environment.
I (347) BTDM_INIT: BT controller compile version [80abacd]
I (367) phy_init: phy_version 950,11a46e9,Oct 21 2022,08:56:12
I (417) system_api: Base MAC address is not set
I (417) system_api: read default base MAC address from EFUSE
I (417) BTDM_INIT: Bluetooth MAC: 84:f7:03:08:21:1a

I (437) esp_nimble: BLE Host Task Started
I (437) NimBLE: GAP procedure initiated: stop advertising.

I (437) NimBLE: GAP procedure initiated: discovery; 
I (457) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1 
I (457) NimBLE: duration=forever
I (467) NimBLE: 

                                                                                                                                     I (537) NimBLE: GAP procedure initiated: connect; 
I (537) NimBLE: peer_addr_type=0 peer_addr=
I (537) NimBLE: 84:f7:03:09:09:ca
I (547) NimBLE:  scan_itvl=18 scan_window=17 itvl_min=25 itvl_max=26 latency=1 supervision_timeout=20 min_ce_len=3 max_ce_len=4 own_addr_type=0
I (557) NimBLE: 

esp32c3> I (697) NimBLE: GATT procedure initiated: discover all services

I (707) app_main: ESP_BLE_CONN_EVENT_CONNECTED
I (757) NimBLE: GATT procedure initiated: discover all characteristics; 
I (757) NimBLE: start_handle=1 end_handle=5

I (917) NimBLE: GATT procedure initiated: discover all characteristics; 
I (927) NimBLE: start_handle=6 end_handle=9

I (1117) NimBLE: GATT procedure initiated: discover all characteristics; 
I (1117) NimBLE: start_handle=10 end_handle=65535

I (1347) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1347) NimBLE: chr_val_handle=8 end_handle=9

I (1437) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1447) NimBLE: chr_val_handle=12 end_handle=14

I (1537) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1537) NimBLE: chr_val_handle=16 end_handle=17

I (1637) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1637) NimBLE: chr_val_handle=19 end_handle=65535

I (1827) esp_nimble: Service discovery complete; rc=0, conn_handle=1
I (1837) app_main: ESP_BLE_CONN_EVENT_DISC_COMPLETE
esp32c3> 
esp32c3> heI (4337) esp_nimble: received notification; conn_handle=1 attr_handle=12 attr_len=17

I (4337) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (4347) esp_hrp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

W (4347) esp_hrp: Sensor Contact Feature is Supported
W (4357) esp_hrp: Skin Contact is Detected
I (4357) app_hrp: Heart Rate Value 12098
W (4357) app_hrp: Sensor Contact Feature is Supported
W (4367) app_hrp: Skin Contact is Detected
I (4367) app_hrp: The multiple time between two R-Wave detections
I (4377) app_hrp: ec 75 00 00 00 00 00 00 00 00 00 00 00 00 
esp32c3> help
help 
  Print the list of registered commands

hrp  [-t <01~02>] [-c <0~255>]
  Heart Rate Profile
  -t, --type=<01~02>  01 Gets Body Sensor Location Characteristic
                      02 Set Heart Rate Control Point Characteristic
  -c, --cmd=<0~255>  1: Reset Energy Expended, Other: Reserved for Future Use

esp32c3> hrp -I (14347) esp_nimble: received notification; conn_handle=1 attr_handle=12 attr_len=4

I (14347) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (14357) esp_hrp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

W (14357) esp_hrp: Sensor Contact Feature is Supported
W (14367) esp_hrp: Skin Contact isn't Detected
I (14367) app_hrp: Heart Rate Value 38
W (14367) app_hrp: Sensor Contact Feature is Supported
W (14377) app_hrp: Skin Contact isn't Detected
I (14377) app_hrp: The Energy Expended feature is supported and accumulated 27125kJ
esp32c3> hrp -t 1
I (16517) NimBLE: GATT procedure initiated: read; 
I (16527) NimBLE: att_handle=16

I (16587) esp_nimble: characteristic read; conn_handle=1 attr_handle=16 len=1 value=
I (16587) app_hrp: Gets the Value of Body Sensor Location 4
esp32c3> hrp -t 2 -c 1I (24357) esp_nimble: received notification; conn_handle=1 attr_handle=12 attr_len=17

I (24357) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (24367) esp_hrp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

W (24367) esp_hrp: Sensor Contact Feature is Supported
W (24377) esp_hrp: Skin Contact is Detected
I (24377) app_hrp: Heart Rate Value 17386
W (24377) app_hrp: Sensor Contact Feature is Supported
W (24387) app_hrp: Skin Contact is Detected
I (24387) app_hrp: The multiple time between two R-Wave detections
I (24397) app_hrp: c0 76 e2 ae 00 00 00 00 00 00 00 00 00 00 
esp32c3> hrp -t 2 -c 1
E (25127) app_hrp: Invalid option
Command returned non-zero error code: 0x102 (ESP_ERR_INVALID_ARG)
esp32c3> hrp -t 2 -c 10
E (29447) app_hrp: Invalid option
Command returned non-zero error code: 0x102 (ESP_ERR_INVALID_ARG)
esp32c3> I (34367) esp_nimble: received notification; conn_handle=1 attr_handle=12 attr_len=19

I (34367) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (34377) esp_hrp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

W (34377) esp_hrp: Sensor Contact Feature is Supported
W (34387) esp_hrp: Skin Contact is Detected
I (34387) app_hrp: Heart Rate Value 30605
W (34387) app_hrp: Sensor Contact Feature is Supported
W (34397) app_hrp: Skin Contact is Detected
I (34397) app_hrp: The Energy Expended feature is supported and accumulated 58749kJ
I (34407) app_hrp: The multiple time between two R-Wave detections
I (34427) app_hrp: e2 b6 8b fd 8f bc 00 00 00 00 00 00 00 00 
esp32c3> 
```

## Troubleshooting

For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

                                    

readme of ble_profiles/ble_htp example

                                        
                                        | Supported Targets | ESP32 | ESP32-C3 | ESP32-C2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- |

# BLE Health Thermometer Profile Example 

(See the README.md file in the upper level 'examples' directory for more information about examples.)

This example creates GATT client and performs passive scan, it then connects to peripheral device if the device advertises connectability and the device advertises support for the health thermometer service (0x1809) as primary service UUID.

At the same time, it also creates an interactive shell and then controlled/interacted with over a serial interface to emulation the HTP behavior.

If the peer does not support a required service, characteristic, or descriptor, then the peer lied when it claimed support for the health thermometer service! When this happens, or if a GATT procedure fails, this function immediately terminates the connection.

It uses Bluetooth controller based on BLE connection management.

This example aims at understanding health thermometer profile's characteristic operations and BLE connection management APIs

To test this demo, use any BLE GATT server app that advertises support for the health thermometer service (0x1809) and includes it in the GATT database.

## Using Examples

### Functions Processing

Use the commands as follows can check the health thermometer profile functions.

* htp

  * `-t (Mandatory)`: Get or Set function
  * `-i (Optional)`: Interval

* Read the Value of Temperature Type
```
htp -t 1
```

* Read the Value of Measurement Interval
```
htp -t 2
```

* Set the Value of Measurement Interval to disable or enable periodic indications
```
htp -t 3 -i 0
htp -t 3 -i 10
```

## How to Use Example

Before project configuration and build, be sure to set the correct chip target using:

```bash
idf.py set-target <chip_name>
```

### Hardware Required

* A development board with ESP32/ESP32-C3 SoC (e.g., ESP32-DevKitC, ESP-WROVER-KIT, etc.)
* A USB cable for Power supply and programming

See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.

### Configure the Project

Open the project configuration menu: 

```bash
idf.py menuconfig
```

In the `Example Configuration` menu:

* Select advertisement name of device from `Example Configuration --> Advertisement name`, default is `BLE_HTS`.

### Build and Flash

Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.

(To exit the serial monitor, type ``Ctrl-]``.)

See the [Getting Started Guide](https://idf.espressif.com/) for full steps to configure and use ESP-IDF to build projects.

## Example Output

This is the console output on successful connection:

```
This is an example of profile component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
Press Enter or Ctrl+C will terminate the console environment.
I (347) BTDM_INIT: BT controller compile version [80abacd]
I (367) phy_init: phy_version 950,11a46e9,Oct 21 2022,08:56:12
I (417) system_api: Base MAC address is not set
I (417) system_api: read default base MAC address from EFUSE
I (417) BTDM_INIT: Bluetooth MAC: 84:f7:03:08:21:1a

I (427) esp_nimble: BLE Host Task Started
I (427) NimBLE: GAP procedure initiated: stop advertising.

I (437) NimBLE: GAP procedure initiated: discovery; 
I (447) NimBLE: own_addr_type=0 filter_policy=0 passive=1 limited=0 filter_duplicates=1 
I (457) NimBLE: duration=forever
I (457) NimBLE: 

I (517) NimBLE: GAP procedure initiated: connect; 
I (517) NimBLE: peer_addr_type=0 peer_addr=
I (517) NimBLE: 84:f7:03:09:09:ca
I (527) NimBLE:  scan_itvl=18 scan_window=17 itvl_min=25 itvl_max=26 latency=1 supervision_timeout=20 min_ce_len=3 max_ce_len=4 own_addr_type=0
I (537) NimBLE: 

esp32c3> I (677) NimBLE: GATT procedure initiated: discover all services

I (687) app_main: ESP_BLE_CONN_EVENT_CONNECTED
I (697) esp_nimble: received indication; conn_handle=1 attr_handle=23 attr_len=2

E (697) esp_nimble: Incorrect attr_handle 23 with indication received
I (707) NimBLE: GATT procedure initiated: discover all characteristics; 
I (707) NimBLE: start_handle=1 end_handle=5

I (857) NimBLE: GATT procedure initiated: discover all characteristics; 
I (857) NimBLE: start_handle=6 end_handle=9

I (1047) NimBLE: GATT procedure initiated: discover all characteristics; 
I (1047) NimBLE: start_handle=10 end_handle=65535

I (1347) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1347) NimBLE: chr_val_handle=8 end_handle=9

I (1437) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1447) NimBLE: chr_val_handle=12 end_handle=14

I (1537) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1537) NimBLE: chr_val_handle=16 end_handle=17

I (1637) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1637) NimBLE: chr_val_handle=19 end_handle=21

I (1737) NimBLE: GATT procedure initiated: discover all descriptors; 
I (1737) NimBLE: chr_val_handle=23 end_handle=65535

I (1927) esp_nimble: Service discovery complete; rc=0, conn_handle=1
I (1927) app_main: ESP_BLE_CONN_EVENT_DISC_COMPLETE
esp32c3> 
esp32c3> help
help 
  Print the list of registered commands

htp  [-t <01~03>] [-i <0~65535>]
  Health Thermometer Profile
  -t, --type=<01~03>  01 Get Temperature Type Characteristic
                      02 Get Measurement Interval Characteristic
                      03 Set Measurement Interval Characteristic
  -i, --interval=<0~65535>  0: No periodic measurement, Other: Duration of measurement interval

esp32c3> htp -t 1
I (12327) NimBLE: GATT procedure initiated: read; 
I (12327) NimBLE: att_handle=16

I (12397) esp_nimble: characteristic read; conn_handle=1 attr_handle=16 len=1 value=
I (12397) app_htp: Gets the current temperature type value 7
esp32c3> htp -t 2
I (14407) NimBLE: GATT procedure initiated: read; 
I (14407) NimBLE: att_handle=23

I (14477) esp_nimble: characteristic read; conn_handle=1 attr_handle=23 len=2 value=
I (14477) app_htp: Gets the measurement interval value 2068
esp32c3> htp -t 3 -i 0
I (23637) NimBLE: GATT procedure initiated: write; 
I (23647) NimBLE: att_handle=23 len=2

I (23707) esp_htp: Sets the measurement interval value Success!
I (23707) esp_nimble: received indication; conn_handle=1 attr_handle=12 attr_len=5

I (23717) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (23717) esp_htp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (23727) app_htp: Measurement Temperature 62212°C
I (23707) esp_htp: 00 00 
I (23727) app_htp: Sets the measurement interval value 0
I (23797) esp_nimble: received notification; conn_handle=1 attr_handle=19 attr_len=5

I (23807) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (23817) esp_htp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (23817) app_htp: Intermediate Temperature 50762℉
esp32c3> htp -t 3 -i 10
I (27227) NimBLE: GATT procedure initiated: write; 
I (27227) NimBLE: att_handle=23 len=2

I (27307) esp_htp: Sets the measurement interval value Success!
I (27307) esp_nimble: received indication; conn_handle=1 attr_handle=12 attr_len=6

I (27327) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (27327) esp_htp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (27337) app_htp: Temperature Type 7
I (27337) app_htp: Measurement Temperature 7873°C
I (27317) esp_htp: 0a 00 
I (27347) app_htp: Sets the measurement interval value 10
I (27407) esp_nimble: received notification; conn_handle=1 attr_handle=19 attr_len=12

I (27407) app_main: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (27417) esp_htp: ESP_BLE_CONN_EVENT_DATA_RECEIVE

I (27417) app_htp: 1970年1月1日  3:55:41
I (27437) app_htp: Intermediate Temperature 13545°C
esp32c3> 
```

## Troubleshooting

For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

                                    

Links

Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif/ble_htp^0.1.0"

or download archive

Examples:

ble_profiles/ble_anp

more details

To create a project from this example, run:

idf.py create-project-from-example "espressif/ble_htp^0.1.0:ble_profiles/ble_anp"

or download archive

ble_profiles/ble_hrp

more details

To create a project from this example, run:

idf.py create-project-from-example "espressif/ble_htp^0.1.0:ble_profiles/ble_hrp"

or download archive

ble_profiles/ble_htp

more details

To create a project from this example, run:

idf.py create-project-from-example "espressif/ble_htp^0.1.0:ble_profiles/ble_htp"

or download archive

Stats

  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

espressif/ble_htp version: 0.1.0
|