对 AT 命令的响应结束 [英] End of response to an AT command

查看:47
本文介绍了对 AT 命令的响应结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定发送到 GSM 模块的 AT 命令的结尾是什么?

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

我需要一些字符或字符串来代表每种情况下 AT 命令的结束,因为我发现何时收到整个响应.

I need some character or string that represent end of AT command for every case due to finding when whole response is received.

我猜它有一些带有 "序列的东西,但是,这个序列可能在 AT 命令响应的开头?

I guess it have something with " " sequence but, this sequence could be at the beginning of AT command response?

推荐答案

就像你想象的那样 .
这定义了一行的结尾.

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

而且只有处理完整的行才有意义.

And it makes only sense to process complete lines.

有些命令只响应 OK ,有些命令响应一些数据.
所以你应该首先构建一个解析器,它可以检测完整的行,这样它们就可以使用处理响应的函数进行处理.

Some commands respons with only OK , 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.

有时您甚至可以得到您不要求的响应,例如更改事件 net login 或 sim 状态 #QSS: 2 .

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

所以你需要知道你期望什么答案,然后等到你得到这个

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

这篇关于对 AT 命令的响应结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆