ATParser
ATParser copied to clipboard
Parsing a string on a newline
How do I use this library to parse a response:
AT+CSGN\r\n
014532000023453\r\n
OK\r\n
I have tried
_parser.send("AT+CGSN")
&& _parser.recv("AT+CGSN\r\n%s\r\nOK",_deviceStatus.imei);
and various other combinations and I can only get it to parse to the 0 then stop.
AT> AT+CGSN
AT<
AT= AT+CGSN
AT<
AT= 0
AT< 14532000023453
AT<
AT= OK
Though it's not pretty:
_parser.recv("AT+CGSN%*[\r]%*[\n]%[^\r]%*[\r]%*[\n]OK%*[\r]%*[\n]",_deviceStatus.imei)
Thanks @sarahmarshy. I've had to move on to another project, but will try to test when I get a chance.