labapart / gattlib

Library to access GATT information from BLE (Bluetooth Low Energy) devices

Home Page:http://labapart.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get notification crash issue

sumit1478 opened this issue · comments

Hi,
I used notification .c code to test receiving data from Nexgo-POS-BLE device.It was able to recive correct data but was crashing with following error:

Notification Handler: 30 30 30 30 30 30 30 30 30 30 30
munmap_chunk(): invalid pointer
Aborted (core dumped)

(30 30 30 30 30 30 30 30 30 30 30 was the data i sent and i was able to receive it correctly)

However when i used following indication fns instead of notification fns ,it worked flawlessly:

gattlib_register_indication(connection, notification_handler, NULL);
gattlib_indication_start(connection, &g_notify_uuid);

I do not see the
gattlib_indication_start() in the gattlib.h file. Are you certain this is part of the library? I want to use it.

commented

@felwiz

gattlib_indication_start() is in the library:

gattlib/include/gattlib.h

Lines 547 to 555 in 1afaa8b

/*
* @brief Enable indication on GATT characteristic represented by its UUID
*
* @param connection Active GATT connection
* @param uuid UUID of the characteristic that will trigger the indication
*
* @return GATTLIB_SUCCESS on success or GATTLIB_* error code
*/
int gattlib_indication_start(gatt_connection_t* connection, const uuid_t* uuid);

int gattlib_indication_start(gatt_connection_t* connection, const uuid_t* uuid) {
return connect_signal_to_characteristic_uuid(connection, uuid, on_handle_characteristic_indication);
}