Hi All !
I am using esp32-c3 / Esp32 esp-idf . The example i am using is gatt_server. I am sending the eddystone beacon messages (fixed packet) to andriod app using gatt server app .
My question is that , how can we send a sensor data ( which is changing ) using gatt server app . Means , i want to send every time a new value (eddystone beacon message ) to andriod app .Thanks in advance .
Thanks
Best Regard,
esp32 gatt server sensor data reading
-
- Posts: 28
- Joined: Tue Mar 23, 2021 10:44 am
Re: esp32 gatt server sensor data reading
You have to update eddystone packet with new values each time, then set new advertising data and re-start advertising.
-
- Posts: 28
- Joined: Tue Mar 23, 2021 10:44 am
Re: esp32 gatt server sensor data reading
Hi !
Thank You for the quick response . I am new to esp-idf . I have found the stop function . And i implemented like that .
////////////////////////////////////////////////////////////////////////////////////////////
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
switch (event) {
#ifdef CONFIG_SET_RAW_ADV_DATA
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
adv_config_done &= (~adv_config_flag);
if (adv_config_done==0){
esp_ble_gap_start_advertising(&adv_params);
raw_adv_data[25]=0x55;
int32_t esp_err_t = esp_ble_gap_stop_advertising();
}
/* else if (adv_config_done==1){
esp_ble_gap_start_advertising(&adv_params);
raw_adv_data[25]=0xAA;
int32_t esp_err_t = esp_ble_gap_stop_advertising();
}*/
break;
/////////////////////////////////////////////////////////////////////////////////
Can you help me in this regard ? that what is the program flow sequence? so that on every new iteration, i can change the values .
Again thanks !
Thank You for the quick response . I am new to esp-idf . I have found the stop function . And i implemented like that .
////////////////////////////////////////////////////////////////////////////////////////////
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
switch (event) {
#ifdef CONFIG_SET_RAW_ADV_DATA
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
adv_config_done &= (~adv_config_flag);
if (adv_config_done==0){
esp_ble_gap_start_advertising(&adv_params);
raw_adv_data[25]=0x55;
int32_t esp_err_t = esp_ble_gap_stop_advertising();
}
/* else if (adv_config_done==1){
esp_ble_gap_start_advertising(&adv_params);
raw_adv_data[25]=0xAA;
int32_t esp_err_t = esp_ble_gap_stop_advertising();
}*/
break;
/////////////////////////////////////////////////////////////////////////////////
Can you help me in this regard ? that what is the program flow sequence? so that on every new iteration, i can change the values .
Again thanks !
-
- Posts: 28
- Joined: Tue Mar 23, 2021 10:44 am
Re: esp32 gatt server sensor data reading
Hi
Thank you ! it is done by using the timer . Using XtaskCreate();
Again Thank You !
Thank you ! it is done by using the timer . Using XtaskCreate();
Again Thank You !
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 157 guests