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
characteristic for Notification (subscribeToCharacteristic) not working on iOS #95
Comments
Hi, @andrewknockin. Your ticket is pretty informative, but you could use the standard issue template to resolve some typical questions immediately. Unfortunately, your You should only start interacting with a device (subscribing to, reading from, writing to characteristics) after the stream returned by one of the functions establishing a connection reports "connected" status. Apart from that, you may want to use |
@andrewknockin I agree with the remarks of @werediver .Some additions: I would advise to scan for around at least 2 seconds on Android since we re using an aggressive way of scanning this should be sufficient. If the user is in an area with a lot of bluetooth devices (e.g. lights, headset and laptops) it can take a bit longer before the device is discovered, that's why 1 second is not always sufficient. I also would increase the connection timeout to let's say 8 seconds. Some Android devices take some time to connect but feel free to use your own judgement there. |
Thanks for the advice @werediver and @remonh87. I also extended the discovery times, and I have distinguished between Android and iOS using: |
@andrewknockin For relatively rare writes there must be no problems or differences. |
I have flutter code (laone) using flutter_reactive_ble v2.4.0 which works for Android 9 but raises an exception for iOS. The code allows the selection of a single device from a list of found devices, then when Connect is clicked for that device, it should connect and send some initial data requests, which are then received using a subscribeToCharacteristic method and processed.
On iOS, the exception seems to be due to the subscribeToCharacteristic failing because no trace of the incoming replies is found.
Since the flutter code works on Android, and I can communicate with the device using the iOS app Blue Chat, which also uses a characteristic subscription, the remote server responses seem valid. In the server log, I can see the initial data requests (10 of them) being received and replied to, so the iOS connection is made and the transmit aspect of flutter_reactive_ble is working on iOS.
I have tried with the rxUuid in both long form and 32 bit short form, as suggested in #76.
The connection code is:
For the working Android code, the console shows:
where the I/flutter lines are debug messages and the lower set show the responses being received from the first 3 of the 10 commands, and then processed, with the final line showing the 4th response being received.
The iOS log shows the same first 7 log lines and then the exception. I do not recognise the Uuid it claims is unknown in the final log line.
The text was updated successfully, but these errors were encountered: