You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "freertos/event_groups.h"
|
|
#include "esp_system.h"
|
|
#include "esp_log.h"
|
|
#include "nvs_flash.h"
|
|
#include "esp_bt.h"
|
|
|
|
#include "esp_gap_ble_api.h"
|
|
#include "esp_gatts_api.h"
|
|
#include "esp_bt_main.h"
|
|
#include "gatts_table_creat_demo.h"
|
|
#include "esp_gatt_common_api.h"
|
|
|
|
#define GATTS_TABLE_TAG "GATTS_TABLE_DEMO"
|
|
|
|
#define PROFILE_NUM 1
|
|
#define PROFILE_APP_IDX 0
|
|
#define ESP_APP_ID 0x55
|
|
#define SAMPLE_DEVICE_NAME "ESP_GATTS_DEMO"
|
|
#define SVC_INST_ID 0
|
|
|
|
/* The max length of characteristic value. When the GATT client performs a write or prepare write operation,
|
|
* the data length must be less than GATTS_DEMO_CHAR_VAL_LEN_MAX.
|
|
*/
|
|
#define GATTS_DEMO_CHAR_VAL_LEN_MAX 500
|
|
#define PREPARE_BUF_MAX_SIZE 1024
|
|
#define CHAR_DECLARATION_SIZE (sizeof(uint8_t))
|
|
|
|
#define ADV_CONFIG_FLAG (1 << 0)
|
|
#define SCAN_RSP_CONFIG_FLAG (1 << 1)
|
|
|
|
typedef struct
|
|
{
|
|
uint8_t *prepare_buf;
|
|
int prepare_len;
|
|
} prepare_type_env_t;
|
|
|
|
#define CONFIG_SET_RAW_ADV_DATA
|
|
|
|
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 ble_init(void);
|