mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 04:21:00 +02:00
IDF master d93887f9f (#5336)
* Update toolchain * Update package_esp32_index.template.json * add optional component dependencies after Kconfig options are known (#5404) Until this commit, Kconfig options (e.g. CONFIG_TINYUSB_ENABLED) were used in conditions preceding idf_component_register to determine which components need to be added to `arduino` component requirements. However the Kconfig options aren't known at the early expansion stage, when the component CMakeLists.txt files are expanded the first time and requirements are evaluated. So all the conditions evaluated as if the options were not set. This commit changes the logic to only add these components as dependencies when the Kconfig options are known. Dependencies become "weak", which means that if one of the components isn't included into the build for some reason, it is not added as a dependency. This may happen, for example, if the component is not present in the `components` directory or is excluded by setting `COMPONENTS` variable in the project CMakeLists.txt file. This also ensures that if the component is not present, it will not be added as a dependency, and this will allow the build to proceed. Follow-up to https://github.com/espressif/arduino-esp32/pull/5391. Closes https://github.com/espressif/arduino-esp32/issues/5319. * IDF master d93887f9f * PlatformIO updates for CI (#5387) * Update PlatformIO CI build script - Switch to the latest toolchains 8.4.0 for ESP32, ESP32S2, ESP32C3 - Use PlatformIO from master branch for better robustness * Update package.json for PlatformIO Co-authored-by: Ivan Grokhotkov <ivan@espressif.com> Co-authored-by: Valerii Koval <valeros@users.noreply.github.com>
This commit is contained in:
@ -15,8 +15,6 @@
|
||||
#ifndef __ESP_BLUFI_API_H__
|
||||
#define __ESP_BLUFI_API_H__
|
||||
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_types.h"
|
||||
|
||||
@ -115,6 +113,11 @@ typedef struct {
|
||||
int8_t rssi; /**< signal strength of AP */
|
||||
} esp_blufi_ap_record_t;
|
||||
|
||||
/// Bluetooth address length
|
||||
#define ESP_BD_ADDR_LEN 6
|
||||
/// Bluetooth device address
|
||||
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
||||
|
||||
/**
|
||||
* @brief BLUFI callback parameters union
|
||||
*/
|
||||
@ -404,19 +407,6 @@ esp_err_t esp_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list
|
||||
*/
|
||||
uint16_t esp_blufi_get_version(void);
|
||||
|
||||
/**
|
||||
* @brief Close a connection a remote device.
|
||||
*
|
||||
* @param[in] gatts_if: GATT server access interface
|
||||
* @param[in] conn_id: connection ID to be closed.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_blufi_close(esp_gatt_if_t gatts_if, uint16_t conn_id);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief This function is called to send blufi error information
|
@ -0,0 +1,202 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __BLUFI_INT_H__
|
||||
#define __BLUFI_INT_H__
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_blufi_api.h"
|
||||
#if (BLUFI_INCLUDED == TRUE)
|
||||
|
||||
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
|
||||
#define BTC_BLUFI_SUB_VER 0x02 //Version + Subversion
|
||||
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
|
||||
|
||||
typedef UINT8 tGATT_IF;
|
||||
/* service engine control block */
|
||||
typedef struct {
|
||||
/* Protocol reference */
|
||||
tGATT_IF gatt_if;
|
||||
UINT8 srvc_inst;
|
||||
UINT16 handle_srvc;
|
||||
UINT16 handle_char_p2e;
|
||||
UINT16 handle_char_e2p;
|
||||
UINT16 handle_descr_e2p;
|
||||
UINT16 conn_id;
|
||||
BOOLEAN is_connected;
|
||||
BD_ADDR remote_bda;
|
||||
UINT32 trans_id;
|
||||
UINT8 congest;
|
||||
UINT16 frag_size;
|
||||
#define BLUFI_PREPAIR_BUF_MAX_SIZE 1024
|
||||
uint8_t *prepare_buf;
|
||||
int prepare_len;
|
||||
/* Control reference */
|
||||
esp_blufi_callbacks_t *cbs;
|
||||
BOOLEAN enabled;
|
||||
uint8_t send_seq;
|
||||
uint8_t recv_seq;
|
||||
uint8_t sec_mode;
|
||||
uint8_t *aggr_buf;
|
||||
uint16_t total_len;
|
||||
uint16_t offset;
|
||||
} tBLUFI_ENV;
|
||||
|
||||
/* BLUFI protocol */
|
||||
struct blufi_hdr{
|
||||
uint8_t type;
|
||||
uint8_t fc;
|
||||
uint8_t seq;
|
||||
uint8_t data_len;
|
||||
uint8_t data[0];
|
||||
};
|
||||
typedef struct blufi_hdr blufi_hd_t;
|
||||
|
||||
struct blufi_frag_hdr {
|
||||
uint8_t type;
|
||||
uint8_t fc;
|
||||
uint8_t seq;
|
||||
uint8_t data_len;
|
||||
uint16_t total_len;
|
||||
uint8_t content[0];
|
||||
};
|
||||
typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||
|
||||
#if GATT_DYNAMIC_MEMORY == FALSE
|
||||
extern tBLUFI_ENV blufi_env;
|
||||
#else
|
||||
extern tBLUFI_ENV *blufi_env_ptr;
|
||||
#define blufi_env (*blufi_env_ptr)
|
||||
#endif
|
||||
|
||||
#define BLUFI_DATA_SEC_MODE_CHECK_MASK 0x01
|
||||
#define BLUFI_DATA_SEC_MODE_ENC_MASK 0x02
|
||||
#define BLUFI_CTRL_SEC_MODE_CHECK_MASK 0x10
|
||||
#define BLUFI_CTRL_SEC_MODE_ENC_MASK 0x20
|
||||
#define BLUFI_MAX_DATA_LEN 255
|
||||
|
||||
// packet type
|
||||
#define BLUFI_TYPE_MASK 0x03
|
||||
#define BLUFI_TYPE_SHIFT 0
|
||||
#define BLUFI_SUBTYPE_MASK 0xFC
|
||||
#define BLUFI_SUBTYPE_SHIFT 2
|
||||
|
||||
#define BLUFI_GET_TYPE(type) ((type) & BLUFI_TYPE_MASK)
|
||||
#define BLUFI_GET_SUBTYPE(type) (((type) & BLUFI_SUBTYPE_MASK) >>BLUFI_SUBTYPE_SHIFT)
|
||||
#define BLUFI_BUILD_TYPE(type, subtype) (((type) & BLUFI_TYPE_MASK) | ((subtype)<<BLUFI_SUBTYPE_SHIFT))
|
||||
|
||||
#define BLUFI_TYPE_CTRL 0x0
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_ACK 0x00
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_SET_SEC_MODE 0x01
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_SET_WIFI_OPMODE 0x02
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_CONN_TO_AP 0x03
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP 0x04
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS 0x05
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA 0x06
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION 0x07
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONNECT_BLE 0x08
|
||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_LIST 0x09
|
||||
|
||||
#define BLUFI_TYPE_DATA 0x1
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_NEG 0x00
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_STA_BSSID 0x01
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_STA_SSID 0x02
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_STA_PASSWD 0x03
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_SSID 0x04
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_PASSWD 0x05
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM 0x06
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_AUTH_MODE 0x07
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL 0x08
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_USERNAME 0x09
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_CA 0x0a
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_CLIENT_CERT 0x0b
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SERVER_CERT 0x0c
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY 0x0d
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY 0x0e
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_REP 0x0f
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION 0x10
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST 0x11
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_ERROR_INFO 0x12
|
||||
#define BLUFI_TYPE_DATA_SUBTYPE_CUSTOM_DATA 0x13
|
||||
#define BLUFI_TYPE_IS_CTRL(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_CTRL)
|
||||
#define BLUFI_TYPE_IS_DATA(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_DATA)
|
||||
|
||||
#define BLUFI_TYPE_IS_CTRL_ACK(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_ACK)
|
||||
#define BLUFI_TYPE_IS_CTRL_START_NEG(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_START_NEG)
|
||||
#define BLUFI_TYPE_IS_CTRL_STOP_NEG(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_STOP_NEG)
|
||||
#define BLUFI_TYPE_IS_CTRL_SET_WIFI_OPMODE(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_SET_WIFI_OPMODE)
|
||||
#define BLUFI_TYPE_IS_CTRL_CONN_WIFI(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_CONN_TO_AP)
|
||||
#define BLUFI_TYPE_IS_CTRL_DISCONN_WIFI(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP)
|
||||
#define BLUFI_TYPE_IS_CTRL_GET_WIFI_STATUS(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS)
|
||||
#define BLUFI_TYPE_IS_CTRL_DEAUTHENTICATE_STA(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA)
|
||||
#define BLUFI_TYPE_IS_CTRL_GET_VERSION(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION)
|
||||
|
||||
#define BLUFI_TYPE_IS_DATA_NEG(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_NEG)
|
||||
#define BLUFI_TYPE_IS_DATA_STA_BSSID(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_STA_BSSID)
|
||||
#define BLUFI_TYPE_IS_DATA_STA_SSID(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_STA_SSID)
|
||||
#define BLUFI_TYPE_IS_DATA_STA_PASSWD(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_STA_PASSWD)
|
||||
#define BLUFI_TYPE_IS_DATA_SOFTAP_SSID(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_SSID)
|
||||
#define BLUFI_TYPE_IS_DATA_SOFTAP_PASSWD(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_PASSWD)
|
||||
#define BLUFI_TYPE_IS_DATA_SOFTAP_MAX_CONN_NUM(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM)
|
||||
#define BLUFI_TYPE_IS_DATA_SOFTAP_AUTH_MODE(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_AUTH_MODE)
|
||||
#define BLUFI_TYPE_IS_DATA_SOFTAP_CHANNEL(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL)
|
||||
#define BLUFI_TYPE_IS_DATA_USERNAME(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_USERNAME)
|
||||
#define BLUFI_TYPE_IS_DATA_CA(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_CA)
|
||||
#define BLUFI_TYPE_IS_DATA_CLEINT_CERT(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_CLIENT_CERT)
|
||||
#define BLUFI_TYPE_IS_DATA_SERVER_CERT(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SERVER_CERT)
|
||||
#define BLUFI_TYPE_IS_DATA_CLIENT_PRIV_KEY(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY)
|
||||
#define BLUFI_TYPE_IS_DATA_SERVER_PRIV_KEY(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY)
|
||||
#define BLUFI_TYPE_IS_DATA_ERROR_INFO(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_ERROR_INFO)
|
||||
|
||||
// packet frame control
|
||||
#define BLUFI_FC_ENC_MASK 0x01
|
||||
#define BLUFI_FC_CHECK_MASK 0x02
|
||||
#define BLUFI_FC_DIR_MASK 0x04
|
||||
#define BLUFI_FC_REQ_ACK_MASK 0x08
|
||||
#define BLUFI_FC_FRAG_MASK 0x10
|
||||
|
||||
#define BLUFI_FC_ENC 0x01
|
||||
#define BLUFI_FC_CHECK 0x02
|
||||
#define BLUFI_FC_DIR_P2E 0x00
|
||||
#define BLUFI_FC_DIR_E2P 0x04
|
||||
#define BLUFI_FC_REQ_ACK 0x08
|
||||
#define BLUFI_FC_FRAG 0x10
|
||||
|
||||
#define BLUFI_FC_IS_ENC(fc) ((fc) & BLUFI_FC_ENC_MASK)
|
||||
#define BLUFI_FC_IS_CHECK(fc) ((fc) & BLUFI_FC_CHECK_MASK)
|
||||
#define BLUFI_FC_IS_DIR_P2E(fc) ((fc) & BLUFI_FC_DIR_P2E_MASK)
|
||||
#define BLUFI_FC_IS_DIR_E2P(fc) (!((fc) & BLUFI_DIR_P2E_MASK))
|
||||
#define BLUFI_FC_IS_REQ_ACK(fc) ((fc) & BLUFI_FC_REQ_ACK_MASK)
|
||||
#define BLUFI_FC_IS_FRAG(fc) ((fc) & BLUFI_FC_FRAG_MASK)
|
||||
|
||||
/* default GATT MTU size over LE link
|
||||
*/
|
||||
#define GATT_DEF_BLE_MTU_SIZE 23
|
||||
/* BLUFI HEADER + TOTAL(REMAIN) LENGTH + CRC + L2CAP RESERVED */
|
||||
#define BLUFI_MTU_RESERVED_SIZE (sizeof(struct blufi_hdr) + 2 + 2 + 3)
|
||||
#define BLUFI_FRAG_DATA_DEFAULT_LEN (GATT_DEF_BLE_MTU_SIZE - BLUFI_MTU_RESERVED_SIZE)
|
||||
|
||||
//function declare
|
||||
void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len);
|
||||
|
||||
void btc_blufi_send_encap(uint8_t type, uint8_t *data, int data_len);
|
||||
|
||||
void btc_blufi_set_callbacks(esp_blufi_callbacks_t *callbacks);
|
||||
|
||||
void btc_blufi_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
|
||||
void btc_blufi_cb_deep_free(btc_msg_t *msg);
|
||||
|
||||
#endif /* __BLUFI_INT_H__ */
|
||||
#endif ///BLUFI_INCLUDED == TRUE
|
@ -0,0 +1,77 @@
|
||||
#ifndef __ESP_BLUFI_H__
|
||||
#define __ESP_BLUFI_H__
|
||||
|
||||
#include "esp_blufi_api.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/ble.h"
|
||||
#include "modlog/modlog.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "esp_gap_ble_api.h"
|
||||
#endif
|
||||
|
||||
#define BLUFI_APP_UUID 0xFFFF
|
||||
#define BLUFI_DEVICE_NAME "BLUFI_DEVICE"
|
||||
|
||||
#ifdef CONFIG_BT_NIMBLE_ENABLED
|
||||
struct ble_hs_cfg;
|
||||
struct ble_gatt_register_ctxt;
|
||||
struct gatt_value {
|
||||
struct os_mbuf *buf;
|
||||
uint16_t val_handle;
|
||||
uint8_t type;
|
||||
void *ptr;
|
||||
};
|
||||
#define SERVER_MAX_VALUES 3
|
||||
#define MAX_VAL_SIZE 512
|
||||
extern struct gatt_value gatt_values[SERVER_MAX_VALUES];
|
||||
/* GATT server callback */
|
||||
void esp_blufi_gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
|
||||
|
||||
/* Initialise gatt server */
|
||||
int esp_blufi_gatt_svr_init(void);
|
||||
void esp_blufi_btc_init(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
/**
|
||||
* @brief Close a connection a remote device.
|
||||
*
|
||||
* @param[in] gatts_if: GATT server access interface
|
||||
* @param[in] conn_id: connection ID to be closed.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_blufi_close(uint8_t gatts_if, uint16_t conn_id);
|
||||
void esp_blufi_gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param);
|
||||
#endif
|
||||
|
||||
/* Initialise blufi profile */
|
||||
uint8_t esp_blufi_init(void);
|
||||
|
||||
/* start advertising */
|
||||
void bleprph_advertise(void);
|
||||
|
||||
/* send notifications */
|
||||
void esp_blufi_send_notify(void *arg);
|
||||
|
||||
/* Deinitialise blufi */
|
||||
void esp_blufi_deinit(void);
|
||||
/* disconnect */
|
||||
void esp_blufi_disconnect(void);
|
||||
|
||||
/* Stop advertisement */
|
||||
void esp_blufi_adv_stop(void);
|
||||
|
||||
/* Start advertisement */
|
||||
void esp_blufi_adv_start(void);
|
||||
|
||||
void esp_blufi_send_encap(void *arg);
|
||||
|
||||
#endif/* _ESP_BLUFI_ */
|
@ -0,0 +1,111 @@
|
||||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __BTC_BLUFI_PRF_H__
|
||||
#define __BTC_BLUFI_PRF_H__
|
||||
|
||||
#include "blufi_int.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_blufi_api.h"
|
||||
#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}};
|
||||
|
||||
typedef enum {
|
||||
BTC_BLUFI_ACT_INIT = 0,
|
||||
BTC_BLUFI_ACT_DEINIT,
|
||||
BTC_BLUFI_ACT_SEND_CFG_REPORT,
|
||||
BTC_BLUFI_ACT_SEND_WIFI_LIST,
|
||||
BTC_BLUFI_ACT_SEND_ERR_INFO,
|
||||
BTC_BLUFI_ACT_SEND_CUSTOM_DATA,
|
||||
} btc_blufi_act_t;
|
||||
|
||||
typedef union {
|
||||
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;
|
||||
/*
|
||||
BTC_BLUFI_ACT_SEND_WIFI_LIST
|
||||
*/
|
||||
struct blufi_wifi_list {
|
||||
uint16_t apCount;
|
||||
esp_blufi_ap_record_t *list;
|
||||
} wifi_list;
|
||||
/*
|
||||
BTC_BLUFI_ACT_SEND_ERR_INFO
|
||||
*/
|
||||
struct blufi_error_infor {
|
||||
esp_blufi_error_state_t state;
|
||||
} blufi_err_infor;
|
||||
/*
|
||||
BTC_BLUFI_ACT_SEND_CUSTOM_DATA
|
||||
*/
|
||||
struct blufi_custom_data {
|
||||
uint8_t *data;
|
||||
uint32_t data_len;
|
||||
} custom_data;
|
||||
} btc_blufi_args_t;
|
||||
|
||||
void btc_blufi_cb_to_app(esp_blufi_cb_event_t event, esp_blufi_cb_param_t *param);
|
||||
void btc_blufi_cb_handler(btc_msg_t *msg);
|
||||
void btc_blufi_call_handler(btc_msg_t *msg);
|
||||
void btc_blufi_set_callbacks(esp_blufi_callbacks_t *callbacks);
|
||||
|
||||
void btc_blufi_recv_handler(uint8_t *data, int len);
|
||||
void btc_blufi_send_notify(uint8_t *pkt, int pkt_len);
|
||||
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);
|
||||
|
||||
uint16_t btc_blufi_get_version(void);
|
||||
|
||||
#endif /* __BTC_BLUFI_PRF_H__ */
|
@ -26,7 +26,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_BT_CTRL_CONFIG_MAGIC_VAL 0x5A5AA5A5
|
||||
#define ESP_BT_CTRL_CONFIG_VERSION 0x02103310
|
||||
#define ESP_BT_CTRL_CONFIG_VERSION 0x02104270
|
||||
|
||||
#define ESP_BT_HCI_TL_MAGIC_VALUE 0xfadebead
|
||||
#define ESP_BT_HCI_TL_VERSION 0x00010000
|
||||
@ -137,6 +137,21 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
|
||||
#define MESH_DUPLICATE_SCAN_CACHE_SIZE 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_CTRL_AGC_RECORRECT_EN
|
||||
#define BT_CTRL_AGC_RECORRECT_EN CONFIG_BT_CTRL_AGC_RECORRECT_EN
|
||||
#else
|
||||
#define BT_CTRL_AGC_RECORRECT_EN 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN
|
||||
#define BT_CTRL_CODED_AGC_RECORRECT CONFIG_BT_CTRL_CODED_AGC_RECORRECT_EN
|
||||
#else
|
||||
#define BT_CTRL_CODED_AGC_RECORRECT 0
|
||||
#endif
|
||||
|
||||
#define AGC_RECORRECT_EN ((BT_CTRL_AGC_RECORRECT_EN << 0) | (BT_CTRL_CODED_AGC_RECORRECT <<1))
|
||||
|
||||
|
||||
#define CFG_MASK_BIT_SCAN_DUPLICATE_OPTION (1<<0)
|
||||
|
||||
#define CFG_NASK CFG_MASK_BIT_SCAN_DUPLICATE_OPTION
|
||||
@ -170,6 +185,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
|
||||
.coex_phy_coded_tx_rx_time_limit = CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
||||
.hw_target_code = BLE_HW_TARGET_CODE_ESP32C3_CHIP_ECO0, \
|
||||
.slave_ce_len_min = SLAVE_CE_LEN_MIN_DEFAULT, \
|
||||
.hw_recorrect_en = AGC_RECORRECT_EN, \
|
||||
};
|
||||
|
||||
#else
|
||||
@ -235,6 +251,7 @@ typedef struct {
|
||||
uint8_t coex_phy_coded_tx_rx_time_limit; /*!< limit on max tx/rx time in case of connection using CODED-PHY with Wi-Fi coexistence */
|
||||
uint32_t hw_target_code; /*!< hardware target */
|
||||
uint8_t slave_ce_len_min;
|
||||
uint8_t hw_recorrect_en;
|
||||
} esp_bt_controller_config_t;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user