gpt4 book ai didi

c++ - 如何在 C++ Linux 中获得 3g 调制解调器信号强度?

转载 作者:IT王子 更新时间:2023-10-29 01:19:34 24 4
gpt4 key购买 nike

不使用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++ - 如何在 C++ Linux 中获得 3g 调制解调器信号强度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17322154/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com