1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/pkg/nimble/autoadv
Kaspar Schleiser 94e314c914 pkg/nimble: fix if(IS_ACTIVE(..) && CONSTANT) with llvm
Fixes

```
/home/kaspar/src/riot.rs/pkg/nimble/autoadv/nimble_autoadv.c:163:46: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
    if (IS_ACTIVE(NIMBLE_AUTOADV_FLAG_FIELD) && BLUETIL_AD_FLAGS_DEFAULT) {
                                             ^  ~~~~~~~~~~~~~~~~~~~~~~~~
/home/kaspar/src/riot.rs/pkg/nimble/autoadv/nimble_autoadv.c:163:46: note: use '&' for a bitwise operation
    if (IS_ACTIVE(NIMBLE_AUTOADV_FLAG_FIELD) && BLUETIL_AD_FLAGS_DEFAULT) {
                                             ^~
                                             &
/home/kaspar/src/riot.rs/pkg/nimble/autoadv/nimble_autoadv.c:163:46: note: remove constant to silence this warning
    if (IS_ACTIVE(NIMBLE_AUTOADV_FLAG_FIELD) && BLUETIL_AD_FLAGS_DEFAULT) {
                                            ~^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
2021-09-16 14:01:33 +02:00
..
include pkg/nimble/autoadv: make AD flag optionnal 2021-08-24 09:12:58 +02:00
Makefile sys/nimble_autoadv: add new module 2020-11-05 10:53:21 +01:00
nimble_autoadv.c pkg/nimble: fix if(IS_ACTIVE(..) && CONSTANT) with llvm 2021-09-16 14:01:33 +02:00
README.md pkg/nimble/autoadv: make AD flag optionnal 2021-08-24 09:12:58 +02:00

NimBLE automated advertisements

Module for automated bluetooth advertising. Advertising is restarted on disconnect events automatically. Defaults to the following characteristics: - General discoverable mode (BLE_GAP_DISC_MODE_GEN) - Undirected connectable mode (BLE_GAP_CONN_MODE_UND) - No expiration (BLE_HS_FOREVER) - No name

It can be enabled by adding

USEMODULE += nimble_autoadv

to your makefile.

If your application is calling functions from nimble, e.g. ble_svc_gap_device_name_set(), NIMBLE_AUTOADV_START_MANUALLY should be set to 1 with the following line in your Makefile:

CFLAGS += -DNIMBLE_AUTOADV_START_MANUALLY=1

Then the application should call nimble_autoadv_adv_start() after all of its nimble calls to prevent errors like BLE_HS_EBUSY.

To specify a device name add the following line to your Makefile:

CFLAGS += -DNIMBLE_AUTOADV_DEVICE_NAME='"Riot OS device"'

By the default, in the advertised packet, the module includes the advertising Flags data type. According to Bluetooth Core Specification Supplement (see §1.3.1)

The Flags data type shall be included when any of the Flag bits are non-zero and the advertising packet is connectable, otherwise the Flags data type may be omitted.

If your application is not connectable (eg. a temperature sensor advertising its current value), you might want omit this flag by clearing the NIMBLE_AUTOADV_FLAG_FIELD when including this module:

CFLAGS += -DNIMBLE_AUTOADV_FLAG_FIELD=0

This will grant three extra bytes in the advertisement packet.