Open PTmv opened 6 years ago
According to the gattlib_connect_async() definition in https://github.com/labapart/gattlib/blob/master/bluez/gattlib_connect.c, initialize_gattlib_connection() should return a valid non NULL pointer to the gatt_connection_t object if there is no error. If there is no error the consequential call to connect_cb() should contain this non-null pointer. Since the gattlib_connect_async() returns a non NULL pointer (there is no error), so the same pointer should be passed to the connect_cb() from io_connect_cb(). But it does not. Why? Please advise me.
I am running a modified version of gattlib ble_scan example from VS2017 for Linux. But instead of gattlib_connect() function I use gattlib_connect_async() function. The problem I observe is that the call gatt_connection = gattlib_connect_async(NULL, addr, BDADDR_LE_RANDOM, BT_SEC_LOW, 0, 0, connect_cb) returns always a valid non NULL value for the connected device, but the *static void connect_cb(gatt_connection_t connection)* the passed gatt_connection_t parameter is in most of the cases NULL (0x0) for the same device. Please explain what should be the reason for this problem and how to solve it.