Comments (10)
Thank you for the suggestion. We will considerate it. Unfortunately we're currently occupied with different things.
You're always welcome to make a Pull Request. :)
from rxandroidble.
This refresh
may be the last resort for problems like #49.
from rxandroidble.
This refresh is essential for any kind of function that involve change of characteristic during reconnection. I believe the framework can be much more powerful if "refresh" is supported
from rxandroidble.
@s1155030742 I did not had a need for using the refresh function. Could you describe or paste link to a place where the usage is described? Should the method be called when the connection is active/disconnected/closed? What exactly the method does?
from rxandroidble.
Use of this method is discussed here: http://stackoverflow.com/questions/22596951/how-to-programmatically-force-bluetooth-low-energy-service-discovery-on-android
Basically, some phones cache the list of services and characteristics between connections. So if the device has changed it's services or characteristics since you last connected, you can have fatal errors. The refresh() method will clear the phone's cached list.
Based on the code samples and how I understand that it works, I think refresh() would have to be called after connection but before service discovery starts.
I just got bit by this this morning, connections are failing left and right. Is there a way to get hold of the native BluetoothGatt so I can implement the fix described in the Stack Overflow until this feature can be implemented?
from rxandroidble.
@kenwdelong You could try to use <T> Observable<T> queue(RxBleRadioOperationCustom<T> operation);
function.
from rxandroidble.
Yes! Thank you!
from rxandroidble.
To all interested people:
What is the supposed scenario for calling BluetoothGatt.refresh()
?
- Call it at the beginning of the connection
- Call it in the middle of the connection
- Call it at the end of the connection
The last option looks to be the most bulletproof in terms of implementation. The first one seems also to be doable and should not require a big amount of work. The second does look like a pain to implement as some Observable
s that could have beed created / subscribed before refreshing could stop working properly.
Any information about the use-cases for this is valuable! :)
from rxandroidble.
Hi all, just ran into this problem now! The bluetooth connection on my device disables and I cannot re-enable it unless I flush the data/cache of the bluetooth process. The only way to do this is to call BluetoothGatt.refresh();
Problem 1. Bluetooth is currently disabled and I need to be able to run the refresh method first (because I don't have a valid connection)
Regarding best scenario for calling BluetoothGatt.refresh(), I would personally prefer at the beginning of the connection.
Reasoning: It's the only predictable place where I can reliably call it.
from rxandroidble.
For us, our device can be in normal "application" mode or in "dfu" (direct firmware upgrade) mode. In dfu mode, the list of services and characteristics is a subset (generally) of what's available in application mode. So, for example, if the device is scanned in dfu mode, and the phone caches the results of service discovery, then even if the device has returned to application mode it can't be accessed because the phone does not believe that the required characteristics exist (and vice versa).
I really don't know when is the best time to refresh. Just after connecting and before service discovery, or just before or after connecting. I doubt that refreshing in the middle of the connection is a good idea.
The Nordic DFU Upgrade library, I think, disconnects but then before it releases the BluetoothGatt object it invokes the refresh() function. That's probably a pretty safe option.
from rxandroidble.
Related Issues (20)
- It is not possible to disconnect the Bluetooth while it is in the process of connecting. HOT 1
- BleGattCharacteristicException while readCharacteristic HOT 12
- scanResult.bleDevice.name not showing Ble updated name HOT 1
- BLUETOOTH_SCAN set usesPermissionFlags="neverForLocation",Is there a problem? HOT 2
- GenericFailure<CharacteristicValueUpdateError> HOT 11
- Send long bytes twice HOT 2
- Write request is not processed in the random order HOT 2
- Long Bytes Send HOT 8
- Creating a Fork HOT 2
- Set Preferred PHY / Read PHY HOT 2
- RxBleClient mulit connections HOT 4
- Is the library still maintained? HOT 3
- Android 14 breaking change HOT 15
- Google Pixel 5 loses bonding info after BT adapter cycle HOT 4
- Metode readcharacteristic not stream HOT 2
- Unable to readCharacteristic after writeCharacteristic HOT 5
- In the case of unsuccessful Bluetooth connection, actively disconnect without executing context. unregisterReceiver (receiver); At this point, there may be multiple Bluetooth broadcast registrarReceivers, which may crash on some Huawei phones due to a broadcast limit of approximately 1000. Suggest fixing this issue. HOT 2
- Can't scan after connect dispose/clear HOT 1
- Add `advertisingSid` property to `ScanResult` and `RxBleInternalScanResult` HOT 3
- BleGattCallbackTimeoutException when writing a characteristic with different data payload many times in a short period of time. HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxandroidble.