2021-12-06 06:59:55 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2016-11-24 17:58:26 +00:00
|
|
|
|
2016-11-16 14:11:59 +00:00
|
|
|
#ifndef __BTC_BLUFI_PRF_H__
|
|
|
|
#define __BTC_BLUFI_PRF_H__
|
|
|
|
|
2021-03-31 04:51:48 +00:00
|
|
|
#include "blufi_int.h"
|
2018-04-08 04:10:50 +00:00
|
|
|
#include "btc/btc_task.h"
|
2016-11-16 14:11:59 +00:00
|
|
|
#include "esp_blufi_api.h"
|
2021-03-31 04:51:48 +00:00
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
|
|
|
#include "stack/gatt_api.h"
|
|
|
|
#define ESP_BLUFI_ERROR GATT_ERROR
|
|
|
|
#define ESP_BLUFI_SUCCESS GATT_SUCCESS
|
|
|
|
#else
|
|
|
|
#define ESP_BLUFI_ERROR 0x85
|
|
|
|
#define ESP_BLUFI_SUCCESS 0x00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
|
|
|
|
#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
|
|
|
|
|
|
|
#define GATT_UUID_CHAR_CLIENT_CONFIG 0x2902 /* Client Characteristic Configuration */
|
|
|
|
//define the blufi serivce uuid
|
|
|
|
#define BLUFI_SERVICE_UUID 0xFFFF
|
|
|
|
//define the blufi Char uuid (PHONE to ESP32)
|
|
|
|
#define BLUFI_CHAR_P2E_UUID 0xFF01
|
|
|
|
//define the blufi Char uuid (ESP32 to PHONE)
|
|
|
|
#define BLUFI_CHAR_E2P_UUID 0xFF02
|
|
|
|
//define the blufi Descriptor uuid (ESP32 to PHONE)
|
|
|
|
#define BLUFI_DESCR_E2P_UUID GATT_UUID_CHAR_CLIENT_CONFIG
|
|
|
|
//define the blufi APP ID
|
|
|
|
#define BLUFI_APP_UUID 0xFFFF
|
|
|
|
|
|
|
|
#define BLUFI_HDL_NUM 6
|
|
|
|
|
|
|
|
struct pkt_info{
|
|
|
|
uint8_t *pkt;
|
|
|
|
int pkt_len;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const tBT_UUID blufi_srvc_uuid = {LEN_UUID_16, {BLUFI_SERVICE_UUID}};
|
|
|
|
static const tBT_UUID blufi_char_uuid_p2e = {LEN_UUID_16, {BLUFI_CHAR_P2E_UUID}};
|
|
|
|
static const tBT_UUID blufi_char_uuid_e2p = {LEN_UUID_16, {BLUFI_CHAR_E2P_UUID}};
|
|
|
|
static const tBT_UUID blufi_descr_uuid_e2p = {LEN_UUID_16, {BLUFI_DESCR_E2P_UUID}};
|
|
|
|
static const tBT_UUID blufi_app_uuid = {LEN_UUID_16, {BLUFI_APP_UUID}};
|
2016-11-16 14:11:59 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2016-11-24 18:10:15 +00:00
|
|
|
BTC_BLUFI_ACT_INIT = 0,
|
|
|
|
BTC_BLUFI_ACT_DEINIT,
|
2016-12-28 04:02:43 +00:00
|
|
|
BTC_BLUFI_ACT_SEND_CFG_REPORT,
|
2017-12-25 10:04:07 +00:00
|
|
|
BTC_BLUFI_ACT_SEND_WIFI_LIST,
|
2017-12-22 07:02:33 +00:00
|
|
|
BTC_BLUFI_ACT_SEND_ERR_INFO,
|
2018-03-06 08:18:38 +00:00
|
|
|
BTC_BLUFI_ACT_SEND_CUSTOM_DATA,
|
2016-11-16 14:11:59 +00:00
|
|
|
} btc_blufi_act_t;
|
|
|
|
|
|
|
|
typedef union {
|
2016-12-28 04:02:43 +00:00
|
|
|
struct blufi_cfg_report {
|
|
|
|
wifi_mode_t opmode;
|
|
|
|
esp_blufi_sta_conn_state_t sta_conn_state;
|
|
|
|
uint8_t softap_conn_num;
|
|
|
|
esp_blufi_extra_info_t *extra_info;
|
|
|
|
int extra_info_len;
|
|
|
|
} wifi_conn_report;
|
2017-12-25 10:04:07 +00:00
|
|
|
/*
|
|
|
|
BTC_BLUFI_ACT_SEND_WIFI_LIST
|
|
|
|
*/
|
|
|
|
struct blufi_wifi_list {
|
|
|
|
uint16_t apCount;
|
|
|
|
esp_blufi_ap_record_t *list;
|
|
|
|
} wifi_list;
|
2017-12-22 07:02:33 +00:00
|
|
|
/*
|
|
|
|
BTC_BLUFI_ACT_SEND_ERR_INFO
|
|
|
|
*/
|
|
|
|
struct blufi_error_infor {
|
|
|
|
esp_blufi_error_state_t state;
|
|
|
|
} blufi_err_infor;
|
2018-03-06 08:18:38 +00:00
|
|
|
/*
|
|
|
|
BTC_BLUFI_ACT_SEND_CUSTOM_DATA
|
|
|
|
*/
|
|
|
|
struct blufi_custom_data {
|
|
|
|
uint8_t *data;
|
|
|
|
uint32_t data_len;
|
|
|
|
} custom_data;
|
2016-11-16 14:11:59 +00:00
|
|
|
} btc_blufi_args_t;
|
|
|
|
|
2021-03-31 04:51:48 +00:00
|
|
|
void btc_blufi_cb_to_app(esp_blufi_cb_event_t event, esp_blufi_cb_param_t *param);
|
2016-11-16 14:11:59 +00:00
|
|
|
void btc_blufi_cb_handler(btc_msg_t *msg);
|
|
|
|
void btc_blufi_call_handler(btc_msg_t *msg);
|
2016-12-28 04:02:43 +00:00
|
|
|
void btc_blufi_set_callbacks(esp_blufi_callbacks_t *callbacks);
|
2016-11-16 14:11:59 +00:00
|
|
|
|
2021-03-31 04:51:48 +00:00
|
|
|
void btc_blufi_recv_handler(uint8_t *data, int len);
|
|
|
|
void btc_blufi_send_notify(uint8_t *pkt, int pkt_len);
|
2016-12-28 04:02:43 +00:00
|
|
|
void btc_blufi_call_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
|
|
|
void btc_blufi_call_deep_free(btc_msg_t *msg);
|
2017-01-06 09:40:46 +00:00
|
|
|
|
|
|
|
uint16_t btc_blufi_get_version(void);
|
|
|
|
|
2016-11-16 14:11:59 +00:00
|
|
|
#endif /* __BTC_BLUFI_PRF_H__ */
|