57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
#ifndef __BAROS_BLE_H__
|
|
#define __BAROS_BLE_H__
|
|
|
|
#include <stdbool.h>
|
|
#include "esp_event_base.h"
|
|
|
|
#define BAROS_NAME_MAX_LEN ( 32)
|
|
#define BAROS_BLE_SERVICE_PUMP_ENABLED (0x4200)
|
|
#define BAROS_BLE_SERVICE_PUMP_STATE (0x4300)
|
|
#define BAROS_BLE_SERVICE_PUMP_DURATION (0x4350)
|
|
|
|
#define BAROS_BLE_SERVICE_BARBACK (0x4400)
|
|
|
|
#define BAROS_CHAR_BUTTON (BAROS_BLE_SERVICE_BARBACK + 1) // 0x4401
|
|
#define BAROS_CHAR_NAME (BAROS_BLE_SERVICE_BARBACK + 2) // 0x4402
|
|
#define BAROS_CHAR_POUR (BAROS_BLE_SERVICE_BARBACK + 3) // 0x4403
|
|
|
|
ESP_EVENT_DECLARE_BASE(EVENT_BAROS_BLE);
|
|
|
|
#include "baros.h"
|
|
|
|
typedef enum {
|
|
BAROS_BLE_DISC,
|
|
BAROS_BLE_CONNECT,
|
|
} baros_ble_event_t;
|
|
|
|
typedef struct {
|
|
const char *name;
|
|
baros_role_t role;
|
|
} baros_ble_cfg_t;
|
|
|
|
typedef struct {
|
|
char *name;
|
|
uint8_t name_len;
|
|
uint8_t mac[6];
|
|
baros_role_t role;
|
|
} baros_ble_discovery_t;
|
|
|
|
uint8_t baros_ble_init(baros_ble_cfg_t *cfg);
|
|
|
|
typedef struct baros_list_node baros_list_node_t;
|
|
|
|
struct baros_list_node {
|
|
baros_list_node_t *first;
|
|
baros_list_node_t *last;
|
|
baros_list_node_t *next;
|
|
baros_list_node_t *prev;
|
|
void *element;
|
|
};
|
|
|
|
typedef bool baros_list_find_element_callback(void *element);
|
|
|
|
void *baros_list_find_element(baros_list_node_t *list, baros_list_find_element_callback *cb);
|
|
void *baros_list_find_node(baros_list_node_t *list, baros_list_find_element_callback *cb);
|
|
baros_list_node_t *baros_list_add(baros_list_node_t *list, void *element);
|
|
|
|
#endif
|