1
6
7
8
9
10
16
17
18
19
24
25
26
27
28
29
30
31
32
33
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
70
71
72
79
80
81
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
109
110
111
112
113
114
115
116
117
118
119
120
121
122
128
129
/* ... */
#ifndef _SIMPLE_BLE_
#define _SIMPLE_BLE_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <esp_gap_ble_api.h>
#include <esp_gatts_api.h>5 includes
typedef void (simple_ble_cb_t)(esp_gatts_cb_event_t event, esp_gatt_if_t p_gatts_if, esp_ble_gatts_cb_param_t *param);
/* ... */
typedef struct {
const char *device_name;
esp_ble_adv_data_t *adv_data_p;
esp_ble_adv_data_t *scan_rsp_data_p;
esp_ble_adv_params_t adv_params;
/* ... */
esp_gatts_attr_db_t *gatt_db;
ssize_t gatt_db_count;
simple_ble_cb_t *read_fn;
simple_ble_cb_t *write_fn;
simple_ble_cb_t *exec_write_fn;
simple_ble_cb_t *disconnect_fn;
simple_ble_cb_t *connect_fn;
simple_ble_cb_t *set_mtu_fn;
unsigned ble_bonding:1;
unsigned ble_sm_sc:1;
uint8_t *ble_addr;
unsigned keep_ble_on:1;
}{ ... } simple_ble_cfg_t;
/* ... */
uint8_t get_keep_ble_on(void);
/* ... */
simple_ble_cfg_t *simple_ble_init(void);
/* ... */
esp_err_t simple_ble_deinit(void);
/* ... */
esp_err_t simple_ble_start(simple_ble_cfg_t *cfg);
/* ... */
esp_err_t simple_ble_stop(void);
/* ... */
const uint8_t *simple_ble_get_uuid128(uint16_t handle);
/* ... */
esp_err_t simple_ble_disconnect(void);/* ... */
#endif