I have a very basic C question. For context, I am working on a Nordic microcontroller and looking at one of their sample projects. The below function writes the value of value
to the buffer and that data gets sent to the Bluetooth client.
static ssize_t read_long_vnd(struct bt_conn *conn,
const struct bt_gatt_attr *attr, void *buf,
u16_t len, u16_t offset)
{
const char *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(vnd_long_value));
}
Now when I change one line to a hardcoded value:
const char *value = "A";
It works as expected. The first byte changes to 0x41 which is the ASCII value of 'A'.
Now what if I want to change the first byte to a number for example 32? I tried:
const char *value = 0x20;
but the first byte was not 0x20. I am thinking this change messes with the address location instead of the value or something.