gatt_server modify advertising device name problem

caetanowagner
Posts: 4
Joined: Sat May 04, 2019 8:28 pm

gatt_server modify advertising device name problem

Postby caetanowagner » Sun May 05, 2019 3:51 am

Hello everyone,
I'm using esp-idf 3.2 and gatt_server example (https://github.com/espressif/esp-idf/tr ... att_server) and MacOS High Sierra 10.13.6
I'm learning about bluetooth and testing services and characteristics.
I've modified these lines

Code: Select all

#define TEST_DEVICE_NAME            "ESP_GATTS_DEMO"
#define TEST_MANUFACTURER_DATA_LEN  17
to

Code: Select all

#define TEST_DEVICE_NAME            "SOFTAGILE"
#define TEST_MANUFACTURER_DATA_LEN  12
in gatts_demo.c file. After flash esp32 board I was able to scan, find and to connect to SOFTAGILE as a device, from my mobile using nRF Connect app. I've been using this for while, since last night it gets back the device name as ESP_GATTS_DEMO even with these lines as

Code: Select all

#define TEST_DEVICE_NAME            "SOFTAGILE"
#define TEST_MANUFACTURER_DATA_LEN  12
I tried to flash another project, blinky (https://github.com/espressif/esp-idf/tr ... rted/blink) and then flash the modified gatt_server again.
Erased all flash and flash again my modified gatt_server
In both I got wrong advertising name as ESP_GATTS_DEMO even with the lines as

Code: Select all

#define TEST_DEVICE_NAME            "SOFTAGILE"
#define TEST_MANUFACTURER_DATA_LEN  12
Then I included *ESP_LOGI lines

Code: Select all

esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
*ESP_LOGI(GATTS_TAG, "Device Name: %s", TEST_DEVICE_NAME);
ret = esp_bt_controller_init(&bt_cfg);
ret = esp_bt_controller_enable(ESP_BT_MODE_BLE);
ret = esp_bluedroid_init();
ret = esp_bluedroid_enable();
*ESP_LOGI(GATTS_TAG, "Device Name: %s", TEST_DEVICE_NAME);
ret = esp_ble_gatts_register_callback(gatts_event_handler);
these LOGI lines returns the name SOFTAGILE through uart via terminal as expected.
In nRF Connect app Gatt
nRFConnect ESP32 gatts_server.jpeg
nRFConnect ESP32 gatts_server.jpeg (63.51 KiB) Viewed 2992 times
I didn't find somewhere else I could modify device name.

Why is it still advertising as ESP_GATTS_DEMO?
I don't know if I'm doing something wrong but seems to be an abnormal behaviour.
All others functions working normally
Advertising and connect bluetooth
Receive char "A" and execute a task to lit the led for 5 seconds
execute a random number generation for each 'write' I do in nRF Connect app.

I'm glad if someone could help.

caetanowagner
Posts: 4
Joined: Sat May 04, 2019 8:28 pm

Re: gatt_server modify advertising device name problem

Postby caetanowagner » Sun May 05, 2019 7:39 pm

Finally found what should I'd change.

Code: Select all

static uint8_t raw_scan_rsp_data[] =
{
        0x0f, 0x09, 0x45, 0x53, 0x50, 0x5f, 0x47, 0x41, 0x54, 0x54, 0x53, 0x5f, 0x44,
        0x45, 0x4d, 0x4f	//ESP_GATTS_DEMO
};
to

Code: Select all

static uint8_t raw_scan_rsp_data[] =
{
		0x0A, 0x09, 0x53, 0x4f, 0x46, 0x54, 0x41, 0x47, 0x49, 0x4c, 0x45	//SOFTAGILE
};

its working now :) :) :)

Who is online

Users browsing this forum: Bing [Bot] and 82 guests