arduino / arduino/ArduinoCore-arc32

Peripheral not connectable when broadcasting characteristic value

Open
#583 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
330
Forks
281
PR merge metrics
No merged PRs in 30d

Description

Issue #420 added support for broadcasting a characteristic value. This works now, however I'm not able to connect to the peripheral. (Sample code below.)

nRF Connect (Samsung S8 with Android 7.0) has a connect button but the connection always fails.
nRF Connect (iPhone 7 with iOS 11.2.5) reports the peripheral is not connectable.

![not-connectable](https://user-images.githubusercontent.com/3133/35427241-3bff4d00-0236-11e8-9fd5-7e4e15793e6e.jpg)

// Broadcast Characteristic Value
// Simple counter that broadcasts a value

#ifdef ARDUINO_ARCH_ARC32 // Arduino 101
#include
#else
#include
#endif

uint8_t value = 0;

BLEPeripheral peripheral;
BLEService service = BLEService("EEE0");
BLEShortCharacteristic characteristic = BLEShortCharacteristic("EEE1", BLERead | BLENotify | BLEBroadcast);

void setup() {
Serial.begin(9600);

peripheral.setLocalName("BLEBroadcast");
peripheral.setAdvertisedServiceUuid(service.uuid());

peripheral.addAttribute(service);
peripheral.addAttribute(characteristic);

characteristic.setValue(value);

peripheral.begin();
characteristic.broadcast();

Serial.println(F("BLE Broadcast Count"));
}

void loop() {
peripheral.poll();
characteristic.setValue(value);
delay(1000);
value++;
}

https://gist.github.com/don/536d9f1d605d9bfffcd99b5716a72cb4

I see similar behavior with the version 2 of the API https://gist.github.com/don/aa2d924e0214b8b43e10a8e0ddd4243d

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the sample code in this issue and compare the broadcasting support introduced by issue #420, including the version 2 API example in the linked gist. Reproduce the behavior with nRF Connect on Android or iOS and trace why the peripheral is reported as non-connectable. Done means the characteristic continues broadcasting while the peripheral can also accept a connection.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.