如何将 Mac OSX 菜单栏中的 Wifi RSSI 转换为 Wifi 强度级别?
我可以获取 Wifi RSSI 的值。但不知道如何将其转换为 Wifi 强度级别,正如我们在 Mac OSX 的菜单栏中看到的那样(如果我收到较强的 Wifi,则 wifi 状态将在 wifi 图标的所有 4 行上显示为粗体黑色)。
我可以使用任何方法或库来执行此操作吗?提前谢谢。
I can get the value of Wifi RSSI. but don't know how to convert it into level of Wifi strength as we can see in the menubar in Mac OSX (If I receive a strong Wifi, the wifi status will be bold black on all 4 lines of wifi icon).
Is there any methods or library that I can use to do this? Thx in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您不会在 API 中找到任何可以执行此操作的内容。
我认为您可能需要使用 Science™ 并进行手动检查,即手持笔记本电脑离开 WiFi 接入点,记下 WiFi 信号指示器图标发生变化时的 RSSI 值。这样做几次,您可能会发现相关性。我无法想象需要十到十五分钟才能获得良好的样本值范围。
如果可能的话,可能值得在不止一种类型的 Mac 上进行尝试。
I don't think you'll find anything in the API to do this.
I think you might have to Use Science™ and do a manual check, literally walking away from your WiFi access point with laptop in hand, noting down the RSSI values at which the WiFi signal indicator icon changes. Do this a few times and you'll likely find a correlation. I can't imagine it would take more than ten or fifteen minutes to get a good range of sample values.
It's probably worth trying it with more than one type of Mac, if possible.
没有用于此目的的公共 API。你必须自己弄清楚。您也许可以使用 (RSSI+100)/8 等简单的方法,然后将结果限制在 0 到 4 条之间。
此外,如果信号最终处于边界情况或跳跃,您将需要使用几秒钟的滚动平均值来防止条形跳跃。
PS:据我所知,苹果使用了一种更复杂的算法,其中考虑了传输速率。
There is no public API for this. You'll have to figure it out yourself. You might be able to use something simple like (RSSI+100)/8 and then clamp the result between 0 and 4 bars.
Also, you'll want to use a rolling average over a few seconds to keep the bars from jumping around if the signal ends up at a boundary case or jumps around.
PS: AFAIK, Apple uses a more complex algorithm which takes Transmit Rate into consideration.