Hayes AT 命令:检测远程挂断? [英] Hayes AT Commands: Detect Remote Hangup?

查看:26
本文介绍了Hayes AT 命令:检测远程挂断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您应该如何以编程方式检测呼叫中的远程调制解调器何时挂断?我正在编写一个 C 程序,它与 Ubuntu linux 中的 SoftModem 设备 /dev/ttySL0 接口.我能够使用 Hayes 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.

你如何监听"远程挂断电话?

How do you "listen" for remote hang up?

推荐答案

测试 NO CARRIER 作为文本是不够的.这段文字经常出现在网络网站上,甚至出现在问答网站上.

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.

这篇关于Hayes AT 命令:检测远程挂断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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