适用于 Linux 的 C 或 Java 无线 API
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5102186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Wireless API for Linux in C or Java
提问by Dimitri
my team and I are working in a project based on the drone Parrot API. We are trying to find an api to write a small program which can scan the wireless network and selects the drone ESSID. Our main language is C but Java is also appreciated.
我和我的团队正在一个基于无人机 Parrot API 的项目中工作。我们正在寻找一个api来编写一个小程序,可以扫描无线网络并选择无人机ESSID。我们的主要语言是 C,但 Java 也很受欢迎。
I tried to look if exist any API for the iwlist/iwconfig command but i did not find anything. Can someone help me plz? Any example (code sample) will also be appreciated.
我试图查看 iwlist/iwconfig 命令是否存在任何 API,但我没有找到任何东西。有人可以帮我吗?任何示例(代码示例)也将不胜感激。
Gracias
格拉西亚斯
采纳答案by ldx
With newer kernels the framework for managing wireless cards is called nl80211. It's netlink based, so you can use libnlto issue commands and parse answers. More information:
对于较新的内核,管理无线卡的框架称为nl80211。它基于 netlink,因此您可以使用libnl来发出命令并解析答案。更多信息:
http://wireless.kernel.org/en/developers/Documentation/nl80211
http://wireless.kernel.org/en/developers/Documentation/nl80211
Currently iwis the command line utility that utilizes nl80211, so you can list available hardware, scan, etc:
目前iw是使用 nl80211 的命令行实用程序,因此您可以列出可用的硬件、扫描等:
http://linuxwireless.org/en/users/Documentation/iw
http://linuxwireless.org/en/users/Documentation/iw
Its source code is easy to study and reuse in your own project, just check out their git repo.
它的源代码很容易在你自己的项目中学习和重用,只需查看他们的 git repo。
回答by gfelisberto
No API but you can try: Excecute iwconfig from a java application
没有 API,但您可以尝试:Excecute iwconfig from a java application
You can also try http://kosmosisland.com/island/david/kosmos-island-wireless.php. They have a Java Applet (with source) that monitors the Wireless Link. You can see how they did it.
您也可以尝试http://kosmosisland.com/island/david/kosmos-island-wireless.php。他们有一个 Java Applet(带有源代码)来监控无线链接。你可以看到他们是如何做到的。
Gustavo
古斯塔沃