GithubHelp home page GithubHelp logo

Comments (7)

h2zero avatar h2zero commented on June 4, 2024 1

I'm not sure why this would be happening, I will need to investigate.

from nimble-arduino.

h2zero avatar h2zero commented on June 4, 2024 1

Thanks for this information, I will try this tomorrow and see if I can reproduce it.

from nimble-arduino.

Aizudev avatar Aizudev commented on June 4, 2024

Thank you, that would be much appreciated!

I tested it with your example code for the BLE server, and modified the setup to look like this:

  // 1. Create the BLE Device
  NimBLEDevice::init("My device");
  NimBLEDevice::setMTU(517);
 //NimBLEDevice::setSecurityAuth(BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM | BLE_SM_PAIR_AUTHREQ_SC);

  // 2. Create the BLE server
  pServer = NimBLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());

  // 3. Create BLE Service
  pDataService = pServer->createService(SERVICE_DATA_UUID);
  pDataTxCharacteristic = pDataService->createCharacteristic(CHARACTERISTIC_DATA_TX_UUID,
                      NIMBLE_PROPERTY:: NOTIFY);
  pDataCharacteristic = pDataService->createCharacteristic(CHARACTERISTIC_DATA_UUID,
                       NIMBLE_PROPERTY:: WRITE_NR | NIMBLE_PROPERTY::WRITE_ENC);
  pDataCharacteristic->setCallbacks(new bleCallback());
  pDataService->start();

I then tried to send BLE data from the LightBlue app on iOS, with WRITE, the Pair prompt shows up but not WRITE_NR.

from nimble-arduino.

Aizudev avatar Aizudev commented on June 4, 2024

Fixed it by enforcing encryption on connect:

int b = NimBLEDevice::startSecurity(desc->conn_handle);

It works for now.

2 other issues that came up:

Enabling bonding disconnects automatically and does not attempt to reconnect. I had to go to iOS settings to forget the device to put it in a working state again.

  NimBLEDevice::setSecurityAuth(BLE_SM_PAIR_AUTHREQ_BOND |  /**BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);

Also, I left the default max connections (3) as is, but it seems like only one device connect to it at one time.

from nimble-arduino.

Aizudev avatar Aizudev commented on June 4, 2024

hi @h2zero , any idea on what might be causing this or how to debug this?

  NimBLEDevice::setSecurityAuth(true, false true);

Setting this seems to enable bonding, but my iOS is unable to reconnect to the device unless I forget the bond and pair it again.

from nimble-arduino.

h2zero avatar h2zero commented on June 4, 2024

Please try erasing the flash fully and try again to clear out any old bond info and try again.

from nimble-arduino.

Aizudev avatar Aizudev commented on June 4, 2024

Did all of that but didn't work.

I'm enforcing encryption on connect, and using iOS 17.2.1

from nimble-arduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.