Reputation: 1247
I would like to do 2 things.
What is a symbol of end of response? I'm reading char using for(), but I do not know number of signs. Example below doesn't work properly
while(readCharUART()!=10) {};
while(readCharUART()!=13)
{
getchar() = ..
}
Upvotes: 1
Views: 195
Reputation: 28208
You are on the right track.
For RING
then yes, the correct way to do it is to have one thread just read modem responses until you get the Unsolicited result code RING
. If you from time to time want to run AT commands (say ATA), then you should let this thread do that as well, e.g. you have one thread that takes care of both issuing AT commands and monitor for UR codes.
Regarding formatting of responses from the modem, this is well described in chapter 5.7.1 Responses in the ITU V.250 standard. Short summary (reading the spec is highly recommended!):
<header>RING<trailer>
where header and trailer is both "\r\n"
(unless the modem is configured strangely).
Upvotes: 1