2022-04-11 17:03:43 +02:00

50 lines
1.1 KiB
C

#include "esp_gap_ble_api.h"
#include "esp_gatts_api.h"
#define C_WL_MODE_BLE 0b100
#define SENSOR_BLE_APP_ID 0x69
#define ENVIRONMENTAL_SENSING_IDX 0
#define PROFILE_NUM 1
#define ENVIRONMENTAL_SENSING_UUID 0x181A
#define CHAR_DECLARATION_SIZE (sizeof(uint8_t))
#define GATTS_CHAR_VAL_LEN_MAX 500
enum{
ENV_IDX_SVC,
CO2_IDX_MEAS_CHAR,
CO2_IDX_MEAS_VAL,
T_IDX_MEAS_CHAR,
T_IDX_MEAS_VAL,
HUM_IDX_MEAS_CHAR,
HUM_IDX_MEAS,
ENV_IDX_NB,
};
struct gatts_profile_inst {
esp_gatts_cb_t gatts_cb;
uint16_t gatts_if;
uint16_t app_id;
uint16_t conn_id;
uint16_t service_handle;
esp_gatt_srvc_id_t service_id;
uint16_t char_handle;
esp_bt_uuid_t char_uuid;
esp_gatt_perm_t perm;
esp_gatt_char_prop_t property;
uint16_t descr_handle;
esp_bt_uuid_t descr_uuid;
};
void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t* param);
void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param);
void gatts_profile_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t* param);
void initBle(void);