Project

General

Profile

Actions

Task #3939

open

WiFi Direct support

Added by Alex Afanasyev almost 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
gui
Start date:
01/31/2017
Due date:
% Done:

0%

Estimated time:

Actions #1

Updated by Alex Afanasyev almost 8 years ago

Got the following NFD app crash (NFD service still keep working)

01-31 12:08:00.459: E/NDNController(3432): There was an issue with initiating connect() for: aa:a7:95:55:ad:d7, reason: THERE WAS AN ERROR WITH THE REQUEST
01-31 12:08:06.579: E/AndroidRuntime(3432): FATAL EXCEPTION: main
01-31 12:08:06.579: E/AndroidRuntime(3432): Process: net.named_data.nfd, PID: 3432
01-31 12:08:06.579: E/AndroidRuntime(3432): java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Set net.named_data.nfd.wifidirect.utils.NDNController.getConnectedPeers()' on a null object reference
01-31 12:08:06.579: E/AndroidRuntime(3432):     at net.named_data.nfd.wifidirect.utils.NDNController$3$1.onFailure(NDNController.java:557)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler.handleMessage(WifiP2pManager.java:722)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at android.os.Handler.dispatchMessage(Handler.java:102)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at android.os.Looper.loop(Looper.java:135)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at android.app.ActivityThread.main(ActivityThread.java:5294)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at java.lang.reflect.Method.invoke(Native Method)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at java.lang.reflect.Method.invoke(Method.java:372)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
01-31 12:08:06.579: E/AndroidRuntime(3432):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Actions #3

Updated by Alex Afanasyev almost 8 years ago

  • Description updated (diff)
Actions #4

Updated by Alex Afanasyev almost 8 years ago

I can also report initial success after phones were rebooted:

  • both phones got connected
  • I started a bit modified whiteboard app
  • everything seamlessly worked between phones

However, a few seconds later everything stopped working. Connection disappeared, later NFD gui app crashed with the error in note 1. After restart, I'm yet to see phones getting reconnected. Here is a partial log output

01-31 12:35:26.477: D/NDNController(4299): Success on discovering peers
01-31 12:35:28.250: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:35:28.259: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:35:28.259: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:35:29.986: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:35:29.988: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:35:29.988: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:35:56.476: D/NDNController(4299): Success on discovering peers
01-31 12:36:01.356: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:36:01.363: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:36:01.363: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:36:01.368: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:36:01.372: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:36:01.372: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:36:26.477: D/NDNController(4299): Success on discovering peers
01-31 12:36:30.468: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:36:30.474: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:36:30.475: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:36:30.487: D/WDBroadcastReceiver(4299): peers changed!
01-31 12:36:30.493: D/WDBroadcastReceiver(4299): Peers available: 2
01-31 12:36:30.493: D/WDBroadcastReceiver(4299): Number of new peers that can be added: 0
01-31 12:36:56.478: D/NDNController(4299): Success on discovering peers

Seem to me that app doesn't attempt to connect anymore.


After stopping NFD service and forcefully restarting NFD gui app, starting service, and enabling wifi direct, I got it working again.

Worked with some crashes afterwards. Couldn't connect third phone, though...

Actions #5

Updated by Allen Gong almost 8 years ago

For note #1, I am not sure how it happened but it looks like the controller (NDNController) singleton was cleaned up (perhaps by toggling the on/of switch) which may have caused the framework to reject an ongoing connect() to a device with MAC aa:a7:95:55:ad:d7. It seems likely to be the case, and I will add a quick check to prevent that null pointer exception from occurring again.

For note #4 you are right. For whatever reason the implementation is not attempting to connect. It is aware of the peers, and has some state noting that their connect()s have been queued. I noticed that there is no log statement like: "Skip this iteration due to null WD ip." logged during probing attempts, which means that at that time the device had stored its WiFi Direct IP address - but it is uncertain whether it was still actively in a group. It could have been a result of the crash from note #1, but I would probably need more of the logs to verify.

For the third phone not being to connect, I wonder: do you start all 3 phones (toggling the WiFi Direct on/off switch) at around the same time? I probably need to acquire a third device to better troubleshoot this problem.

Actions #6

Updated by Allen Gong almost 8 years ago

Quick note on wifidirect with 3+ devices.

A user with a very similar problem:
http://stackoverflow.com/questions/18228892/connecting-multiple-devices-in-a-wifi-direct-group

There seems to be a good amount of confusion on Android WiFi Direct and how connections should come and go. I've read the official docs concerning connecting to peers (https://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html) multiple times, but it still seems like there are ambiguities as to how things work in practice.

I'll have access to a 3rd device by tomorrow, so I can better troubleshoot the issue. From what I have been reading so far, I may need to change the protocol so that one device is marked/selected (possibly manually with the UI) as a the group owner, while others knowingly connect only to the GO.

Actions #7

Updated by Junxiao Shi almost 8 years ago

I heard that in WiFi Direct, the GO serves as AP and forwards all traffic between non-GOs (STAs).
Protocol rev3 says, every node creates a face to every other node it knows about. This implies that GO is doing IP forwarding for traffic between two non-GOs.
Why not only maintain faces between GO and each non-GO, and let GO's NFD do NDN forwarding?

Actions

Also available in: Atom PDF