This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Write Queued Characteristic with Less than 20 bytes

Good afternoon,

Following up my previous case, to which I got no reply, how can I use a queued write characteristic to write less than 20 bytes of data?

I'm using it to mainly write more than 20 bytes of data but when I write less than 20 bytes it just halts the application. How can I overcome it?

Thank you,

João

  • Not really. But you could consider storing the data in your application instead and use the characteristic only as a means of transportation. I think that is a more common way of handling this, instead of using QWR.

  • Hi Runar,

    I understand your proposal, but since I'm considering a characteristic with variable length, from 10bytes to 1024, I would have to create a protocol that would communicate the number of bytes being transmitted in every transaction, besides the actual data.

    Do you have any proposal or example to workout such variable length characteristic up to 1024bytes?

    Thank you,

    João

  • Hi,

    I think there are several projects you can look at. Not sure what is easiest, but there is the GLS project that has a protocol to transfer records. The ATT MTU throughput example is also set up to transfer larger amount of data. And there is our DFU solution.

    The easiest would probably be to set up something similar to the dfu solution. with one characteristic for data transfer and another one for control operations. start every packet with a length field, or maybe just packets that is divided across several MTU's.

    Thinking about it, you could have an ekstra characteristic as a control point that you use to notify the peer in case you are sending more than one MTU, and possibly to confirming crc across these packets. so if you are sending only one MTU (MTU size can be configured), you are not doing any additional work. But in case you are sending more data you notify the peer how many packets to expect, and do a crc confirm.

Related