Expand the macros. I think this might be the ones:
https://github.com/apache/mynewt-nimble ... ble_uuid.h
Code: Select all
#define BLE_UUID16_INIT(uuid16) \
{ \
.u = { \
.type = BLE_UUID_TYPE_16, \
}, \
.value = (uuid16), \
}
so
Code: Select all
(ble_uuid16_t) BLE_UUID16_INIT(uuid16)
means
Code: Select all
(ble_uuid16_t)
{ \
.u = { \
.type = BLE_UUID_TYPE_16, \
}, \
.value = (uuid16), \
}
which is an initialized structure. The next bit,
takes the address of the structure and casts it to a more generic structure pointer.
Code: Select all
/** Generic UUID type, to be used only as a pointer */
typedef struct {
/** Type of the UUID */
uint8_t type;
} ble_uuid_t;
That in turn is part of a union.
Code: Select all
/** Universal UUID type, to be used for any-UUID static allocation */
typedef union {
ble_uuid_t u;
ble_uuid16_t u16;
ble_uuid32_t u32;
ble_uuid128_t u128;
} ble_uuid_any_t;
The union has four possible interpretations, depending on the ble_uuid_t at the beginning of each member of the union. The last three all look like
Code: Select all
/** 16-bit UUID */
typedef struct {
ble_uuid_t u;
uint16_t value;
} ble_uuid16_t;
which embeds a ble_uuid_t, followed by more data. The first just doesn't have any more data.
I think the extra parens
are required by the macro to separate ble_uuid16_t from BLE_UUID16_INIT, maybe.