weliem / bluez_inc

A C library for Bluez (BLE) that hides all DBus communication. It doesn't get easier than this. This library can also be used in C++.
MIT License
84 stars 19 forks source link

Get CompanyID and Manufacturer Data on discovery callback #23

Closed mamigot-salto closed 6 months ago

mamigot-salto commented 6 months ago

Hello! First of all I'd like to thank you for the awesome work you've done with this bluez_inc library. Thank you so much!

Ok, here is the issue I'm struggling with and hopefully you can help me with: I'd like to parse as a byte array the manufacturer data that is included within the advertisement packet from a peripheral device, but the binc_device_get_manufacturer_data method returns a pointer to a GHashTable which honestly I don't know how to process. What is the key that I should look for in that hash table so I can check the Company ID that is advertised? How can I parse the actual manufacture data that is included, is it a key or a value in the hash table? How is the data inserted in that hash table: as string or as byte array?

Thank you in advance

weliem commented 6 months ago

https://docs.gtk.org/glib/struct.HashTable.html

Use one of the GHastable functions to get the keys

weliem commented 6 months ago

The key is a *int and the value is a GByteArray

mamigot-salto commented 6 months ago

Thanks a lot for your rapid response! This confirms what I found yesterday at the last minute before going home from the office. Sorry for the inconveniences. And again, congratulations and thanks for the great job with this library!