Replies: 2 comments 5 replies
-
@atauf the connectToDevice provides a stream of connection updates. You can decide to listen to this Stream and only execute operations when you get the |
Beta Was this translation helpful? Give feedback.
-
@remonh87 Is there any reason why I shouldn't be able to loop through a list of deviceIds and successfully execute .disconnect(deviceId) on each of them? I'm currently trying to do it and it only disconnects from one of them. It won't disconnect from the rest. |
Beta Was this translation helpful? Give feedback.
-
This question slightly piggy backs #319, in that, I believe it's only a noticeable issue because the advertisement rate is so slow.
I'd like to know how to implement a wait in the program until a connection is actually made. I'm using writeToCharacteristicWithoutResponse because the devices I'm connecting to don't give a response.
I've wrapped the writeToCharacteristicWithoutResponse function with a function that will produce a response (though I'm not sure if it's done the best way or not), but either way, I've added a response.
I basically have a loop that iterates through a list of device ids and is supposed to connect, load some parameters via multiple writeToCharacteristicWithoutResponse calls, and then disconnects.
code: (note, this is in the onPressed section of an IconButton)
The problem that I'm running into is that by the time the first device actually connects, the loop has already moved through all the device ids in the list.
I'd like to know how to actually make it wait for each process to complete.
NOTE: I'm using async/await for all of these futures
Other Mentions: I'm starting the loop from a scanning and/or disconnected state (that's why I connect and disconnect for each).
Thanks for any help, and let me know if I can provide any other info.
Beta Was this translation helpful? Give feedback.
All reactions