Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The C library occasionally crashes when simpleble_peripheral_manufacturer_data_get is called #267

Open
KlemenDEV opened this issue Oct 16, 2023 · 2 comments

Comments

@KlemenDEV
Copy link

KlemenDEV commented Oct 16, 2023

I am in the process of making Java bindings for the library using JNA via SimpleBLE C API.

I have implemented quite some parts of it already, but I am facing a problem where the library crashes (JVM) when simpleble_peripheral_manufacturer_data_get is called. This does not happen every time a new device is found, but only after a few detections usually.

The implementation follows https://github.com/OpenBluetoothToolbox/SimpleBLE/blob/main/examples/simpleble/c/scan.c

Such a problem is not observed when obtaining services via simpleble_peripheral_services_get with the same mechanism except, of course, a different method and structure type.

I did not figure out how to get stack trace or core dump when calling via JNA yet so I don't have more details on the crash, but they happen when the peripheral has manufacturer data (simpleble_peripheral_manufacturer_data_count > 0) and then simpleble_peripheral_manufacturer_data_get is called.

I have also observed I get different numbers of data for simpleble_peripheral_manufacturer_data_count for the same peripheral where the peripheral is sending the same number of manufacturer data entries in the BLE ADV.

Testing on Windows 11

@KlemenDEV
Copy link
Author

It also seems that calling simpleble_peripheral_manufacturer_data_get, structure sometimes gets the data array filled with non-zero values, while the data_length is set to 0

@KlemenDEV
Copy link
Author

KlemenDEV commented Oct 17, 2023

Checking value of the manufacturer_data, there sometimes can be found short sequences of correct data, but not full chunks

Missing advertisements could be similar to #218, however same BLE adapter always reads all manufacturer data when testing with eg. Bleak Python library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant