Closed ankgt closed 1 year ago
Hello, the reason you are seeing this is because you have created the advertising instance before initializing the stack here:
static NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
To correct this I suggest changing the line above to:
static NimBLEAdvertising *pAdvertising = nullptr;
Then in your setup you would add this line after init()
:
pAdvertising = NimBLEDevice::getAdvertising();
PS:
I want to first thank the author for developing and maintaining such a fantastic library. Not only is the library amazing, his support and helpfulness on the forum is something I have not seen anywhere. Kudos!
Thank you 🙏, you're very welcome!
Thanks very much, that did the trick!
Incidentally I had used the 'NimBLE_Service_Data_Advertiser' example as the base. That also suffers from this issue. Shall I make a pull request for this?
Great, sure please submit a PR for this, thanks!
I want to first thank the author for developing and maintaining such a fantastic library. Not only is the library amazing, his support and helpfulness on the forum is something I have not seen anywhere. Kudos!
I have been experimenting with setting custom manufacturer data in the advertising packet. I have written the following code and it works great with the exception that the device name is getting truncated to 6 characters (shows only as NimBLE). Now from my research I believe the advertising data length should not exceed 31 bytes. I am ensuring this (27 bytes as per my calculation including the LEN and TYPE fields).
However I find that if I manually set the device name again on (by doing pAdvertising->setName) the name appears correctly (NimBLE-Arduino).
Is this a bug or something I am doing wrong? Thanks!
I am using version 1.4.1 and have tried it both on Arduino core version 2.0.9 as well as the older 1.0.6.