h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
714 stars 150 forks source link

Connecting to same device as both client & server for ANCS #713

Open mathcampbell opened 2 months ago

mathcampbell commented 2 months ago

hey there; I'm trying to implement an ANCS (Apple Notification Centre Service) using NimBLE - I'm having real trouble though because it needs you to make a server on your device, solicit the UUID for ANCS, connect the iOS device ("phone" to save me typing device constantly) as a client, authenticate etc, then create a client and connect the phone as a server, at the same time.

I have built my code virtually mirroring an implementation of ANCS for arduino built on bluedroid, but as soon as I try to connect the client it spits out "E NimBLEClient: A connection to xx:xx:xx:xx:xx:xx already exists" (and there isn't a client connection; it's the NimBLEServer connection to the phone). I know the hardware can manage it etc; anyone care to help me out where I'm going wrong?

h2zero commented 2 months ago

Hi, the master branch has added this capability by creating a client and then assigning the connection handle to it. See commit: 6db0368