This message was posted on behalf of Intel Corporation
By taking a quick look at xbee.cxx (https://github.com/intel-iot-devkit/upm/blob/master/src/xbee/xbee.cxx), I Found that the library's value for its max buffer is 1024, which makes sense when comparing it to what you're telling me. I believe what the library does is, it receives up to 1024 bytes until the timeout. I think what you'd have to do in order to truncate the data is to change the max buffer value.
I would also suggest you to contact the developer of the library, the contact information can be found in the source code (https://github.com/intel-iot-devkit/upm/blob/master/src/xbee/xbee.cxx). I hope this helps.
Thanks for the answer,
I played around with the timeout and the buffer size. I found that, dataavailable() returns the buffered data when it encounters the end of packet in the transmission. No matter how much data is sent. For example:
- If 1024 bytes are sent from XCTU at once, the function captures the 1024 bytes.
- If 1024 bytes are sent from another Edison, calling the XBee write() function two consecutive times. It will capture the first 512 byte packet and sometimes loses the second packet.
I believe that a second packet may be lost while the Edison is busy processing the first packet (accessing the database for example).. I guess that catching the second packet depends on the timings on both sides.
This message was posted on behalf of Intel Corporation1 of 1 people found this helpful
I don't have access to an Xbee, therefore I can't try to replicate the behavior on my Edison. So, my best suggestion is that you open an issue on UPM's Github (https://github.com/intel-iot-devkit/upm/issues), that way you will be able to contact the developers directly. I believe this might be the best option as there seems to be an issue with the Xbee library.