0

I have a BLE device (Arduino chip) which I connect to an Android app I've built. I can send and receive data normally and maintain the connection pretty good.

However I found a bug which I do not know how to solve or why it appear.

When the BLE device goes out of range from the phone it disconnects (which is normally because of the distance) and no data can be transferred between the device and the phone, but when the device comes back in range for the phone it kind of connect again BUT:

The phone can only send data through:

mBluetoothLeService.writeCharacteristic(characteristic);

and the Arduino chip receives the data. But when I try to send data from the Arduino chip to the phone, the phone does not receive any data.

So in summary:

  1. Phone and Arduino BLE device connects
  2. Arduino BLE device goes out of range, connection is lost
  3. Arduino BLE device goes back in range, connection is established again
  4. Arduino can receive data from the phone, but the phone can not receive data from the Arduino.

Any one got a clue why this could be?

Andreas Rolén
  • 508
  • 5
  • 15
  • Are these devices paired? – Doppie Jun 07 '16 at 12:20
  • @Doppie I don't think so no! – Andreas Rolén Jun 07 '16 at 12:30
  • What I am missing here: who is the initiator of the connection, device or phone? – Doppie Jun 07 '16 at 14:42
  • @Doppie Sorry! The initiator is the phone. So I search on the phone for BLE devices, then connect to the Arduino chip. Was that what you wondered? (Sorry for being a bit noobish on this, just started to work with BLE) – Andreas Rolén Jun 07 '16 at 14:54
  • How do you send data from your BLE peripheral? Do you use notifications? If so you need to both write to the corresponding descriptor that tells the device to send notifications but also enable notifications on the Android side (see Android API docs). – Emil Jun 07 '16 at 21:59

0 Answers0