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
Device name changes not reflected in connect to known device #541
Comments
Hi @GerryWilko, I'm the friendly issue checker. |
was this ever resolved???? |
Facing the same issue, but in iOS 16 version. |
@GerryWilko @sisaacks @tiwari-kajal Could anyone of you check whether PR #711 makes a difference for this issue? |
@janusw Thank you for your work. We do have the same problem and tested with nudget 3.0.0.rc.1 but it doesn't seems to solve this issue. Tested with:
Please note that this is not reproducible on Android I am just putting here our steps to reproduce this
The following would avoid this bug in our case
If you have any directions we are happy to help with test/debugging. |
Any particular reason you're testing with 3.0.0-rc.1 at this point, and not the final version 3.0.0? (The two are almost identical anyway, so it shouldn't make much difference ...) 3.1.0-beta.1 probably also behaves the same way, I assume?
It would be very helpful if you could test PR #711 and tell me whether it changes the behavior you're seeing. There is a nupkg generated as an artifact of the CI build. You can download this and set up a local folder as a package source in VS, in order to use it. |
@janusw Sorry, I miss understood your comment, I had impression that the 3.0.0-rc.1 includes the PR #711. I now added the 3.0.0-rc.1-2-ge03790e nuget locally but unfortunately the same behaviour persists. Just to be sure, I also cleared project before and also uninstall the app but no success. The same happens also with 3.1.0-beta.1. |
No, the PR has not been merged yet, thus it is not part of any release so far. Sorry if I was not clear about that.
Too bad. This means that PR #711 does not work. Thanks for checking, though. |
Actually I mentioned a second idea for fixing the problem in #703 (comment). I can create another experimental PR for this, hoping that you can test it, @baneageorge. |
Just my two cents but from my testing after raising this issue this actually appears to be an issue in CoreBluetooth. I found several issues with native stacks that seemed similar. There did not appear to be an easy way around it. LightBlue also seemed to suffer from the same issue for example. In the end we customised the firmware on the device to add a characteristic for the device name separate to the standard device service. I could then manually query this service for the device name. It appears that CoreBluetooth caches the device name and there doesn't seem to be a way to bust this without force quitting the application. Re-creating a CBManager doesn't work either. Unfortunately without being able to do something like what I did (Query some other charac to provide the same information you want from the device name), you may be out of luck. Thanks again for the fantastic work the maintainers are doing on this repo. |
Thanks for the comment, @GerryWilko. That's useful information. Nevertheless I now opened PR #792, in order to check the second clue we found. Based on @baneageorge's descripton in #541 (comment), I have some hope that this second PR might fix (or mitigate) the problem he describes. I'd be grateful if anyone of you guys could take this PR for a test drive and tell me whether it changes any of the behavior you observe. Possibly there might be multiple variants of similar or related issues lurking here ... |
Does the same problem also occur when using I think the problem may be due to the |
Thank you so much for this fantastic repo. I have been using it for many years throughout my University career it is really excellent!
The issue I am having is related to a scenario where a peripherals
Name
is changed in between when it was first seen by the stack and now.The following logs demonstrate the issue. The device was first seen as
InfiniTime
. Then I DFU it to my custom firmware. Its new name is then reflected asInfiniTime-295456
(serial number now included in the name). I then proceed to useConnectToKnownDevice
to connect to this peripheral. At which point theBLEDevice
'sName
is returned asInfiniTime
(last line in the incompatible exception). I use the name to determine compatibility for this particular device as it is difficult to otherwise test its compatibility.Unfortunately its difficult for me to provide a replication repo for this issue as you need to attempt this with a bluetooth peripheral that can change its name.
Steps to reproduce
Scan for a peripheral, don't connect just yet, observe the
device.Name
Change the name of the peripheral (on the peripheral itself, this may be hard to do on some peripherals). Observe that the peripheral advertisements are now showing the new name.
Connect to the peripheral using the ConnectToKnownDevice function.
Observe that the
device.Name
on the returned connected device is the old name not the new one.Restarting the application corrects this issue.
Expected behavior
I would expect the device returned after connection to be the latest peripheral not a cached one. Looking in Adapter.cs this seems bizarre as the peripheral is pulled out of the CBManager again each time unless I'm misreading it.
According to this issue the
peripheralDidUpdateName
will be fired when the name changes but this seems irrelevant as the peripheral is not connected during the name change. The DFU process is also not even using the Plugin.BLE stack so its not like its some weird instance based cache or something.Actual behavior
Peripheral
device.Name
is not reflecting new device name.Configuration
Version of the Plugin: 2.1.2
Platform: iOS 15
Device: iPhone 12 Pro
If anyone has any ideas or some pointers that might set me on the right path that would be great. I'm happy to raise a PR but debugging the stack my side I can't see what's wrong. It just seems that the
CBPeripheral
is wrong.The text was updated successfully, but these errors were encountered: