Android-BLE-Library icon indicating copy to clipboard operation
Android-BLE-Library copied to clipboard

Add option to prioritise requests in the queue

Open jiajunhui opened this issue 3 years ago • 6 comments

Is there a way to get the length of the current queue and whether there is a way to jump the queue? For example, I want to improve the priority of some commands.

jiajunhui avatar Feb 25 '22 09:02 jiajunhui

Hello, in the current version you may only clear the queue using https://github.com/NordicSemiconductor/Android-BLE-Library/blob/5f340654329ec1fd4878ba9ee34c8087ba910116/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java#L1980

philips77 avatar Mar 16 '22 10:03 philips77

Hello,

I'm thinking of a method to enqueue to the front of the queue. Would that help you? Modification of the order of the already enqueued packets seems dangerous.

philips77 avatar Mar 21 '22 20:03 philips77

Related: #218

philips77 avatar Mar 21 '22 21:03 philips77

I was thinking about the feature request. Adding something like enqueueFirst() would also imply adding similar methods with await() and suspend() in the ktx module, but some issues may arise there. Let's say someone is using suspend() methods, which end when the request end. If a user then calls suspendFirst() or alike, the manager could have already taken next request. I'll need to think more about it.

philips77 avatar Mar 21 '22 22:03 philips77

This is very useful to me, is there any development plan for this feature now?

LuoPeiQin avatar Sep 15 '22 10:09 LuoPeiQin

Currently not. May I ask why do you need this method? What is the use case. We may consider changing priorities.

philips77 avatar Sep 16 '22 06:09 philips77