2019-07-07 17:10:10 +02:00
|
|
|
#ifndef __GATTLIB_INTERNAL_DEFS_H__
|
|
|
|
#define __GATTLIB_INTERNAL_DEFS_H__
|
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2019-07-07 17:10:10 +02:00
|
|
|
#include "gattlib.h"
|
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
enum handler_type { UNKNOWN = 0, NATIVE_NOTIFICATION, NATIVE_DISCONNECTION, PYTHON };
|
2019-07-07 17:10:10 +02:00
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
struct gattlib_handler {
|
|
|
|
enum handler_type type;
|
|
|
|
union {
|
|
|
|
gattlib_event_handler_t notification_handler;
|
|
|
|
gattlib_disconnection_handler_t disconnection_handler;
|
|
|
|
void* python_handler;
|
|
|
|
};
|
|
|
|
void* user_data;
|
|
|
|
};
|
2019-07-07 17:10:10 +02:00
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
struct _gatt_connection_t {
|
|
|
|
void* context;
|
2019-07-07 17:10:10 +02:00
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
struct gattlib_handler notification;
|
|
|
|
struct gattlib_handler indication;
|
|
|
|
struct gattlib_handler disconnection;
|
2019-07-07 17:10:10 +02:00
|
|
|
};
|
|
|
|
|
2019-05-19 12:47:21 +02:00
|
|
|
bool gattlib_has_valid_handler(struct gattlib_handler *handler);
|
|
|
|
void gattlib_call_disconnection_handler(struct gattlib_handler *handler);
|
|
|
|
void gattlib_call_notification_handler(struct gattlib_handler *handler, const uuid_t* uuid, const uint8_t* data, size_t data_length);
|
|
|
|
|
2019-07-07 17:10:10 +02:00
|
|
|
#endif
|