Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peripheral not connectable when broadcasting characteristic value #583

Open
don opened this issue Jan 26, 2018 · 0 comments
Open

Peripheral not connectable when broadcasting characteristic value #583

don opened this issue Jan 26, 2018 · 0 comments

Comments

@don
Copy link

don commented Jan 26, 2018

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

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

#ifdef ARDUINO_ARCH_ARC32 // Arduino 101
  #include <CurieBLE.h>
#else
  #include <BLEPeripheral.h>
#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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant