Browse Source

更改服务uuid

master
zwsd 3 years ago
parent
commit
af93d31a0f
  1. 20
      main/ble_spp_server_demo.c

20
main/ble_spp_server_demo.c

@ -37,8 +37,23 @@ static uint16_t table_handle_m;
#define SAMPLE_DEVICE_NAME s_module->bleName // The Device Name Characteristics in GAP #define SAMPLE_DEVICE_NAME s_module->bleName // The Device Name Characteristics in GAP
#define SPP_SVC_INST_ID 0 #define SPP_SVC_INST_ID 0
static const uint8_t spp_service_uuid128[16] = {
/* LSB <--------------------------------------------------------------------------------> MSB */
0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x01, 0x00, 0x40, 0x6E, //
};
// static const uint8_t spp_char_uuid128_rx[16] = {
// /* LSB <--------------------------------------------------------------------------------> MSB */
// 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x02, 0x00, 0x40, 0x6E, //
// };
// static const uint8_t spp_char_uuid128_tx[16] = {
// /* LSB <--------------------------------------------------------------------------------> MSB */
// 0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x03, 0x00, 0x40, 0x6E, //
// };
/// SPP Service /// SPP Service
static const uint16_t spp_service_uuid = 0xABF0;
// static const uint16_t spp_service_uuid = 0xABF0;
/// Characteristic UUID /// Characteristic UUID
#define ESP_GATT_UUID_SPP_DATA_RECEIVE 0xABF1 #define ESP_GATT_UUID_SPP_DATA_RECEIVE 0xABF1
#define ESP_GATT_UUID_SPP_DATA_NOTIFY 0xABF2 #define ESP_GATT_UUID_SPP_DATA_NOTIFY 0xABF2
@ -174,7 +189,8 @@ static const uint8_t spp_heart_beat_ccc[2] = {0x00, 0x00};
/// Full HRS Database Description - Used to add attributes into the database /// Full HRS Database Description - Used to add attributes into the database
static const esp_gatts_attr_db_t spp_gatt_db[SPP_IDX_NB] = { static const esp_gatts_attr_db_t spp_gatt_db[SPP_IDX_NB] = {
// SPP - Service Declaration // SPP - Service Declaration
[SPP_IDX_SVC] = {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&primary_service_uuid, ESP_GATT_PERM_READ, sizeof(spp_service_uuid), sizeof(spp_service_uuid), (uint8_t *)&spp_service_uuid}},
[SPP_IDX_SVC] = {{ESP_GATT_AUTO_RSP},
{ESP_UUID_LEN_16, (uint8_t *)&primary_service_uuid, ESP_GATT_PERM_READ, sizeof(spp_service_uuid128), sizeof(spp_service_uuid128), (uint8_t *)&spp_service_uuid128}},
// SPP - data receive characteristic Declaration // SPP - data receive characteristic Declaration
[SPP_IDX_SPP_DATA_RECV_CHAR] = {{ESP_GATT_AUTO_RSP}, [SPP_IDX_SPP_DATA_RECV_CHAR] = {{ESP_GATT_AUTO_RSP},

Loading…
Cancel
Save