BLE UUID128

Alen59
Posts: 2
Joined: Mon Mar 19, 2018 12:00 pm

BLE UUID128

Postby Alen59 » Mon Apr 16, 2018 9:27 pm

hi,

I am using Bluetooth gatt_C demo and I want to change it to uuid128, this is what I am doing could you please advice?

I get this error: missing braces around initializer [-Werror=missing-braces] ----------> .uuid = {.uuid128 = REMOTE_SERVICE_UUID,},


const uint8_t REMOTE_SERVICE_UUID[] = {0x00, 0x03, 0x5b, 0x03, 0x58, 0xe6, 0x07, 0xdd, 0x02, 0x1a, 0x08, 0x12, 0x3a, 0x00, 0x03, 0x00};
const uint8_t REMOTE_NOTIFY_CHAR_UUID[] = {0x00, 0x00, 0x29, 0x02, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb};

static esp_bt_uuid_t remote_filter_service_uuid = {
.len = ESP_UUID_LEN_128,
.uuid = {.uuid128 = REMOTE_SERVICE_UUID,}, // missing braces around initializer [-Werror=missing-braces]

};

static esp_bt_uuid_t remote_filter_char_uuid = {
.len = ESP_UUID_LEN_128,
.uuid = {.uuid128 = REMOTE_NOTIFY_CHAR_UUID,},
};

thank you!

chegewara
Posts: 196
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE UUID128

Postby chegewara » Tue Apr 17, 2018 6:01 pm

Did you try:

Code: Select all

static esp_bt_uuid_t remote_filter_char_uuid = {
.len = ESP_UUID_LEN_128,
.uuid =  REMOTE_NOTIFY_CHAR_UUID,
};

or

Code: Select all

static esp_bt_uuid_t remote_filter_char_uuid = {
.len = ESP_UUID_LEN_128,
.uuid.uuid128 = REMOTE_NOTIFY_CHAR_UUID,
};

Alen59
Posts: 2
Joined: Mon Mar 19, 2018 12:00 pm

Re: BLE UUID128

Postby Alen59 » Thu Apr 19, 2018 8:01 pm

I get this error "error: initializer element is not computable at load time"

I can't copy an array value into another array with just = sign, uuid128 is an array with 16 member see below.

/// UUID type
typedef struct {
#define ESP_UUID_LEN_16 2
#define ESP_UUID_LEN_32 4
#define ESP_UUID_LEN_128 16
uint16_t len; /*!< UUID length, 16bit, 32bit or 128bit */
union {
uint16_t uuid16;
uint32_t uuid32;
uint8_t uuid128[ESP_UUID_LEN_128];
} uuid; /*!< UUID */
} __attribute__((packed)) esp_bt_uuid_t;

i tried this "memcpy((void*)&remote_filter_service_uuid.uuid.uuid128[0],(void*)&REMOTE_SERVICE_UUID[0], sizeof(REMOTE_SERVICE_UUID)); "but then i need to use it inside a function, then i started having other issues

User avatar
kolban
Posts: 1330
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: BLE UUID128

Postby kolban » Fri Apr 20, 2018 2:03 am

Based on what I'm understanding of the story and code fragments, the following should work:

Code: Select all

memcpy(remote_filter_service.uuid.uuid128, REMOTE_SERVICE_UUID, 16);


if it doesn't, post exactly what you coded and the full error message text.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 2 guests