- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So I am trying to write a temperature characteristic. I am using..
#define HANDLE_SENSOR_TEMP_NOTIFY 0x7f
CHARACTERISTIC_UUID128 (0x007e, HANDLE_SENSOR_TEMP_NOTIFY, UUID_CHARACTERISTIC_TEMP,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY | LEGATTDB_CHAR_PROP_INDICATE,
LEGATTDB_PERM_READABLE, 2),
0x00, 0x00,
then...
UINT32 thermvolt = adc_readVoltage(THERMISTOR);
BLEPROFILE_DB_PDU db_pdu;
bleprofile_ReadHandle(HANDLE_SENSOR_TEMP_NOTIFY, &db_pdu);
db_pdu.pdu[0] = thermvolt & 0xFF;
db_pdu.pdu[1] = (thermvolt >> 😎 & 0xFF;
ble_trace1("pdu0: %d\n", thermvolt & 0xFF);
ble_trace1("pdu1: %d\n", (thermvolt >> 😎 & 0xFF);
bleprofile_WriteHandle(HANDLE_SENSOR_TEMP_NOTIFY, &db_pdu);
It seems that it works for certain numbers.. but if the number gets to a certain format, I am unable to read it on my smartphone application. E.g.. I can read 3030 (or '0''0').. but I cannot read the ADC reading of 1700 or initialize it to 0xFF, 0xFF..
Any ideas on how to remedy this? Thank you.
Solved! Go to Solution.
- Labels:
-
ReadWrite Characteristics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. Just wanted to make sure I didn't miss any declarations of any sort.
Turns out the issue was the application I was using was not able to view these values (for some reason). By switching over to a different app I was able to see the values I was writing into the characteristic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just modified hello_sensor to use 2 bytes instead of 7 and tested with various values including ffff. Lighblue displayed them just fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Could you please elaborate?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure what else to say. Following is the change that I did in the database
CHARACTERISTIC_UUID128 (0x0029, HANDLE_HELLO_SENSOR_VALUE_NOTIFY, UUID_HELLO_CHARACTERISTIC_NOTIFY,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY | LEGATTDB_CHAR_PROP_INDICATE,
LEGATTDB_PERM_READABLE, 2),
0xff,0xf0,
and in the interrupt handler
db_pdu.pdu[1]++;
Light Blue application is available through Apple Store.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. Just wanted to make sure I didn't miss any declarations of any sort.
Turns out the issue was the application I was using was not able to view these values (for some reason). By switching over to a different app I was able to see the values I was writing into the characteristic.