海耶斯AT命令:检测远程挂机? [英] Hayes AT Commands: Detect Remote Hangup?
问题描述
你是如何认为当您的呼叫远程调制解调器挂断以编程方式检测?我写一个C程序,其与软调制解调器设备的/ dev / ttySL0
在Ubuntu Linux操作系统的接口。我能够使用配置海耶斯调制解调器AT命令,并与远程调制解调器通信。不过,我一直无法确定,我应该如何检测另一端已经挂了线。
How are you supposed to programatically detect when the remote modem on your call hangs up? I am writing a C program which interfaces with a SoftModem device /dev/ttySL0
in Ubuntu linux. I am able to configure the modem using Hayes AT commands and communicate with the remote modem. However, I haven't been able to determine how I'm supposed to detect that the other end has hung up the line.
我的调制解调器配置,这样,当另一端挂断了电话,设备打印 NO CARRIER
并切换到命令模式。但是,我不能使用 NO CARRIER
字符串,因为我不能保证调制解调器不会收到该字符串,而在数据模式。
I have the modem configured so that when the other end hangs up, the device prints NO CARRIER
and switches to command mode. However, I can't use the NO CARRIER
string because I can't guarantee that the modem won't receive that string while in data mode.
你是如何听远程挂断?
推荐答案
测试了 NO CARRIER
文字是不够的。本文频繁出现在净网站甚至Q&安培; A网站
Testing for NO CARRIER
as text will not suffice. This text frequently occurs on sites in the net, even on Q&A sites.
从调制解调器的到来,它应该包含在换行。
Coming from the modem, it should be enclosed in line breaks.
此外,您发现该文本后,你可以尝试切换到命令模式与 +++
。如果这样的作品,您的连接仍然存在,您可以重新连接并继续使用它。如果没有(因为你已经在那里和 +++
是一个无效的命令),连接已经一去不复返了。
Besides, after you detect that text, you can try to switch to command mode with +++
. If that works, your connection persists and you can reattach it and continue using it. If it doesn't (because you are already there and +++
is an invalid command), the connection has gone.
这篇关于海耶斯AT命令:检测远程挂机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!