ATBLC1000 : Auto-connecting to Android/Iphone device

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everybody. I am currently programming on a ATBLC1000 MR110CA, and I am trying to find examples of code where we auto connect to an Android/Iphone device.

To be more explicit, I want the chip to be able to connect when the device is in range, if he already was appeared, and without any thrid party app on the phone. I know this is possible in bluetooth (I have speakers that do such a thing), but I don't know about BLE.

Thanks, Luc

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Luc-- wrote:
I know this is possible in bluetooth (I have speakers that do such a thing)

That's because the OS itself knows about "Bluetooth speakers" and does it internally - as a "service"

 

So, to do the same on BLE, your device would either have to appear as a device that the OS knows about & has a "service" for - or you'd have to provide the Service yourself

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
a device that the OS knows about & has a "service" for

I think HID would be an example?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The re-connection to be initiated by the Central node(Android/iOs mobile in your case), when the Central gets the advertisement packets from the same (disconnected) device. When the peripheral (BTLC1000) is disconnected and in the disconnect handler if the advertisment is started again then the re-connection should happen if at all the Central initiating the connection again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok thanks for those answers.

 

Awneil : do you mean that there is some kind of part of the bluetooth frame that explicitely tells that it's a speaker (or any other known device) ? And that I should try to mimic a know device so it's recognized by my android ?
 

Meeko_percii : Ok I see, but this has to happen in an app. I already manage to do that, but is it possible to do it if the app is killed ?

 

I actually don't need to reconnect, I just need to detect if the phone device is in range or not. But I'm not sure it's possible, because it doesn't broadcast advertisement packets all the time (right ?).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The advertisement timeout is passed as a parameter when the at_ble_adv_start() is called. As per description, "Advertising time-out between 0x0001 and 0x3FFF in seconds, 0x0000 disables time-out."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Luc-- wrote:
do you mean that there is some kind of part of the bluetooth frame that explicitly tells that it's a speaker (or any other known device) ?

Yes - much like USB "enumerates" so that the host knows what type of device  (or "Class", in USB speak) it is.

 

In BLE, this is done by GATT

 

https://developer.bluetooth.org/...

 

https://learn.adafruit.com/intro...

 

https://devzone.nordicsemi.com/t...

 

I should try to mimic a know device so it's recognized by my android ?

Exactly.

 

 

 

I just need to detect if the phone device is in range or not.

You can't do that without connecting!

 

All your peripheral does is send out Advertising packets - the phone sees those packets, and will only respond in order to connect.

 

 

it doesn't broadcast advertisement packets all the time

Which "it" are you talking about - the phone, or your device?

 

  • The phone never sends out advertisement packets;
  • Your device sends out advertisement packets all the time that it is advertising - and that is entirely under your control.