gattlib icon indicating copy to clipboard operation
gattlib copied to clipboard

gattlib_adapter_scan_enable() must be called first for gattlib_connect() to work.

Open tvonderhaar opened this issue 11 months ago • 0 comments

I have modified the Owon multimeter program "owonb35.c" from:

https://github.com/DeanCording/owonb35

to work with the current gattlib version (0.7.2). The original code could connect to the device without doing a scan first by supplying the known device address to "gattlib_connect()". The original code "owonb35.c" was written 6 years ago and it appears gattlib has changed significantly since then. All the gattlib examples that work connect through the "gattlib_adapter_scan_enable() " call back.

The error returned from "gattlib_connect()" is "invalid parameter" when no scan is performed first. If a scan is performed first than no error occurs. Must a scan be performed before calling "gattlib_connect()" or is there a bug in the current gattlib library?

Also, the "owonb35.c" code attempts a scan retry every 2 seconds if a scan fails. It calls "gattlib_adapter_scan_disable()" before calling "gattlib_adapter_scan_enable()" on retries. On the second retry scan "gattlib_adapter_scan_disable()" fails with the unknown gattlib error code "0X1000C524". Is this also a bug?

There is no documentation I can find describing the overall architecture of gattlib. Some documentation describing what functions must be called before others can be called would be useful(ex. "gattlib_adapter_open()" needs to be called before before calling "gattlib_adapter_scan_disable()".) The sphinx and doxygen docs contain very minimal information.

Thanks, Tom

tvonderhaar avatar Nov 13 '24 10:11 tvonderhaar