Browse Source

更改设备名称

master
zwsd 3 years ago
parent
commit
3c7b2a4a59
  1. 14
      .gitignore
  2. 6
      CMakeLists.txt
  3. 11
      idfbat.bat
  4. 3
      main/ble_gatts_table.c
  5. 2
      main/ble_gatts_table.h
  6. 11
      main/gatts_table_creat_demo.c
  7. 1825
      sdkconfig
  8. 17
      sdkconfig.defaults
  9. 1696
      sdkconfig.defaults.esp32
  10. 1557
      sdkconfig.defaults.esp32c3
  11. 1710
      sdkconfig.defaults.esp32s3
  12. 1475
      sdkconfig.old

14
.gitignore

@ -0,0 +1,14 @@
/.vscode
/build
/tutorial
build/*.*
build/bootloader/bootloader.bin
build/bootloader/config/sdkconfig.json
build/bootloader/bootloader.elf
/Makefile

6
CMakeLists.txt

@ -0,0 +1,6 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(gatt_server_service_table_demo)

11
idfbat.bat

@ -0,0 +1,11 @@
@echo off
set /p value=please input com num:
if /i "%value:~0,3%" == "com" (
idf.py build
idf.py -p %value% flash
idf.py -p %value% monitor
)else (
echo error
pause
)

3
main/ble_gatts_table.c

@ -19,7 +19,8 @@ static uint8_t raw_adv_data[] = {
/* service uuid */
0x03, 0x03, 0xFF, 0x00,
/* device name */
0x0f, 0x09, 'E', 'S', 'P', '_', 'G', 'A', 'T', 'T', 'S', '_', 'D', 'E', 'M', 'O'};
// 0x0f, 0x09, 'E', 'S', 'P', '_', 'G', 'A', 'T', 'T', 'S', '_', 'D', 'E', 'M', 'O'};
0x09, 0x09, '1', '2', '3', '4', '5', '6', '7', '8'};
static uint8_t raw_scan_rsp_data[] = {
/* flags */
0x02, 0x01, 0x06,

2
main/ble_gatts_table.h

@ -17,7 +17,7 @@
#define PROFILE_NUM 1
#define PROFILE_APP_IDX 0
#define ESP_APP_ID 0x55
#define SAMPLE_DEVICE_NAME "ESP_GATTS_DEMO"
#define SAMPLE_DEVICE_NAME "12345678"
#define SVC_INST_ID 0
/* The max length of characteristic value. When the GATT client performs a write or prepare write operation,

11
main/gatts_table_creat_demo.c

@ -23,15 +23,14 @@ uint16_t table_handle_m;
void app_main(void)
{
uint8_t temp[5] = {68, 69, 70, 71, 72};
// uint8_t temp[5] = {68, 69, 70, 71, 72};
ble_init(&table_conn_id_m, &table_gatts_if_m, &table_handle_m);
while (true)
{
// ESP_LOGI("test", "%d,%d,%d", table_conn_id_m, table_gatts_if_m, table_handle_m);
if (table_handle_m != 0)
{
esp_ble_gatts_send_indicate(table_gatts_if_m, table_conn_id_m, table_handle_m, 5, temp, false);
}
// if (table_handle_m != 0)
// {
// esp_ble_gatts_send_indicate(table_gatts_if_m, table_conn_id_m, table_handle_m, 5, temp, false);
// }
}
}

1825
sdkconfig
File diff suppressed because it is too large
View File

17
sdkconfig.defaults

@ -0,0 +1,17 @@
# Override some defaults so BT stack is enabled
# in this example
#
# BT config
#
CONFIG_BT_ENABLED=y
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
CONFIG_BTDM_CTRL_MODE_BTDM=n
#
# ESP32-specific config
#
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y

1696
sdkconfig.defaults.esp32
File diff suppressed because it is too large
View File

1557
sdkconfig.defaults.esp32c3
File diff suppressed because it is too large
View File

1710
sdkconfig.defaults.esp32s3
File diff suppressed because it is too large
View File

1475
sdkconfig.old
File diff suppressed because it is too large
View File

Loading…
Cancel
Save