rxandroidble

Read multiple characteristics from an Android device using library RxAndroidBle

。_饼干妹妹 提交于 2019-12-13 03:48:10
问题 I am using the library RxAndroidBle in order to scan devices and then connect to one specific device and read 4 GATT characteristics. I can read one characteristic (Battery Level) ith this code : scanSubscription = rxBleClient.scanBleDevices( new ScanSettings.Builder() .build() ) .observeOn(AndroidSchedulers.mainThread()) .doOnNext( scanResult -> { if(scanResult.getBleDevice().getName() != null){ if(scanResult.getBleDevice().getName().equals("NODE 1")){ Log.e("BLE SCAN", "SUCCESS"); Log.e(

How do I effectively read temperature from two BLE devices at the same time?

萝らか妹 提交于 2019-12-12 16:38:04
问题 First of all, I am using RxAndroidBLE library to manage my BLE connections. I have two SensorTag devices and I want to read temperature from both at the same time. For example, I'd like to read the temperature from both devices exactly every 500ms and display it to user in two TextViews. My app currently successfully connects to both BLE devices like this: @OnClick(R.id.connectButton1) public void connectFirstSensorTag(Button b) { if (!isDeviceConnected(sensorTag1)) { connectionObservable1 =

RxAndroidBle: Setup notification, write on characteristic and wait for notification to proceed

狂风中的少年 提交于 2019-12-11 17:09:41
问题 I am using Polidea's RxAndroidBle library to communicate with a Device in my Android application. I am very new to Reactive Programming so I can't figure out exactly how to do the following: Setup Notification in one characteristic (Characteristic A). When notification setup is done, write to another characteristic (Characteristic B). This will trigger a Notification coming from Characteristic A. When the write operation is done, wait for the arrival of the Notification in Characteristic A.

RxAndroidBle - Auto connect issue

拈花ヽ惹草 提交于 2019-12-11 09:48:00
问题 I am using RxAndroidBle library: This code is working fine as expected, on click of Connect button on UI, it establishes connection. Issue coming up when I wanted the auto-connect to the device when the device comes back to range. I don’t want to click on Connect button again. is there any functionality exists like that ? does ’true’ flag helps me here, if yes, how to implement it ? Suggestion please. rxBleDevice.establishConnection(true); If I use rxBleDevice.establishConnection(true) ,

BLE different MTU for different implementations

懵懂的女人 提交于 2019-12-11 06:58:01
问题 I have tried different implementations of BLE connection on Android. One with RxAndroidBle and another one with simple Android API. I used RxAndroidBle example app for testing. I connect to the same peripheral with the same service and characteristic. Though when I read or get notifications from it in the case of RxAndroidBle I receive 512 bytes and in the case of Android API - just 20. I try to request MTU 512 but onMtuChanged is never called and I still receive 20. Do I miss something? 来源:

Is there any way to uniquely identify BLE device?

醉酒当歌 提交于 2019-12-11 06:49:54
问题 I want to store information about BLE device locally, but I cannot rely on MAC address because it changes too often. Is there any way to do that? 回答1: The Bluetooth address is the best way you can distinguish between devices. This is mentioned in the Bluetooth specification as follows [1]: Devices are identified using a device address. Device addresses may be either a public device address or a random device address. A public device address and a random device address are both 48 bits in

No notification data in Write/Notification set-up

最后都变了- 提交于 2019-12-11 06:32:41
问题 After doing my best to understand all the magic in RxJava and the excellent rxandrodible library I'm stuck! The last thing that I need to fix is to setup a write/Notification link in which I write a value - a single value - and after that subscribe to a specific characteristic. I've used the following code - as considered best practice (?) - but it doesen't actually result in any data on the soundTV. connectionSubscription = device.establishConnection(false) .flatMap( // when the connection

How to correctly use UUID.fromString method?

馋奶兔 提交于 2019-12-06 09:48:31
I am trying to read/write these ble characteristics: Right now, I'm trying to read AA01* I am using this library to do it. Here's my code: private void connectToSensorTag(RxBleDevice rxBleDevice) { rxBleDevice.establishConnection(getApplicationContext(), false) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable throwable) { int i = 0; } }) .flatMap(rxBleConnection -> rxBleConnection.readCharacteristic(UUID.fromString("AA01*"))) .subscribe(new Subscriber<byte[]>() { @Override public void onCompleted() { int i = 0; } @Override public void onError(Throwable e) { int i = 0;

How to receive all notifications in RxAndroidBle

蓝咒 提交于 2019-12-05 21:45:05
I'm trying to communicate with a BLE data logger/sensor using rxBleAndroid running on both an Android phone as well as the Raspberry Pi using Android Things. I'm currently having an issue, however, where up to about 5 of the first notifications are never received by my app. I have verified that the BLE device is actually successfully sending all the expected notifications. I have done that through the nRF Connect app and everything works as expected through there. When I do it through the nRF Connect app, these are the steps I take: Write to password characteristic to unlock device Write to

Combining timeout() with retryWhen()

馋奶兔 提交于 2019-12-05 08:24:43
I'm creating a simple app for connecting with the bluetooth devices using RxAndroidBle library (Cheers Guys for great work!). What I'm experiencing is sometimes when I connect to the device I receive the Gatt error with status 133. I know it may happen so what I want to do is retry everything when that error occurs. It's not a problem, I can easily do that with retryWhen() operator, however I have another requirement - the stream has to terminate after 30 seconds if the connection wasn't successful. I used timeout() for that, but the problem is that when I do retry, the timer starts again. So