- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to implement a long characteristic more than 20 (+3) with BCM20737.
But the callback function regsitered by legattdb_regWriteHandleCb was called twice if I written 30bytes from iPhone.
First call with 18bytes, and second call with 30bytes.
I tried test the sample App long_characteristic.
The callback function 'long_characteristic_write_handler' was called only once with 30bytes.
I copied long_characteristics.c, long_characteristics.h and makefile.mk into my original app.
But the callback was called twice.
How to implement to let the callback be called once for one characteristic?
I am using WICED Smart SDK 2.1.1 on OS X Yosemite.
Thank you in advance.
Solved! Go to Solution.
- Labels:
-
SDK 2.X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved!
My own app's writeHandler was called once for one request after I removed build cache.
To remove the cache.
cd /Users/USERNAME/Documents/WICED/WICED-Smart-SDK-2.1.1/WICED-Smart-SDK/build
rm -rf *
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello minoru,
What is the difference between the Long Characteristic example that works and the one that you have written?
Thanks
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello JT,
I modified long_characteristic.c to trace length of the data as the following.
int long_characteristic_write_handler(LEGATTDB_ENTRY_HDR *p)
{
UINT8 writtenbyte;
UINT16 handle = legattdb_getHandle(p);
int len = legattdb_getAttrValueLen(p);
UINT8 *attrPtr = legattdb_getAttrValue(p);
BOOL changed;
ble_trace2("write_handler: handle %04x len:%d", handle, len);
ble_tracen(attrPtr, len);
if ((handle == HDLC_LONG_CHARACTERISTIC_VALUE) && (len <= 160))
{
// do not need to do anything. If we return 0, the value will be stored the GATT database
}
if ((len == 2) && (handle == HDLD_LONG_CHARACTERISTIC_LONG_CHARACTERISTIC_CLIENT_CONFIGURATION))
{
long_characteristic_client_configuration = attrPtr[0] + (attrPtr[1] << 8);
}
return 0;
}
1) original long_characteristic example
I did write request from my iPhone with 30 bytes.
Then I got trace output as the followings. The callback function was called once with 30 bytes.
long_characteristic_write_handler
09:22:16 BLE_high_un_adv:timer(0)
09:22:24 Connection is UP.
09:22:24 profile idle timer stop
09:22:24 connUp
09:22:24 noAdv
09:22:24 noAdv
09:22:31 - write_handler: handle 0311 len:30
09:22:31 - 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
09:22:31 - 17 18 19 20 21 22 23 24 25 26 27 28 29 30
09:22:31 WriteCb: handle 0000
2) own app
Now I copied the long_characteristic.c, long_characteristic.h and makefile.mk from example into my own app directory.
And I did write request again.
Then I got trace output as the followings. The callback function was called twice with 18 bytes and 30 bytes.
09:21:15 BLE_high_un_adv:timer(0)
09:21:28 Connection is UP.
09:21:28 profile idle timer stop
09:21:28 connUp
09:21:28 noAdv
09:21:28 noAdv
09:21:37 - write_handler: handle 0311 len:18
09:21:37 - 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
09:21:37 - 17 18
09:21:37 - write_handler: handle 0311 len:30
09:21:37 - 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
09:21:37 - 17 18 19 20 21 22 23 24 25 26 27 28 29 30
09:21:37 WriteCb: handle 0311
09:21:37 WriteCb: handle 0000
Why the write_handler in my own app was called twice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved!
My own app's writeHandler was called once for one request after I removed build cache.
To remove the cache.
cd /Users/USERNAME/Documents/WICED/WICED-Smart-SDK-2.1.1/WICED-Smart-SDK/build
rm -rf *
Thanks!