Author Topic: Send some data just after get connected  (Read 1882 times)

lopesjeronimo

  • RFduino Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
    • DPTR
Send some data just after get connected
« on: July 24, 2014, 03:23:21 PM »
Hi, I was trying to make some tests with RFduino android example, using a Nexus 4 phone.

I was trying to send some data immediately after get connected. So I inserted a call to 'send' method at the BroadcastReceiver that detects a successful connection.

First thing I need to do is insert a small delay, I just used a handler to execute (send the data) 200ms after connection. It worked. But sometimes data is not send do RFduino. I notice that this is much more common if the android phone is not to close to the RFduino. Actually, about 1m range this doesn't happen at all.

I also notice that when this happen, I got that logcat msg, from android system, not from the app:
bt-btif: already has a pending command!!

Have anyone seen something like that before?

lopesjeronimo

  • RFduino Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
    • DPTR
Re: Send some data just after get connected
« Reply #1 on: July 30, 2014, 01:42:14 PM »
Ok, I just figure out myself...

At the example, at "onServicesDiscovered()" of BluetoothGattCallback, a broadcast is made to detect connected state, but also a "writeDescriptor" method is called... I just override the "onDescriptorWrite" method, and called the broadcast inside that...

It sounds confusing, but I'm sending a patch to original code.

I had a lot of trouble in the past using android Rfconn api, I hope BLE doesn't give me head-aches. I'll be happy to trade some experiences with anyone doing android apps to interact with RFduino with very little users iterations, I mean not apps that user press scan, than user press connect, than user press send, etc., but all this operations done automatically and/or at background.

vibzz

  • RFduino Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Send some data just after get connected
« Reply #2 on: August 10, 2016, 07:41:45 PM »
Hey Lopez, I am working on a similar app.

The thing that is still not clear to me is that once the data is transmitted using the RFduinoBLE.Send() function i am not sure what GATT characteristic can be used to pick that data on the android device.

 

anything