如何在c linux中获得3g调制解调器信号强度?
作者:互联网
不使用AT命令我们如何获得3g调制解调器的信号强度? gdbus object for NetworkManager没有像getSignalStrength这样的方法.
网络管理器锁定设备文件,阻止使用AT命令.
nm-applet能够在系统托盘中显示信号强度.所以应该有办法从网络管理员那里获得信号强度!
nmcli是nm-applet的命令行计数器部分.我可以使用nmcli获得信号强度吗?其手册页中没有提到信号强度.
解决方法:
终于得到了答案!
在c中使用libnm-glib作用于dbus代理.从命令行使用..
gdbus call --system --dest org.freedesktop.ModemManager --object-path /org/freedesktop/ModemManager/Modems/0 --method org.freedesktop.ModemManager.Modem.Gsm.Network.GetSignalQuality
给你gsm调制解调器的信号强度.
If MM says it cannot get signal quality while connected, it’s because
there is only one AT port for all command and data. So when the AT port
is connected, no AT commands can be sent to gather signal quality.
You’ll need to either get a better modem with more AT ports, or switch
to a non-AT modem, like a QMI or MBIM powered one. — Aleksander Morgado
可以使用org.freedesktop.ModemManager.Modem.Gsm.Network.GetSignalQuality信号监听
gdbus monitor --system --dest org.freedesktop.NetworkManager --object-path /org/freedesktop/NetworkManager/Modems/0
Q. Does the proxy signals everytime there is a change in signal strength asynchonously or ModemManager polls modem periodically to get signal quality?
A. That depends on the modem being used; if the modem supports unsolicited
quality change indications, we’ll use them; otherwise MM will poll every
30s for signal quality values. The property values in the interface will
be updated once we get the new values (more or less). — Aleksander Morgado
标签:c-2,linux,network-programming,gio 来源: https://codeday.me/bug/20190517/1122076.html