# esp32-cwit-bleserver **Repository Path**: cwit49/esp32-cwit-bleserver ## Basic Information - **Project Name**: esp32-cwit-bleserver - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-30 - **Last Updated**: 2025-08-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 注 使用该功能,需要开启低功耗蓝牙4.2与5.0 # 添加服务 #include #include "cwit_nvs.h" #include "cwit_bleserver.h" #include "string.h" void readcalbak(uint8_t *readValue, uint16_t *len) { memcpy(readValue,"1234",4); *len = 4; cwitBle.send_noitify(0xff01,0x00f1,(uint8_t *)"4567",4); } void writecalbak(uint8_t *value,int len) { printf("rwal calbak:%s:%d\r\n",value,len); } extern "C" void app_main(void) { cwitNvs.nvs_init(); cwitBle.set_name("ESP32_TEST"); //添加服务1 cwitBle.ble_add_server(0xff01); uint8_t pream = ESP_GATT_CHAR_PROP_BIT_READ | ESP_GATT_CHAR_PROP_BIT_WRITE | ESP_GATT_CHAR_PROP_BIT_NOTIFY; cwitBle.server_add_charts(0xff01,0x00f1,pream,readcalbak,writecalbak); cwitBle.server_add_charts(0xff01,0x00f2,ESP_GATT_CHAR_PROP_BIT_READ,readcalbak,writecalbak); cwitBle.server_add_charts(0xff01,0x00f3,ESP_GATT_CHAR_PROP_BIT_WRITE,readcalbak,writecalbak); //添加服务2 cwitBle.ble_add_server(0xff02); cwitBle.server_add_charts(0xff02,0x00f1,pream,readcalbak,writecalbak); cwitBle.server_add_charts(0xff02,0x00f2,ESP_GATT_CHAR_PROP_BIT_READ,readcalbak,writecalbak); cwitBle.ble_enable(); printf("cwit hello"); }