End of response to an AT command

后端 未结 5 1996
Happy的楠姐
Happy的楠姐 2020-12-21 06:36

How to be sure what is end of an AT command send to GSM module?

I need some character or string that represent end of AT command for every case due to finding when

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 06:58

    Like you suppose it's \r\n.
    This defines the end of a line.

    And it makes only sense to process complete lines.

    Some commands respons with only OK\r\n, some with some data.
    So you should build at first a parser, who can detect complete lines, so they can be processed with a function that handles responses.

    Sometimes you can get even responses you don't request, like change events net login or the sim status #QSS: 2\r\n.

    So you need to know what answer you expect and wait until you get this

提交回复
热议问题