Android Question small WIFI Direct group

Discussion in 'Android Questions' started by vstana, Jul 6, 2015.

  1. vstana

    vstana New Member Licensed User

    Hello,

    I want to create group of 4..10 tablets that are logging some inputs (simple touch events), and send them to a "master" tablet that store and display some values.
    - I cannot use the "master" as hotspot, because of some restriction imposed by the network administrator ( don't admit an extra WIFI network, besides the existing one, and don't accept the tablets in his WIFI network)
    - the tablets don't have Bluetooth,
    so the only possibility is to use WIFI Direct (it's available and tested on all devices).
    I started to study the WIFI Direct example, it works, but i have some questions:
    1. is it possible to use WIFI Direct for this task ?
    2. is it possible to choose the group owner (the master) ?
    3. I call the method manager.DiscoverPeers. It will be active as long as the activity is active, or it will stop on other conditions?
    4. I see that sometimes the PeersDiscovered event fires, with Sucess=true, but with 0 devices on list

    Thank you,
    Virgil
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Were you able in your tests to connect more than two devices?
     
  3. vstana

    vstana New Member Licensed User

    I tried your Example, with 4 tablets:
    - press Discover, one became Owner (M), the other clients (S1, S2, S3)
    - M see 3 Peered Devices
    - S1, S2 and S3 Peered Devices :1
    - Press Connect on S1, i can change message with M
    - pressing Connect on S2, S1 is Disconnected, S2 can change messages with M
    - same on S3 ..
    so, connecting one S, the other are disconnected.
    I run this configuration for more than 6 hours, seems to be stable. It does exactly what i need, with one exception: the M is randomly (?) chosen from one of the devices.
    I come back with 2nd question, is there any possibility to choose the master ? it's important for me to have a well known master (this one will be accepted in the WAN).

    Thank you,
    Virgil
     
    Last edited: Jul 6, 2015
  4. Erel

    Erel Administrator Staff Member Licensed User

    lemonisdead likes this.
  5. vstana

    vstana New Member Licensed User

    I replaced manager.Connect with manager.Connect2 on Example, but i didn't notice any difference.
    I tried with GroupOwner=True on each tablet on group (1 with TRUE, 3 with FALSE), but only once the group Owner was selected the one with true.
    I mention that i uninstalled the previous example before running new one, and i cleared the WIFI Direct Remembered peers history.
    I'm I missing something ?
    I read in the Android documentation about the WifiP2pConfig class and groupOwnerIntent parameter, but I'm afraid that it cannot be linked with your library - at least not at my very beginner level.
    Anyway, thank you for your effort, I will continue my project with focus on data exchange, as I see that once established a group, it is remembered and used by all units in that group (I mean that it seems that the Owner remains the same units when the group is restarted).

    Best Regards,
    Virgil
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This is exactly the parameter that is used when you call Connect2 instead of Connect. It sets the groupOwnerIntent to 15.
     
Loading...