-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Advertising.removeServiceUUID or Server.removeService() doesn't #541
Comments
in Non-Nimble, i have to destroy the whole stack, all the way to server, and rebuild it, to change |
I see the remove code sets the flag delete or hide, but I don't find anything that uses those flags.. well, if you remove it at the server, advertising doesn't know , but even if u remove it both places, its still advertised |
any advice? |
Hello, I'm not sure where you are removing the service in your code but if you are simply activating one service at a time I think your loop could be changed to accommodate this like so:
The abort gets called if you have added a service to the server without first starting it, I will look to handle this more gracefully in upcoming releases. |
thanks. I am trying to advertise one service at a time. they could all be running. advertising removeServiceUUID() doesnt seem to remove the the prevvious added.. |
With #544 merged I have tested with the following code that both the GATT service and the GAP service are removed as expected.
If this is not working for you could you please modify the code above to provide a test case that shows the issue? |
will test. doesnt createService() do the addService() already? |
using platformio write characteristic, set a flag,
the ArduinoBleOTA lib begin does this.
still get a crash
|
Thanks, any chance you can decode the backtrace? I appreciate the code, could you provide a basic example that I can flash for testing? |
I think this is a race, switching services, and disconnecting from the device at the same time..
numbers are different as I had to enable debug to get the backtrace decode when it doesn't crash, I end up with TWO new services with no characteristics.. still trying to debug that. same flow works in non NimBLE. still working on example |
same crash if I wait and disconnect later (30 seconds) |
I have a question, I am calling create service and characteristics from loop. does this change the memory used to hold their data? the library author does this at setup time. I am seeing empty service, which makes me wonder about memory allocation pool location/persistence edit: this was caused by calling Advertising->addServiceUUID() twice with the same UUID. but only having one service instance. removing the duplicate add and the remaining service shows all the characteristics.. |
here is the testcase https://github.com/sdetweil/testapp oops, you will see the duplicate addServiceUUID() problem |
Thanks for the test code. The cause is due to the OTA library creating the service and starting it in the begin call which calls into the stack to update services and the same happens when the client disconnects due to the service update. The fix is quite simple though, just disconnect the clients before starting the OTA service.
|
fabulous! will try asap..high school graduation this evening |
well, it gets rid of the crash.. but if you connect to the new 15xxxxxx service, there are two listed, both empty I added debug to the addServiceUUID() method() to see the count of entries in the m_serviceUUIDs list, and get 1
|
You have only removed the old services from the advertising. If you don't want to see them while connected you need to also remove them from the server. You should do that before the OTA service begin call. |
I don't care about that. the otaservice is duplicated and has no characteristics (see the updated pic above) its different built on my mac vs the intel laptop I used thursday/friday but its using the same platformio.ini |
i call to delete a service from the advertising list, but it doesn't get removed.
pServer->stopAdvertising();
to remove
pAdvertising->removeServiceUUID(activeService[!index]->getUUID());
pServer->removeService(activeService[!index], true); (or false, doesn't matter)
I see in the code
but the Arduino IDE vector doesn't have an erase method. I see remove
you don't ship a vector file.
I think I am advertising one service, but both are sent
my code does
both services are added..
if I remove the service-> start()
then I get an abort crash in NimBLEServer.start()
stack trace
so , it seems service->start() does something that is anti server/advertising add/removeService
in my case I can't have both services advertised concurrently, they are exclusive/toggle.
The text was updated successfully, but these errors were encountered: