I am having difficulty getting Thread Block-wise Transfers working correctly using the API from NCS v2.0.0. It was my understanding that the otCoapSendRequestBlockWise
function abstracts the process of managing block-wise transfers.
How is the otCoapSendRequestBlockWise
function supposed to be used? Depending on how I set up to transmit blocks, the receiving end either does not see anything, or it see's all 00's - not the programmed payload. Before going down the rabbit hold of what I am doing wrong, I would like to understand how otCoapSendRequestBlockWise should be used since there is NO examples anywhere on the web that I am aware of.
The following is my understanding (or misunderstanding) of the flow:
otCoapNewMessage
otCoapMessageInit
otCoapMessageGenerateToken
otCoapMessageSetToken
otCoapMessageAppendUriPathOptions
otCoapMessageAppendBlock1Option
otCoapMessageSetPayloadMarker
otMessageAppend
otCoapSendRequestBlockWise
I've tried many combinations of the above with no successful results. I have a few questions that may be clarified by a proper understanding of the expected flow.
- Is it necessary to set the payload marker and add payload prior to calling
otCoapSendRequestBlockWise
, or is the Blockwise TX Hook supposed to handle the first block? - Is
otCoapMessageAppendBlock1Option
a required step or doesotCoapSendRequestBlockWise
handle this under the hood? Removing it seems to cause the receiver side to execute the response callback instead of the block-wise RX callback. - Adding
otCoapMessageSetPayloadMarker
andotMessageAppend
causes the receiver to not receive anything. - Removing
otCoapMessageSetPayloadMarker
andotMessageAppend
causes the receiver to receive proper block sizes, but reads all 0's. - I have tried many combinations of the above and have yet to get something that works.