Indications or notifications callback

90 views
Skip to first unread message

Jose Vargas

unread,
Dec 5, 2023, 5:16:31 AM12/5/23
to btstack-dev
Hello, I'm struggling with this problems a lot of days.

I'm using the Raspberry pico w like a LEcentral on de arduino example code.

I'm trying to connect to a barcode reader, and that's fine, but when I try to get the info I can't. 

I did it before with a myccropython code, and I get from indication the data what I need, but here I don't know the problem, because I found de service and find the characteristic and on python I don't need tu subscribe the carracteristic, the event for indications callback automaticatly give a answer.

What I see now is the subcribe callback go inside a loop and don't stop never, maybe that's it's a problem but I don't know why do it, I try with subscribe to notifications or indications, because on a android app it works with both.

Can you help me? tell me what info you need

Thanks for all

Jose Vargas

unread,
Dec 6, 2023, 4:34:13 AM12/6/23
to btstack-dev
I discover the loop of the subscribe callback start when i read some characteristic not found

I add some info, this is my output.

BLE Reader found!
Device connected!
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Service Discovered: : XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Our service located!
Service discovery finished
Service added
Characteristic Discovered:  XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  , handle 0x2A
Characteristic found: Magnetic Flux Density 3d
Characteristic Discovered:  XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  , handle 0x2D
Characteristic found: CUSTOM Characteristic
Characteristic Discovered:  XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX  , handle 0x2F
Characteristic discovery finished, status 1
Subscribed!
Callback subscribed!


I get subscribed to indications on this case, but anything happens, don't get the info
of course I have this added:

BTstack.setGATTCharacteristicIndicationCallback(gattCharacteristicIndication);


Matthias Ringwald

unread,
Dec 6, 2023, 11:54:43 AM12/6/23
to btsta...@googlegroups.com
Hi Jose

What is the remote device? A real barcode reader?

The Pico C/C++ examples contain an hid_host_demo example which is able to receive data from a bar code reader. However, you'd need to update BTstack to the develop branch as there have been some fixes to HID since the last Pico SDK release

If you want to stick to the simple Arduino wrapper, that should work as well. If you want to receive notifications, you certainly need to subscribe to the relevant Characteristics.
I don't know if HID Devices support Indications on the HID Report Characteristic. Please try to enable Notifications.

If that doesn't work, please enable HCI packet logging and convert the debug output using BTstack's tool/convert_packet_log.py and post i there.
You can enable HCI packet log by calling enablePacketLogger() and enableDebugLogger() on the BTstackManager class.

Cheers
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/d71282ef-2326-4bc2-a901-5d19ee1970een%40googlegroups.com.

Jose Vargas

unread,
Dec 11, 2023, 5:33:20 AM12/11/23
to btstack-dev
Hello, sorry for my late answer.

I was wrong with the loop, the loop continue there when I get subscribed:

Subscribed!
Callback subscribed!
Subscribed!
Callback subscribed!
Subscribed!
Callback subscribed!
Subscribed!
Callback subscribed!
Subscribed!
Callback subscribed!

I don't know why.

The reader is this exactly:

I will try like you said to me, thanks for your help

Matthias Ringwald

unread,
Dec 11, 2023, 8:19:27 AM12/11/23
to btsta...@googlegroups.com
Hi Jose

Yes, I was referring to the file you've linked to. Please update BTstack to the current master or develop branch as there have been fixes to HOG Host.

Cheers
Matthias

Jose Vargas

unread,
Feb 26, 2024, 6:54:04 AMFeb 26
to btstack-dev
When I try to use that example I get this:

Compilation error: 'hid_host_init' was not declared in this scope; did you mean 'hid_host_cid'?

Jose Vargas

unread,
Feb 26, 2024, 10:03:37 AMFeb 26
to btstack-dev
I try with the old code enabling the log and debug and this is what i get when i scan something with the scanner


[00:06:15.390] ACL <= 40 20 0E 00 0A 00 04 00 1D 2A 00 39 31 33 39 33 36 0D
[00:06:15.391] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.391] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.391] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:06:15.391] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.391] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:06:15.392] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:06:15.393] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:06:15.393] ACL => 40 00 05 00 01 00 04 00 1E
[00:06:15.393] EVT <= 6E 00
[00:06:15.394] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.394] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.394] CMD => 35 0C 05 01 40 00 01 00
[00:06:15.395] EVT <= 6E 00
[00:06:15.395] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.396] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.396] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:06:15.397] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:06:15.397] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.398] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:06:15.399] EVT <= 79 02 04 00
[00:06:15.399] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.399] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.400] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.648] EVT <= 13 05 01 40 00 01 00
[00:06:15.649] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:06:15.649] LOG -- hci.c.649: ACL classic buffers: 0 used of 3

Jose Vargas

unread,
Feb 27, 2024, 1:33:44 AMFeb 27
to btstack-dev
sorry for the multiple reply. I see the first packet is the data what I need on hex

how I can get it?
[00:06:15.390] ACL <= 40 20 0E 00 0A 00 04 00 1D 2A 00 39 31 33 39 33 36 0D

Matthias Ringwald

unread,
Feb 27, 2024, 3:51:02 AMFeb 27
to btsta...@googlegroups.com
Hi Jose

Please describe your setup: Host OS, port you want to compile, example you want to compile. Please also paste the full error.

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/deac76d4-a964-487c-8d72-1868d103ce8an%40googlegroups.com.

Matthias Ringwald

unread,
Feb 27, 2024, 3:52:02 AMFeb 27
to btsta...@googlegroups.com
Hi Jose

Please disable ENABLE_LOG_DEBUG and store the full console output into a file, then use tool/create_packet_log.py to convert it into a .pklg file that can be opened with Wireshark.

Best
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/62f99228-212b-4c64-bc7e-1e96297e44e3n%40googlegroups.com.

Jose Vargas

unread,
Feb 27, 2024, 4:48:42 AMFeb 27
to btstack-dev
There is no way for get this  00:06:15.390] ACL <= 40 20 0E 00 0A 00 04 00 1D 2A 00 39 31 33 39 33 36 0D?

I don't know how to store the output into a file sorry, I'll try to find something on google, thanks for your help

Jose Vargas

unread,
Feb 27, 2024, 5:20:48 AMFeb 27
to btstack-dev
ok, I find the way.

Like I told you

ACL <= 40 20 0E 00 0A 00 04 00 1D 2A 00 39 31 33 39 33 36 0D

This is the packed what I need and it's on hex, but I can only watch it if I have enablePacketLogger

I try subscribing to indications and notifications but nothing happens, I can see only wen enablePacketLogger.

heres is the connection output:

BLE Lector ha sido encontrado!

[00:00:13.551] CMD => 0C 20 02 00 00
[00:00:13.552] EVT <= 6E 00
[00:00:13.552] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.552] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.553] EVT <= 3E 24 02 01 04 00 D3 CA 09 A1 A8 AA 18 02 01 02 14 09 42 61 72 43 6F 64 65 20 53 63 61 6E 6E 65 72 20 42 4C 45 BE
[00:00:13.554] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.555] EVT <= 0E 04 01 0C 20 00
[00:00:13.555] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.555] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.556] CMD => 0D 20 19 60 00 30 00 00 00 D3 CA 09 A1 A8 AA 00 08 00 18 00 04 00 48 00 00 00 00 00
[00:00:13.556] EVT <= 6E 00
[00:00:13.557] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.559] EVT <= 0F 04 00 01 0D 20
[00:00:13.560] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:13.560] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.836] EVT <= 3E 13 01 00 40 00 00 00 D3 CA 09 A1 A8 AA 18 00 04 00 48 00 00
[00:00:14.837] EVT <= 61 01 01
[00:00:14.837] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
Connection complete, con_handle 0x0040
Device connected!
[00:00:14.837] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.838] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.838] EVT <= CD 09 40 00 00 D3 CA 09 A1 A8 AA
[00:00:14.838] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.839] EVT <= CE 09 40 00 00 D3 CA 09 A1 A8 AA
[00:00:14.839] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.839] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.840] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:14.841] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.841] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:14.842] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:14.842] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:14.843] ACL => 40 00 07 00 03 00 04 00 02 9B 06
[00:00:14.844] EVT <= 6E 00
[00:00:14.844] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.844] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.845] CMD => 16 20 02 40 00
[00:00:14.845] EVT <= 6E 00
[00:00:14.846] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.846] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.846] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:14.847] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:14.847] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.848] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:14.848] EVT <= 79 02 04 00
[00:00:14.849] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.849] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.850] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.851] EVT <= 3E 04 14 40 00 00
[00:00:14.851] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.851] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.852] EVT <= 0F 04 00 01 16 20
[00:00:14.852] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.853] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.853] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.891] ACL <= 40 20 07 00 03 00 04 00 03 B9 00
[00:00:14.891] EVT <= AB 04 40 00 B9 00
[00:00:14.892] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.892] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.892] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:14.892] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.892] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:14.893] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:14.893] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:14.894] ACL => 40 00 0B 00 07 00 04 00 10 01 00 FF FF 00 28
[00:00:14.895] EVT <= 6E 00
[00:00:14.895] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.896] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.896] CMD => 35 0C 05 01 40 00 01 00
[00:00:14.897] EVT <= 6E 00
[00:00:14.897] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.897] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.897] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:14.898] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:14.899] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.899] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:14.900] EVT <= 79 02 04 00
[00:00:14.900] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.901] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.901] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.921] EVT <= 3E 0C 04 00 40 00 01 00 00 00 00 00 00 00
[00:00:14.922] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.922] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.981] ACL <= 40 20 18 00 14 00 04 00 11 06 01 00 0B 00 00 18 0C 00 0F 00 01 18 10 00 13 00 04 18
[00:00:14.982] EVT <= A1 16 40 00 01 00 0B 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 00 18 00 00
Service Discovered: :00001800-0000-1000-8000-00805F9B34FB
[00:00:14.983] EVT <= A1 16 40 00 0C 00 0F 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 01 18 00 00
Service Discovered: :00001801-0000-1000-8000-00805F9B34FB
[00:00:14.983] EVT <= A1 16 40 00 10 00 13 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 04 18 00 00
Service Discovered: :00001804-0000-1000-8000-00805F9B34FB
[00:00:14.984] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.984] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.985] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:14.986] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.986] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:14.987] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:14.987] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:14.988] ACL => 40 00 0B 00 07 00 04 00 10 14 00 FF FF 00 28
[00:00:14.989] EVT <= 6E 00
[00:00:14.989] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.990] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.990] CMD => 35 0C 05 01 40 00 01 00
[00:00:14.991] EVT <= 6E 00
[00:00:14.991] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.991] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.992] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:14.992] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:14.993] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.993] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:14.994] EVT <= 79 02 04 00
[00:00:14.994] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.995] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.995] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.996] EVT <= 13 05 01 40 00 02 00
[00:00:14.997] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:14.997] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.041] ACL <= 40 20 18 00 14 00 04 00 11 06 14 00 16 00 0F 18 17 00 27 00 0A 18 28 00 2F 00 EA FE
[00:00:15.042] EVT <= A1 16 40 00 14 00 16 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 0F 18 00 00
Service Discovered: :0000180F-0000-1000-8000-00805F9B34FB
[00:00:15.043] EVT <= A1 16 40 00 17 00 27 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 0A 18 00 00
Service Discovered: :0000180A-0000-1000-8000-00805F9B34FB
[00:00:15.043] EVT <= A1 16 40 00 28 00 2F 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 EA FE 00 00
Service Discovered: :0000FEEA-0000-1000-8000-00805F9B34FB
Our service located!
[00:00:15.044] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.045] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.045] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:15.046] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.046] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:15.047] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:15.048] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:15.048] ACL => 40 00 0B 00 07 00 04 00 10 30 00 FF FF 00 28
[00:00:15.049] EVT <= 6E 00
[00:00:15.049] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.050] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.050] CMD => 35 0C 05 01 40 00 01 00
[00:00:15.051] EVT <= 6E 00
[00:00:15.051] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.051] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.052] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:15.052] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:15.053] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.054] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:15.054] EVT <= 79 02 04 00
[00:00:15.054] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.054] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.055] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.071] ACL <= 40 20 09 00 05 00 04 00 01 10 30 00 0A
[00:00:15.071] EVT <= A0 03 40 00 00
Service discovery finished
Service added
[00:00:15.072] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.072] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.072] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:15.072] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.073] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:15.073] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:15.074] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:15.074] ACL => 40 00 0B 00 07 00 04 00 08 28 00 2F 00 03 28
[00:00:15.075] EVT <= 6E 00
[00:00:15.075] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.076] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.076] CMD => 35 0C 05 01 40 00 01 00
[00:00:15.077] EVT <= 6E 00
[00:00:15.077] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.077] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.078] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:15.078] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:15.079] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.080] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:15.080] EVT <= 79 02 04 00
[00:00:15.080] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.081] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.082] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.082] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.083] EVT <= 13 05 01 40 00 02 00
[00:00:15.084] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.084] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.131] ACL <= 40 20 0D 00 09 00 04 00 09 07 29 00 32 2A 00 A1 2A
[00:00:15.131] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.132] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.132] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:15.132] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.132] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:15.132] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:15.133] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:15.134] ACL => 40 00 0B 00 07 00 04 00 08 2B 00 2F 00 03 28
[00:00:15.135] EVT <= 6E 00
[00:00:15.135] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.135] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.136] CMD => 35 0C 05 01 40 00 01 00
[00:00:15.136] EVT <= 6E 00
[00:00:15.137] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.137] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.137] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:15.138] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:15.139] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.139] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:15.140] EVT <= 79 02 04 00
[00:00:15.140] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.140] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.141] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.191] ACL <= 40 20 0D 00 09 00 04 00 09 07 2C 00 02 2D 00 C9 FE
[00:00:15.192] EVT <= A2 1A 40 00 29 00 2A 00 2B 00 32 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 A1 2A 00 00
Characteristic Discovered: 00002AA1-0000-1000-8000-00805F9B34FB, handle 0x2A
[00:00:15.193] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.193] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.193] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:00:15.193] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.194] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:00:15.194] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:00:15.195] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:00:15.196] ACL => 40 00 0B 00 07 00 04 00 08 2E 00 2F 00 03 28
[00:00:15.197] EVT <= 6E 00
[00:00:15.197] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.197] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.197] CMD => 35 0C 05 01 40 00 01 00
[00:00:15.198] EVT <= 6E 00
[00:00:15.198] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.199] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.199] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:00:15.200] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:00:15.200] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.201] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:00:15.202] EVT <= 79 02 04 00
[00:00:15.202] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.202] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.203] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.204] EVT <= 13 05 01 40 00 02 00
[00:00:15.204] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.205] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.251] ACL <= 40 20 0D 00 09 00 04 00 09 07 2E 00 08 2F 00 A2 2A
[00:00:15.251] EVT <= A2 1A 40 00 2C 00 2D 00 2D 00 02 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 C9 FE 00 00
Characteristic Discovered: 0000FEC9-0000-1000-8000-00805F9B34FB, handle 0x2D
[00:00:15.252] EVT <= A2 1A 40 00 2E 00 2F 00 2F 00 08 00 FB 34 9B 5F 80 00 00 80 00 10 00 00 A2 2A 00 00
Characteristic Discovered: 00002AA2-0000-1000-8000-00805F9B34FB, handle 0x2F
[00:00:15.253] EVT <= A0 03 40 00 00
Characteristic discovery finished, status 1
[00:00:15.254] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.254] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.255] CMD => 35 0C 05 01 40 00 01 00
[00:00:15.255] EVT <= 6E 00
[00:00:15.256] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.256] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.494] EVT <= 13 05 01 40 00 01 00
[00:00:15.494] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:00:15.495] LOG -- hci.c.649: ACL classic buffers: 0 used of 3



and this is when the scanner send the data
[00:02:10.030] ACL <= 40 20 12 00 0E 00 04 00 1D 2A 00 58 30 30 31 4C 4F 31 37 47 44 0D
[00:02:10.030] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.030] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.031] LOG -- l2cap.c.1084: l2cap_send_prepared_connectionless handle 64, cid 0x04
[00:02:10.031] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.031] LOG -- hci.c.882: hci_send_acl_packet_fragments entered
[00:02:10.031] LOG -- hci.c.888: hci_send_acl_packet_fragments loop entered
[00:02:10.032] LOG -- hci.c.913: hci_send_acl_packet_fragments loop before send (more fragments 0)
[00:02:10.033] ACL => 40 00 05 00 01 00 04 00 1E
[00:02:10.034] EVT <= 6E 00
[00:02:10.034] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.034] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.035] CMD => 35 0C 05 01 40 00 01 00
[00:02:10.035] EVT <= 6E 00
[00:02:10.035] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.036] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.036] LOG -- hci.c.940: hci_send_acl_packet_fragments loop after send (more fragments 0)
[00:02:10.037] LOG -- hci.c.949: hci_send_acl_packet_fragments loop over
[00:02:10.037] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.038] LOG -- l2cap.c.1109: L2CAP_EVENT_CHANNEL_CAN_SEND_NOW local_cid 0x4
[00:02:10.038] EVT <= 79 02 04 00
[00:02:10.039] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.039] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.040] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.243] EVT <= 13 05 01 40 00 01 00
[00:02:10.243] LOG -- hci.c.649: ACL classic buffers: 0 used of 3
[00:02:10.244] LOG -- hci.c.649: ACL classic buffers: 0 used of 3





Matthias Ringwald

unread,
Feb 27, 2024, 6:00:48 AMFeb 27
to btsta...@googlegroups.com
Hi Jose

After subscribing to Notifications or Indications using the GATT Client, you also need to register a listener for these with gatt_client_listen_for_characteristic_value_updates

Cheers
Matthias
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/d6fafb59-394f-49d0-b0ce-d15c0a3c4992n%40googlegroups.com.

Jose Vargas

unread,
Feb 27, 2024, 6:09:46 AMFeb 27
to btstack-dev
Sorry for my ignorance but you mean this?

void gattCharacteristicNotification(BLEDevice *device, uint16_t value_handle, uint8_t *value, uint16_t length) {
  (void)device;
  (void)value_handle;
  (void)length;
  Serial.print("Notification: ");
  Serial.println((const char *)value);
}

void gattCharacteristicIndication(BLEDevice *device, uint16_t value_handle, uint8_t *value, uint16_t length) {
  (void)device;
  (void)value_handle;
  (void)length;
  Serial.print("Indicacion: ");
  Serial.println((const char *)value);
}

Jose Vargas

unread,
Feb 27, 2024, 6:43:44 AMFeb 27
to btstack-dev
I'm on a raspberry pico w, and I'm using de LEcentral.ino example inside port/arduino/LeCentral

Matthias Ringwald

unread,
Feb 27, 2024, 6:45:58 AMFeb 27
to btsta...@googlegroups.com
HI Jose

You didn't mention that you're using the Arduino Wrapper. On what platform do you use BTstack with this wrapper?

Going through BTstack.cpp of the Arduino wrapper, there's no call to gatt_client_listen_for_characteristic_value_updates() indeed.

I guess it would make sense to do this automatically after the subscribe operation completed. We won't work on this at the moment but I'm open to PRs:)

Could you switch to the native development environment? It's esp-idf for ESP32 and Pico SDK for the Raspberry Pi Pico W.

Best regards
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/fa4ebcc4-357d-447c-8aed-349405ea1171n%40googlegroups.com.

Jose Vargas

unread,
Feb 27, 2024, 7:32:17 AMFeb 27
to btstack-dev
Yes I'm using arduino IDE with a raspberry pico w because I'm new on all of this and was more easy with that ide

You recomment me change to the sdk? I don't know how to do it, but I'll try thanks

Jose Vargas

unread,
Feb 27, 2024, 10:38:45 AMFeb 27
to btstack-dev
It's possible to get all the string from the packetlogger and I choose only the first line? Is the only what i need

Matthias Ringwald

unread,
Feb 28, 2024, 5:04:00 AMFeb 28
to btsta...@googlegroups.com
Hi Jose

I see. On the Pico W, you could also try to use MicroPython, which also provides a library for Bluetooth Low Energy.

For the Pico C SDK, you can follow the official getting started guide and try our examples in the pico_w subfolder.

For the Arduino Wrapper, a quick fix would be to call gatt_client_listen_for_characteristic_value_updates from your app. A proper fix would need to allocate memory and, more tricky, release it on unsubscribe or disconnect.

Cheers
Matthias
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/a2896196-d6d2-4cbf-aa6d-654ae848a1d5n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages