Direct Wifi Communication between android smartphone and other devices

旧城冷巷雨未停 提交于 2019-12-04 14:01:27

问题


I want to establish a communication (via WIFI) between an Android device and another device (which is not another android smartphone but a device with wifi implemented using c++). I already found out that android provides direct wifi in order to communicate directly over wifi with two android devices.

How can I communicate over wifi (without a network) with an android device and another c++ device? Especially, I want my app to discover any device which is in the near. So I have to implement some kind of service discovery. What do you guys recommend to implement this?


回答1:


In order for this to work, you must have the computer'shardware properly configured and your software must be written to communicate with this hardware.

In the following guide, they suggest communicating with the hardware via the iwpriv application which handles the p2p information received directly from the Wifi adapter's driver. If you choose to do this, you will need to learn how iwpriv works and can interact with your application.

guide: http://dishingtech.blogspot.com/2012/01/realtek-wi-fi-direct-programming-guide.html

In order to get Wifi Direct working on an Android tablet, I suggest following the Wifi Direct sample which is available in /samples/android-/. This sample allows you to connect direct to other Wifi Direct devices and transfer an image. You can slightly alter this application for your needs, or completely rewrite it if your needs deviate too far from the sample.

accompanying guide (for Android) : http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html

NOTE: you will still need to have a wifi network in order for these devices to communicate



来源:https://stackoverflow.com/questions/17793254/direct-wifi-communication-between-android-smartphone-and-other-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!