Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 28 15:36

    dariuszseweryn on dagger

    Improved DeviceComponent and De… (compare)

  • Jan 28 15:21

    dariuszseweryn on dagger

    Improved ClientComponent and Cl… Improved DeviceComponent and De… (compare)

  • Jan 28 15:10

    dariuszseweryn on dagger

    Merged DeviceModuleBinder with … (compare)

  • Jan 28 15:09

    dariuszseweryn on dagger

    Merged ClientModuleBinder with … (compare)

  • Jan 24 15:01
    Steppschuh closed #536
  • Jan 23 19:14
    dariuszseweryn edited #534
  • Jan 22 11:55
    Steppschuh opened #536
  • Jan 20 22:46
    lukaszkalnik opened #535
  • Jan 20 19:53
    mohank1288 opened #534
  • Jan 20 13:14
    lukaszkalnik edited #528
  • Jan 19 22:33
    lukaszkalnik edited #528
  • Jan 19 22:32
    lukaszkalnik edited #528
  • Jan 19 22:32
    lukaszkalnik synchronize #528
  • Jan 19 15:39
    lukaszkalnik closed #531
  • Jan 19 15:39
    lukaszkalnik synchronize #528
  • Jan 18 17:27

    dariuszseweryn on dagger

    Improved DeviceComponent and De… (compare)

  • Jan 18 17:22

    dariuszseweryn on dagger

    Improved ClientComponent and Cl… (compare)

  • Jan 18 17:21

    dariuszseweryn on dagger

    Bumped dagger version to 2.21 (compare)

  • Jan 18 16:23
    dariuszseweryn closed #510
  • Jan 18 16:21

    dariuszseweryn on master

    Added sample application in kot… (compare)

Ari Lacenski
@tensory
Something like this:
2019-05-28 17:02:43.233 30377-30511/com.xxx.debug D/BluetoothGatt: unregisterApp() - mClientIf=7
2019-05-28 17:02:43.240 30377-30377/com.xxx.debug E/Error: Failed to write to characteristic.
    com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from FF:B3:F6:00:81:50 with status 8 (GATT_INSUF_AUTHORIZATION)
        at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:77)
        at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:262)
        at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:770)
        at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:39)
        at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:257)
        at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:71)
        at android.os.Binder.execTransact(Binder.java:731)
2019-05-28 17:02:52.223 20076-20334/? I/bt_stack: [INFO:gatt_api.cc(1109)] GATT_Connectgatt_if=2 ff:b3:f6:00:81:50
2019-05-28 17:03:22.227 20076-20334/? W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=3 connected=0 conn_id=0x0003 reason=0x0100
2019-05-28 17:03:22.228 20076-20334/? W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=4 connected=0 conn_id=0x0004 reason=0x0100
2019-05-28 17:03:22.228 20076-20334/? W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=5 connected=0 conn_id=0x0005 reason=0x0100
2019-05-28 17:03:22.228 20076-20334/? W/bt_stack: [WARNING:bta_gattc_act.cc(1040)] bta_gattc_conn_cback: cif=6 connected=0 conn_id=0x0006 reason=0x0100
2019-05-28 17:03:22.231 20076-20334/? I/bt_stack: [INFO:gatt_api.cc(1109)] GATT_Connectgatt_if=3 ff:b3:f6:00:81:50
2019-05-28 17:03:45.168 20076-20334/? I/bt_stack: [INFO:gatt_api.cc(948)] GATT_Register 8a132d39-efa7-20eb-fa0b-a0de78580ff2
2019-05-28 17:03:45.168 20076-20334/? I/bt_stack: [INFO:gatt_api.cc(968)] allocated gatt_if=7
I have a sense of why the GATT_INSUF_AUTHORIZATION may be happening, so I'm not asking about that. Just, how come it seems like the phone is trying to reconnect (and maybe succeeding?) This is a Google Pixel 1 if that's at all related.
Dariusz Seweryn
@dariuszseweryn
Android as a Gatt Server
Ari Lacenski
@tensory
I'm unclear on what I might be doing to designate the phone as a server. I just want to use rxBleDevice.establishConnection, and I see stuff like that when it disconnects with either error code 8 or 133.
Ari Lacenski
@tensory
I solved my problem above, no longer an issue.
Dariusz Seweryn
@dariuszseweryn
Care to share the solution?
Dariusz Seweryn
@dariuszseweryn
@tensory
Viktor Eriksson
@vikeri
Does anyone know if there's a solution to getting a connection from an already connected device? If the device was connected through the Android BLE settings then I can't connect to it in the app. I get connect error: com.polidea.rxandroidble2.exceptions.BleAlreadyConnectedException which would have been helpful if I already had a connection in my app but since it's another app that connected it doesn't help me much.
Dariusz Seweryn
@dariuszseweryn
You have the connection established through RxAndroidBle in your app, you can check it in RxBleDeviceImpl
Ilija Vucetic
@ivucetic
Hi all. Can you explain to me how I can use RxBle with secure conncetion? And how I can now if Ble connection is secure?
Dariusz Seweryn
@dariuszseweryn
Check if device has bonded and if the characteristics you use are encrypted
RobLewis
@RobLewis
I don't know what, if any, relevance this has to RxAndroidBle, but here are "4 Tips to Make Android BLE Actuallly Work" from a company that seems to be pretty competent in Bluetooth: https://punchthrough.com/android-ble-development-tips/
Martin WIRTH
@martiwi
Hi there, is there a way using the RxBleConnectionMock to change values returned before it is actually being returned to the subscriber?
Dariusz Seweryn
@dariuszseweryn
@RobLewis Thanks for the link! I know some of this company's articles but have not seen this one. I agree with most of the points
@martiwi Currently mocking feature is static (and not supported tbh)
Martin WIRTH
@martiwi
ok thanks @dariuszseweryn , I will work by mocking RxBleConnection interface though.
kalpeshSprybit
@kalpeshSprybit
hi there , is there any way to connect ble device long time using this library?
Dariusz Seweryn
@dariuszseweryn
What do you have in mind saying "long time"?
kalpeshSprybit
@kalpeshSprybit
establish one connection with ble device until app close
Dariusz Seweryn
@dariuszseweryn
to keep it until app close?
Yes, it is possible
kalpeshSprybit
@kalpeshSprybit
can u please give me a one example
Dariusz Seweryn
@dariuszseweryn
do not keep the connection logic in your activity
.establishConnection() should be subscribed as long as you want to keep the connection
kalpeshSprybit
@kalpeshSprybit
but right now I established a connection with Device it was automatically disconnected within 2 sec
Dariusz Seweryn
@dariuszseweryn
with an error?
kalpeshSprybit
@kalpeshSprybit
No
Dariusz Seweryn
@dariuszseweryn
if there was no error then you have to dispose the observable subscription yourself
if there is no error and you do not dispose the observable subscription yourself then the connection will stay opened
kalpeshSprybit
@kalpeshSprybit
ok thank you @dariuszseweryn
kalpeshSprybit
@kalpeshSprybit
is that possible to read and write multiple value from device? @dariuszseweryn
kalpeshSprybit
@kalpeshSprybit
nd what if device already connected , how to read value from it @dariuszseweryn
Dariusz Seweryn
@dariuszseweryn
See readme and examples
kalpeshSprybit
@kalpeshSprybit
W/RxBle#ConnectionOperationQueue: Queue's awaitRelease() has been interrupted abruptly while it wasn't released by the release() method.
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at com.polidea.rxandroidble2.internal.serialization.QueueSemaphore.awaitRelease(QueueSemaphore.java:15)
at com.polidea.rxandroidble2.internal.serialization.ConnectionOperationQueueImpl$1.run(ConnectionOperationQueueImpl.java:74)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:459)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
READ ERROR: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='20:81:9A:19:3E:41' with status 0 (GATT_SUCCESS)
device auto disconnected when I was trying to read the value @dariuszseweryn
Dariusz Seweryn
@dariuszseweryn
Ask device firmware developer what they have implemented
Maybe bond is a must have, dunno
Developer
@mediaController
What is the best way to start listening to notifications, and then write to a characteristic that triggers those notifications to start? Writing to the trigger char and then subscribing seems like it could be prone to race conditions where you may recieve the response before the notifications subscription has been set up...

Also, what is the return value bytearray of the writeCharacteristic() method supposed to be?

I see the docs say:
@return Observable emitting characteristic value after write or an error in case of failure.

Does this mean that the observable is performing a read of the characteristic to ensure that it was written?

Dariusz Seweryn
@dariuszseweryn

Does this mean that the observable is performing a read of the characteristic to ensure that it was written?

No — this value will most probably be the same that you have written

Developer
@mediaController
when would it be different?
Dariusz Seweryn
@dariuszseweryn
If the same characteristic will notify in between starting a write and write being finished
Developer
@mediaController
oh, so its essentially handing back whatever the locally cached value of the char is immediately following the completion of the write?
Dariusz Seweryn
@dariuszseweryn

What is the best way to start listening to notifications, and then write to a characteristic that triggers those notifications to start? Writing to the trigger char and then subscribing seems like it could be prone to race conditions where you may recieve the response before the notifications subscription has been set up...

That is why .setupNotifications() returns Observable<Observable<byte[]>> — Readme says that the Observable<byte[]> is emitted after the notifications are set up

oh, so its essentially handing back whatever the locally cached value of the char is immediately following the completion of the write?

yes

Developer
@mediaController

Does this mean that the observable is performing a read of the characteristic to ensure that it was written?

No — this value will most probably be the same that you have written

Is there a practical reason why this is the case?
Is it useful for some common BLE use case?

or is it more of a convention to keep the return types for these operations the same so combining read/write/notify observables with merge and similar combinators easier?

i notice many of the examples you post on stackoverflow combine these operators and put .ignoreElement() on the end of writes
Dariusz Seweryn
@dariuszseweryn
Legacy reason. There was no Completable type at the time of writing the API. Additionally "reliable writes" could return values but I haven't seen it in practice
Developer
@mediaController
oh, that makes sense. I only came to RxJava when version 2 was released, so its sometimes confusing to see answers circa RxJava1 suggesting things that dont seem idiomatic nowadays.
Thanks for your time Dariusz