mirror of https://github.com/labapart/gattlib
gattlib: Change gattlib_register_(on_disconnect|notification|indication)
parent
118dc961d6
commit
959ee55b61
|
@ -8,19 +8,31 @@
|
|||
|
||||
#include "gattlib_internal.h"
|
||||
|
||||
void gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data) {
|
||||
int gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data) {
|
||||
if (connection == NULL) {
|
||||
return GATTLIB_INVALID_PARAMETER;
|
||||
}
|
||||
connection->notification.callback.notification_handler = notification_handler;
|
||||
connection->notification.user_data = user_data;
|
||||
return GATTLIB_SUCCESS;
|
||||
}
|
||||
|
||||
void gattlib_register_indication(gatt_connection_t* connection, gattlib_event_handler_t indication_handler, void* user_data) {
|
||||
int gattlib_register_indication(gatt_connection_t* connection, gattlib_event_handler_t indication_handler, void* user_data) {
|
||||
if (connection == NULL) {
|
||||
return GATTLIB_INVALID_PARAMETER;
|
||||
}
|
||||
connection->indication.callback.notification_handler = indication_handler;
|
||||
connection->indication.user_data = user_data;
|
||||
return GATTLIB_SUCCESS;
|
||||
}
|
||||
|
||||
void gattlib_register_on_disconnect(gatt_connection_t *connection, gattlib_disconnection_handler_t handler, void* user_data) {
|
||||
int gattlib_register_on_disconnect(gatt_connection_t *connection, gattlib_disconnection_handler_t handler, void* user_data) {
|
||||
if (connection == NULL) {
|
||||
return GATTLIB_INVALID_PARAMETER;
|
||||
}
|
||||
connection->on_disconnection.callback.disconnection_handler = handler;
|
||||
connection->on_disconnection.user_data = user_data;
|
||||
return GATTLIB_SUCCESS;
|
||||
}
|
||||
|
||||
void bt_uuid_to_uuid(bt_uuid_t* bt_uuid, uuid_t* uuid) {
|
||||
|
|
|
@ -159,11 +159,11 @@ gattlib_notification_start.argtypes = [c_void_p, POINTER(GattlibUuid)]
|
|||
gattlib_notification_stop = gattlib.gattlib_notification_stop
|
||||
gattlib_notification_stop.argtypes = [c_void_p, POINTER(GattlibUuid)]
|
||||
|
||||
# void gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data);
|
||||
# int gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data);
|
||||
gattlib_register_notification = gattlib.gattlib_register_notification
|
||||
gattlib_register_notification.argtypes = [c_void_p, c_void_p, c_void_p]
|
||||
|
||||
# void gattlib_register_on_disconnect(gatt_connection_t *connection, PyObject *handler, PyObject *user_data)
|
||||
# int gattlib_register_on_disconnect(gatt_connection_t *connection, PyObject *handler, PyObject *user_data)
|
||||
gattlib_register_on_disconnect = gattlib.gattlib_register_on_disconnect
|
||||
gattlib_register_on_disconnect.argtypes = [c_void_p, c_void_p, c_void_p]
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ int gattlib_disconnect(gatt_connection_t* connection);
|
|||
*
|
||||
* @return GATTLIB_SUCCESS on success or GATTLIB_* error code
|
||||
*/
|
||||
void gattlib_register_on_disconnect(gatt_connection_t *connection, gattlib_disconnection_handler_t handler, void* user_data);
|
||||
int gattlib_register_on_disconnect(gatt_connection_t *connection, gattlib_disconnection_handler_t handler, void* user_data);
|
||||
|
||||
/**
|
||||
* Structure to represent GATT Primary Service
|
||||
|
@ -615,7 +615,7 @@ int gattlib_indication_stop(gatt_connection_t* connection, const uuid_t* uuid);
|
|||
*
|
||||
* @return GATTLIB_SUCCESS on success or GATTLIB_* error code
|
||||
*/
|
||||
void gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data);
|
||||
int gattlib_register_notification(gatt_connection_t* connection, gattlib_event_handler_t notification_handler, void* user_data);
|
||||
|
||||
/*
|
||||
* @brief Register a handle for the GATT indications
|
||||
|
@ -626,7 +626,7 @@ void gattlib_register_notification(gatt_connection_t* connection, gattlib_event_
|
|||
*
|
||||
* @return GATTLIB_SUCCESS on success or GATTLIB_* error code
|
||||
*/
|
||||
void gattlib_register_indication(gatt_connection_t* connection, gattlib_event_handler_t indication_handler, void* user_data);
|
||||
int gattlib_register_indication(gatt_connection_t* connection, gattlib_event_handler_t indication_handler, void* user_data);
|
||||
|
||||
#if 0 // Disable until https://github.com/labapart/gattlib/issues/75 is resolved
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue