notify callback
Hi
I'm not able to implement a notify callback. the second parameter of the function blz_char_notify_start is the callback "blz_notify_handler_t cb", it's a function that return void and accept four parameters : const uint8_t* data size_t len blz_char* ch void* user
but, if inside this callback i need to access some characteristic fields is impossible cause all definition is in the blzlib_internal.h. I'll need to check the uuid cause I'll attach the same callback to more than one chararacteristic but ch->uuid can't be resolved.
moreover also if I attach the callback to only one characteristic nothing happen ...
characteristic = blz_get_char_from_uuid(service, "00000003-0000-1000-8000-00805f9b3062");
blz_char_notify_start(characteristic, indicate_cb, NULL);
for (i=0; i < 10; ++i) {
blz_loop_one(blz, 1000);
}
blz_char_notify_stop(characteristic);
this code could work ? thanks
Hi! Yes this code should work, actually I have something very similar in my code.
To the fact that the characteristic is defined in internal, I would like to keep it like this in order to hide the implementation. Couldn't you have the characteristics pointers global and check against them? Or you could pass the characteristics pointer as the user pointer and check that?
about the code: now seem to work also for me ... really i don't know why it didn't work for half a day ...
about the opaque structure: I agree with you to keep the implementation hide, so maybe could be simple and useful to provide some getter funcion such as "char* blx_char_uuid(blz_char* ch, char *uuid)" or something like
yes that could be useful. in the mean time i think it should be OK to check the pointers themselves...
Found it !!!
the notify callback work if the characteristic have the "Notify" attribute but nothing happen with the "Indicate" attribute!
okay, can I close this issue then? Welcome to add the UUID check method via pull request.