Jumpstart : How to detect a BLE client connected ?

plusorc
Posts: 41
Joined: Sat Nov 09, 2019 6:27 am

Jumpstart : How to detect a BLE client connected ?

Postby plusorc » Sun Nov 10, 2019 9:52 am

Hello

I've been working with the jumpstart examples , and they are working very fine .
https://docs.espressif.com/projects/esp ... ction.html

The Problem I'm having now is I need to detect when a client(mobile phone) is connected to the GATT Server ,
Because the JumpStart Examples are based on

Code: Select all

wifi_provisioning/manager.h
I can't figure out a way to catch BLE server events while using this example .
I do need to follow WIFI Provisioning Manager route because it is compatible with Espressif's (IOS/Android) apps

Note:
I know the Examples of Demo GATT Server & Client, but I do need to use the
WIFI Provisioning Manager

Thanks

plusorc
Posts: 41
Joined: Sat Nov 09, 2019 6:27 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby plusorc » Thu Nov 14, 2019 8:11 pm

Can any one please help in that ?

ESP_Piyush
Posts: 310
Joined: Wed Feb 20, 2019 7:02 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby ESP_Piyush » Fri Nov 15, 2019 9:25 am

Hello,

We will check how the events which are currently being handled in esp-idf/components/protocomm/src/simple_ble/simple_ble.c can be exposed to applications. Meanwhile, what exactly is your use case?

plusorc
Posts: 41
Joined: Sat Nov 09, 2019 6:27 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby plusorc » Fri Nov 15, 2019 7:02 pm

Thank you

I was asked to make the BLE work for 1 to 2 min after each restart , "no reset button to reset the chip."
and if no mobile phone trying/connected and the chip is previously provisioned .. Stop the Provision and continue with
the current credentials

Now I can't make a BLE server from scratch for provisioning , the point is the WIFI_MGR is compatible with
Android/IOS applications by Esspressif , So no point of making a BLE server from scratch and risk breaking this compatibility

I fear that the chip is aware there is a client when we send credentials only
What I need is an event when checking the POP for instance , something to stop a count down timer

Thanks

ESP_Piyush
Posts: 310
Joined: Wed Feb 20, 2019 7:02 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby ESP_Piyush » Mon Nov 18, 2019 8:26 am

If you are using code from the example, then on boot up, if the device is already provisioned, it will not start the BLE, and instead connect to the network directly. However, for your other use wherein you want to have a time-out and the time-out should also check for "BLE client connectivity", then a callback would be required. The fastest solution for you right now would be to call your application defined event handler from gatts_profile_event_handler() function in components/protocomm/src/simple_ble/simple_ble.c file.

plusorc
Posts: 41
Joined: Sat Nov 09, 2019 6:27 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby plusorc » Wed Nov 20, 2019 8:11 am

Thanks for you help

I do use some code from the Examples but just as guidelines , I start the BLE manually and after a specific Time .. I should close it
if no mobile is connected/trying to connect .

The fastest solution for you right now would be to call your application defined event handler from gatts_profile_event_handler() function in components/protocomm/src/simple_ble/simple_ble.c file.
I'll look into that , hopefully I can figure it out
Thanks again .

plusorc
Posts: 41
Joined: Sat Nov 09, 2019 6:27 am

Re: Jumpstart : How to detect a BLE client connected ?

Postby plusorc » Mon Nov 25, 2019 12:31 am

Thank you so much ESP_Piyush

It only needed a bool value on Connected and Disconnected events and expose it in the simple_ble.h
I then included that header in the app and all is fine .
I didn't need to make a callback because I have a Task for measuring time already , so I can simply check for the value true or false.
all is working very well now .

Thanks again .

Who is online

Users browsing this forum: Bing [Bot], jimmy98035@gmail.com and 97 guests