延迟AT命令响应生成 [英] Delayed AT comand response generation

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

问题描述

嗨!我正在尝试在GSM调制解调器上运行一些AT命令。我在C#.Net 2005中这样做。


当我一个接一个地运行一些命令时,响应生成需要很长时间。第一个命令的响应返回为空白,即没有。并且它的实际响应作为对第3个命令的响应返回。


也就是说,由于响应生成延迟,响应被覆盖。当程序结束时,对最后2或3个命令的响应就会丢失。


请帮忙。



Amey

解决方案

发送AT命令后,您是否可以等待OK或来自调制解调器的消息等响应,然后发送下一个命令?


就个人而言,我会比horace1更进一步说你真的应该在发送第二个命令之前等待第一个命令的响应。这是正确的通信握手的一部分,你等待在发送下一个消息之前看到1条消息成功,除非指定协议允许你发送更多数据并回复初始数据(如TCP / IP) )。


你不知道调制解调器正在做什么(或它正在运行的软件的质量)你的命令可能导致网络动作,发送第二个命令而1已经是正在进行的操作可能会导致调制解调器处理问题,或者您可能要求它执行在第一个命令完成之前无法执行的操作。



就个人而言,我会比horace1更进一步说你真的应该在发送第二个命令之前等待第一个命令的响应。这是正确的通信握手的一部分,你等待在发送下一个消息之前看到1条消息成功,除非指定协议允许你发送更多数据并回复初始数据(如TCP / IP) )。


你不知道调制解调器正在做什么(或它正在运行的软件的质量)你的命令可能导致网络动作,发送第二个命令而1已经是正在进行中可能会导致调制解调器处理问题,或者您可能已经请求它执行在第一个命令完成之前无法执行的操作。




Re:



感谢您对我的问题感兴趣。但真正的问题在于此。


我正按照你说的方式,一次一个命令,等待第二个命令之前的回复。但我没有办法计算生成响应所需的时间。暂时我在每个命令后使用了7秒的延迟,希望在这段时间内生成所需的响应。但即使在等待7秒后,响应也被覆盖了。这些是一些基本的调制解调器查询命令。这就是我得到他们回复的方式:


INFO - AT + GMM:

INFO - AT + FCLASS =? :诺基亚N70


INFO - ATI1:好的


INFO - ATI2:

INFO - ATI3:0


INFO - ATI4:好的



诺基亚N70实际上是第一个命令生成的输出。 0表示0。实际上是命令At + FCLASS =?生成的输出。但它是第4命令的输出。在运行最后一个命令并等待其响应7秒后应用程序终止时,最后3个命令的输出就会丢失。如果我一次发送100封邮件,这将导致严重问题。


请帮忙。


Amey


Hi! I''m trying to run a few AT commands on a GSM modem. I''m doing this in C#.Net 2005.

When I run a few commands one after the other, the response generation takes a long time. The response for the 1st command is returned as blank, i.e nothing. And its actual response is returned as the response to the 3rd command.

That is, due to the delayed response generation, the responses are being over-written. When the program ends, the responses to the last 2 or 3 commands are simply lost.

Please help.


Amey

解决方案

after you send an AT command cannot you wait for a response such as OK or a message from the modem, then send the next command?


Personally I would go further than horace1 and say that you really should wait for the response from the first command before you send the second. That is part of what proper communications handshaking is about, you wait to see that 1 message is successful before sending the next, unless the protocol is specified as allowing you to send a more data with the reply to the initial data (like TCP/IP).

You do not know what the modem is doing (or the quality of the software it is running) your command may have caused network action, sending a second command while 1 is already in progress may be causing the modem handling problems or you may have requested that it does something that it can''t do until the first command has completed.


Personally I would go further than horace1 and say that you really should wait for the response from the first command before you send the second. That is part of what proper communications handshaking is about, you wait to see that 1 message is successful before sending the next, unless the protocol is specified as allowing you to send a more data with the reply to the initial data (like TCP/IP).

You do not know what the modem is doing (or the quality of the software it is running) your command may have caused network action, sending a second command while 1 is already in progress may be causing the modem handling problems or you may have requested that it does something that it can''t do until the first command has completed.



Re:



Thank u for taking interest in my problem. But the real problem lies here.

I''m going exactly the way u said, one command at a time, waiting for its reply before going for the 2nd command. But I don''t have any means of computing the time it takes for the response to be generated. For the time being I''m using a delay of abt 7 secs after each command, hoping the required response will b generated within this time. But even after waiting for 7 secs, the responses are being over-written.These are some basic modem query commands. This is how I get their responses :

INFO - AT+GMM :
INFO - AT+FCLASS=? : Nokia N70

INFO - ATI1 : OK

INFO - ATI2 :
INFO - ATI3 : 0

INFO - ATI4 : OK


The "Nokia N70" is actually the output generated by the 1st command. The "0" is actually the output generated by the command At+FCLASS=?. But it comes as the output to the 4th command. The outputs to the last 3 commands are simply lost as the application terminates after running the last command and waiting for its response for 7 seconds. This will cause serious problems when I will send 100 messages at a time.


Please help.

Amey


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

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