thaliproject / Thali_CordovaPlugin

Thali p2p plugin
MIT License
226 stars 44 forks source link

Validate that Android native layer just works #986

Open larryonoff opened 8 years ago

vasilevskayaem commented 8 years ago

As per @yaronyg email.

Write some basic native tests to validate using just Java code (no TCP, no node) works properly with Bluetooth. The idea is to prove to ourselves that the Bluetooth layer does work reasonably well and therefore we can know that the problem isn’t Bluetooth, it’s our code.

The tests I am asking him to write are:

  1. Have one phone open a Bluetooth client socket to the other phone and move 200K of data and have the 200K of data reflected back. The connection should have retry logic so that if a connection fails we will retry and continue from the last data we successfully had reflected back to us. We need to time how long it takes from when we start sending the data until we successfully receive all the data back. The timer should keep running through retrying the connection if it fails in the middle.
  2. The same test as before but have both phones simultaneously try to send data to each other instead of having one phone sending and the other reflecting. In other words, run the previous test twice in parallel on each handset.
  3. Run test 1 but with 3 phones. That is, exactly one phone will connect to the other two phones simultaneously and that one phone will send data simultaneously to the other 2 phones and the other 2 phones will reflect back what they get to the sending phone.
  4. Same test as 2 but with 3 phones. So each phone is simultaneously opening up 2 connections to 2 other phones so we should have 6 connections all running at once.

We don’t have to have the phones perfectly in sync so it’s fine if the tests launch by someone hitting a button on each phone.

These tests are only intended to run manually and only on the phones at Evgeni’s desk.

If these tests pass reasonably then it demonstrates that Bluetooth is reasonably reliable and the issues we are fighting are in our code, they aren’t something fundamentally broken in Bluetooth.

If these tests don’t pass… well… then we need to rethink what we want to do with Android. We do have another option which is to use WiFi hot spots but there are some very scary security issues there.

larryonoff commented 8 years ago

We agreed with @yaronyg that this issue is not valid now since the issue #1000.

yaronyg commented 8 years ago

Note that we still need to do this work but we should do it in the context of the perf work that @andrew-aladev is doing. So we need to do this, just not this very moment.