Browse Source

更改server,char uuid

master
zwsd 3 years ago
parent
commit
b0fd41a7b3
  1. 28
      main/gatts_table_creat_demo.c

28
main/gatts_table_creat_demo.c

@ -159,11 +159,26 @@ static struct gatts_profile_inst heart_rate_profile_tab[PROFILE_NUM] = {
};
/* Service */
static const uint16_t GATTS_SERVICE_UUID_TEST = 0x00FF;
static const uint16_t GATTS_CHAR_UUID_TEST_A = 0xFF01;
static const uint16_t GATTS_CHAR_UUID_TEST_B = 0xFF02;
// static const uint16_t GATTS_SERVICE_UUID_TEST = 0x00FF;
// static const uint16_t GATTS_CHAR_UUID_TEST_A = 0xFF01;
// static const uint16_t GATTS_CHAR_UUID_TEST_B = 0xFF02;
// static const uint16_t GATTS_CHAR_UUID_TEST_C = 0xFF03;
static const uint8_t adv_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 adv_char_uuid128_a[16] = {
/* LSB <--------------------------------------------------------------------------------> MSB */
0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x02, 0x00, 0x40, 0x6E, //
};
static const uint8_t adv_char_uuid128_b[16] = {
/* LSB <--------------------------------------------------------------------------------> MSB */
0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x03, 0x00, 0x40, 0x6E, //
};
static const uint16_t primary_service_uuid = ESP_GATT_UUID_PRI_SERVICE;
static const uint16_t character_declaration_uuid = ESP_GATT_UUID_CHAR_DECLARE;
static const uint16_t character_client_config_uuid = ESP_GATT_UUID_CHAR_CLIENT_CONFIG;
@ -173,14 +188,13 @@ static const uint8_t char_prop_read_write_notify = ESP_GATT_CHAR_PROP_BIT_WRIT
static const uint8_t heart_measurement_ccc[2] = {0x00, 0x00};
static const uint8_t char_value[4] = {0x11, 0x22, 0x33, 0x44};
/* Full Database Description - Used to add attributes into the database */
static const esp_gatts_attr_db_t gatt_db[HRS_IDX_NB] =
{
// Service Declaration
[IDX_SVC] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&primary_service_uuid, ESP_GATT_PERM_READ,
sizeof(uint16_t), sizeof(GATTS_SERVICE_UUID_TEST), (uint8_t *)&GATTS_SERVICE_UUID_TEST}},
sizeof(adv_service_uuid128), sizeof(adv_service_uuid128), (uint8_t *)&adv_service_uuid128}},
/* Characteristic Declaration */
[IDX_CHAR_A] =
@ -189,7 +203,7 @@ static const esp_gatts_attr_db_t gatt_db[HRS_IDX_NB] =
/* Characteristic Value */
[IDX_CHAR_VAL_A] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&GATTS_CHAR_UUID_TEST_A, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_128, (uint8_t *)&adv_char_uuid128_a, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(char_value), (uint8_t *)char_value}},
/* Client Characteristic Configuration Descriptor */
@ -204,7 +218,7 @@ static const esp_gatts_attr_db_t gatt_db[HRS_IDX_NB] =
/* Characteristic Value */
[IDX_CHAR_VAL_B] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&GATTS_CHAR_UUID_TEST_B, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_128, (uint8_t *)&adv_char_uuid128_b, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(char_value), (uint8_t *)char_value}},
// /* Characteristic Declaration */

Loading…
Cancel
Save