Answer the question
In order to leave comments, you need to log in
Physicaloid returns split response, how to fix?
When I receive a command from the controller, the answer I get is broken into parts, it breaks somehow randomly:
Here's what I get:
// 1 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]
// 2 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]
// 3 ответ
com.physicaloid.tutorial5 V/OTBET -﹕ [1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
com.physicaloid.tutorial5 V/OTBET -﹕ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 39]
Answer the question
In order to leave comments, you need to log in
I see clearly, you do not understand the difference between a block protocol and a stream protocol. In the streaming protocol (which is the serial port), any number of bytes that ended up in the buffer can fall into your application. Please write an application protocol in such a way as to be able to find the boundaries of messages.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question