Hi all,
I am facing one trivial issue while coding for BLE GATT characteristic , esp_attr_value_t ( esp_gatts_defs.h) is used in my code for pointing to values to be exchanged.
I need to update a signed value , say for example : time zone of -5 hours, the attribute_value parameter in the esp_attr_value_t
structure is unit8_t* , so its not allowing me to use signed numbers.
should'nt this be a void* instead of unit8_t* ?
ESP GATT Attribute value always unit8_t* ?
Re: ESP GATT Attribute value always unit8_t* ?
When I try to add a gatt characteristic in nRF connect for example, I cant pass a negative value. You can pass a string "-5", or cast the value into a signed datatype.
Re: ESP GATT Attribute value always unit8_t* ?
@Abhiram
If I have an allocated chunk of storage:
uint8_t* buffer = (uint8_t*)malloc(1000);
Then I can write different types of data there such as:
int a;
*(int*)(buffer) = a;
or:
short b;
*(short*)(buffer) = b;
see also:
https://stackoverflow.com/questions/226 ... -t-or-char
If I have an allocated chunk of storage:
uint8_t* buffer = (uint8_t*)malloc(1000);
Then I can write different types of data there such as:
int a;
*(int*)(buffer) = a;
or:
short b;
*(short*)(buffer) = b;
see also:
https://stackoverflow.com/questions/226 ... -t-or-char
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 162 guests