gatt client with 128 bits service uuid

mikhael
Posts: 3
Joined: Sat Aug 17, 2024 7:32 am

gatt client with 128 bits service uuid

Postby mikhael » Sat Aug 17, 2024 7:48 am

Hello!

I'm trying to connect to a beacon with 128 bits service and char uuids.
I'm getting warnings below :
Screenshot from 2024-08-17 10-39-37.png
Screenshot from 2024-08-17 10-39-37.png (297.75 KiB) Viewed 830 times
and the results are:

I (2001) GATTC_DEMO:

I (2011) GATTC_DEMO: 7c d9 f4 14 fe b1
I (2011) GATTC_DEMO: searched Adv Data Len 31, Scan Response Len 27
I (2021) GATTC_DEMO: searched Device Name Len 10
I (2021) GATTC_DEMO: MP1_F18D86
I (2031) GATTC_DEMO:

I (2031) GATTC_DEMO: searched device MP1_F18D86

I (2041) GATTC_DEMO: connect to the remote device.
I (2051) GATTC_DEMO: stop scan successfully
I (6091) GATTC_DEMO: ESP_GATTC_CONNECT_EVT conn_id 0, if 3
I (6091) GATTC_DEMO: REMOTE BDA:
I (6091) GATTC_DEMO: 7c d9 f4 14 fe b1
I (6101) GATTC_DEMO: open success
I (6211) GATTC_DEMO: update connection params status = 0, min_int = 36, max_int = 40,conn_int = 40,latency = 0, timeout = 600
I (11371) GATTC_DEMO: discover service complete conn_id 0
I (11371) GATTC_DEMO: SEARCH RES: conn_id = 0 is primary service 1
I (11371) GATTC_DEMO: start handle 120 end handle 122 current handle value 120
I (11381) GATTC_DEMO: Get service information from remote device
I (11391) GATTC_DEMO: ESP_GATTC_SEARCH_CMPL_EVT
I (11521) GATTC_DEMO: ESP_GATTC_CFG_MTU_EVT, Status 0, MTU 23, conn_id 0
W (126121) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x8
W (126121) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x8
I (126121) GATTC_DEMO: ESP_GATTC_DISCONNECT_EVT, reason = 8

I have connection to the server but not reading data.
What have Idone wrong?

Thank you!

MicroController
Posts: 1756
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: gatt client with 128 bits service uuid

Postby MicroController » Sat Aug 17, 2024 1:30 pm

128-bit UUIDs are usually not represented as 128-bit integers as your #define does.
The warning lets you know that comparing the 16-bit UUID member to the 128-bit integer literal will never return true. And in this case, the warning seems to indicate an actual bug in your code.

mikhael
Posts: 3
Joined: Sat Aug 17, 2024 7:32 am

Re: gatt client with 128 bits service uuid

Postby mikhael » Sat Aug 17, 2024 6:14 pm

So, how to modify correctly #define declaration?

mikhael
Posts: 3
Joined: Sat Aug 17, 2024 7:32 am

Re: gatt client with 128 bits service uuid

Postby mikhael » Sat Aug 17, 2024 7:08 pm

The example gatt_demo.c use 16 bits uuid:

#define REMOTE_SERVICE_UUID 0x00FF
#define REMOTE_NOTIFY_CHAR_UUID 0xFF01
...
static esp_bt_uuid_t remote_filter_service_uuid = {
.len = ESP_UUID_LEN_16,
.uuid = {.uuid16 = REMOTE_SERVICE_UUID,},
};

static esp_bt_uuid_t remote_filter_char_uuid = {
.len = ESP_UUID_LEN_16,
.uuid = {.uuid16 = REMOTE_NOTIFY_CHAR_UUID,},
};


I could not yet figured out how to use 128 bits uuid. It would be useful an example. Thank you.

Who is online

Users browsing this forum: akasaka_spk, Baidu [Spider] and 88 guests