4

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?

Moonlit
  • 5,171
  • 14
  • 57
  • 95
  • A c++ device is not really anything. If your testing with a windows host - maybe look @ some guides on windows Wi-Fi direct - for linux check this out: http://wireless.kernel.org/en/developers/p2p/howto – Iwan Aucamp Jul 22 '13 at 17:27

1 Answers1

3

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

Moshe Carmeli
  • 295
  • 1
  • 5
  • 1
    does this mean, the android device has to be connected to a network? The communication should somehow be like a bluetooth connection. by the way, the other devices are running `embedded linux`. Is it not simply possible to implement some kind of tcp server on the smartphone and let the other devices connect to it via sockets? – Moonlit Jul 23 '13 at 14:57