Code Monkey home page Code Monkey logo

salut's People

Contributors

adroitandroid avatar brendankirby avatar deathslocus avatar drewvolz avatar ened avatar fabianterhorst avatar lkorth avatar neatorobito avatar nicholas-kyle avatar s0nerik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

salut's Issues

A working demo project would really help

The library looks promising, if it really handles what it promotes while hiding away most of the issues connected to android mumbo-jumbo.

And please do not point to that one activity in gist. It does not help much, as it is not a workable project.

Connection always refused

I'm having a problem connecting two devices.
I set up one as the host, the other as the guest.
The host calls network.startNetworkService(...), no problem.
The guest calls network.discoverNetworkServices(...), then in the callback i make a button to connect:

WifiActivityStatus.network.discoverNetworkServices(new SalutDeviceCallback() {
    @Override
    public void call(SalutDevice device) {
        Log.d("WifiP2p", "A device has connected with the name " + device.deviceName);
        WifiActivityStatus.opponentDevice = device;
        WifiActivityStatus.activity.popButton(R.id.connect_button);
    }
}, false);

This also works: when a host is found, the button appears.

This is the button's onClick method:

@Override
public void onClick(View v) {
    onConnectButtonClicked();
    }
}

And this is the onConnectButtonClicked() function:

...
WifiActivityStatus.network.registerWithHost(WifiActivityStatus.opponentDevice, new SalutCallback() {
            @Override
            public void call() {
                Log.d("WifiP2p", "We're now registered.");
                ...something else...
            }
        }, new SalutCallback() {
            @Override
            public void call() {
                Log.d("WifiP2p", "We failed to register.");
            }
        });
...

Now when i click the Connect button, i always get the following stacktrace:

07-11 16:41:02.264 20687-20687/com.tyde.friz.oeo D/Salut: Attempting to connect to another device.
07-11 16:41:10.727 20687-21254/com.tyde.friz.oeo D/Salut: Attempting to transfer registration data with the server...
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err: java.net.ConnectException: failed to connect to /192.168.49.1 (port 37500): connect failed: ECONNREFUSED (Connection refused)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:124)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:183)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:456)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at java.net.Socket.connect(Socket.java:882)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at java.net.Socket.connect(Socket.java:825)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at com.peak.salut.BackgroundClientRegistrationJob.doOnBackground(BackgroundClientRegistrationJob.java:41)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at com.arasthel.asyncjob.AsyncJob$2.run(AsyncJob.java:59)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at java.lang.Thread.run(Thread.java:818)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err: Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at libcore.io.Posix.connect(Native Method)
07-11 16:41:10.731 20687-21254/com.tyde.friz.oeo W/System.err:     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:111)
07-11 16:41:10.732 20687-21254/com.tyde.friz.oeo W/System.err:     at libcore.io.IoBridge.connectErrno(IoBridge.java:137)
07-11 16:41:10.732 20687-21254/com.tyde.friz.oeo W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:122)
07-11 16:41:10.732 20687-21254/com.tyde.friz.oeo W/System.err: 	... 7 more
07-11 16:41:10.732 20687-21254/com.tyde.friz.oeo E/Salut: An error occurred while attempting to register or unregister.

followed by the "We failed to register." log.

Can you please help me understand what am i doing wrong?

IllegalArgumentException: Receiver not registered

i getting exception after clicked "Stop Discovery" button (you example).

ACRA: com.lo6ctep.wifiscaner fatal error : Receiver not registered: com.peak.salut.SalutBroadcastReceiver@41d0aab0
java.lang.IllegalArgumentException: Receiver not registered: com.peak.salut.SalutBroadcastReceiver@41d0aab0
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:667)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1549)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:489)
at com.peak.salut.Salut.stopServiceDiscovery(Salut.java:832)
at com.lo6ctep.wifiscaner.MainActivity.discoverServices(MainActivity.java:111)

111 line:

  private void discoverServices() {
        Log.d(TAG, "current runningAsHost=" + network.isRunningAsHost);
        Log.d(TAG, "current isDiscovering=" + network.isDiscovering);
        if (!network.isRunningAsHost && !network.isDiscovering) {
            listView.setAdapter(new DevicesAdapter(MainActivity.this, network.foundDevices));
            network.discoverNetworkServices(new SalutDeviceCallback() {
                @Override
                public void call(SalutDevice salutDevice) {
                    listView.setAdapter(new DevicesAdapter(MainActivity.this, network.foundDevices));
                    Toast.makeText(getApplicationContext(), "Device: " + network.foundDevices.get(0).instanceName + " found.", Toast.LENGTH_SHORT).show();
                }
            }, true);
            scanButton.setText("Stop Discovery");
            serverButton.setAlpha(0.5f);
            serverButton.setClickable(false);
        } else {
            network.stopServiceDiscovery(true); //line 111
            scanButton.setText("Discover Services");
            serverButton.setAlpha(1f);
            serverButton.setClickable(true);
        }
    }

Project Manifest cannot override library Manifest

Hi,

I'm getting following error, which is caused by android:allowBackup="false" in my project Manifset. Proposed solution with tools:replace="android:allowBackup" doesn't work.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:13:9-36
	is also present at [com.github.markrjr:Salut:v0.5.0] AndroidManifest.xml:18:9-35 value=(true).
	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:11:5-30:19 to override.

This is current library Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.peak.salut">

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application android:allowBackup="true" android:label="@string/app_name">

    </application>

</manifest>

I think it should be replaced with this one. Library shouldn't add any properties to <application/>.

<manifest package="com.peak.salut"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application/>

</manifest>

Best regards
Aleksander Mielczarek

How to show the loading progress when data is still being received?

Hello, markrjr! First of all, thank you for such a great library. I was playing with Wifi direct capabilities in the last 5 days, and your library made my work much easier than using Wifi direct android apis. Can you give me some idea about data receiving process. For ex. client sends mp4 file (maybe 10 Mb or more), and I know that it might take 3-4 seconds with wifi speed. I want to make my users know that mp4 file is still being received and show them the percentage like 60% of mp4 is received.
Thank you for your response!

How can SalutDevice be uniquely identified?

Hi, I'm looking for a way to uniquely identify a device. The only thing I've found that should be (as far as I understand) unique inside SalutDevice is macAddress, but it has a protected access rights, so I can't really use it in my classes. So how can I identify a specific device?

Busy error while attempting to start network service

When I call network.startNetworkService(), it works once, but then consistently logs an error "Failed to create group. Reason :2". This error is created when, internally, the manager.createGroup() method is called. Error code 2 corresponds to BUSY.

This issue is resolved if I manually turn off wifi and turn it back on again. If I do so programmatically, like so:

WifiManager wifiManager = (WifiManager) activity.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(false);
wifiManager.setWifiEnabled(true);

the problem persists.

I've also tried using network.stopNetworkService() in the onStop() or onDestroy() methods of my activity but to no avail.

Does anyone know how to resolve this error? StackOverflow says that it can be caused by a call to manager.removeGroup() when you aren't connected to a group, but that is not applicable. In addition, Base.java uses much the same code as I do, yet when I run it in an example project, this error never occurs.

In sendMessage, device has no serviceAddress or servicePort.

Hello. First of all, I thank you and appreciate you for your work.
I am trying to send a simple text message from the Client to the Host, but I can't seen to figure it out how.
When I call startNetworkService, the callback saying it's connected is never called, but the devices seem to be conected by WiFi Direct. When I try to use sendMessage method I get the error callback, and the log tells me it's because the device have no serviceAddress or servicePort.
I am using version 0.5.1, but I have tried to downgrade to 0.5.0 and 0.4.9, and for some reason, in these versions the Client don't even discover the Host...
Can anyone point out what am I doing wrong? Or have an working project, because I really only need to send Strings from one device to another. Pasting the code below:

`
public class MainActivity extends AppCompatActivity implements SalutDataCallback, View.OnClickListener{

public static final String TAG = "SalutTestApp";
public SalutDataReceiver dataReceiver;
public SalutServiceData serviceData;
public Salut network;
public Button hostingBtn;
public Button discoverBtn;
public Button messageBtn;
public Button registerBtn;
SalutDataCallback callback;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    hostingBtn = (Button) findViewById(R.id.hosting_button);
    discoverBtn = (Button) findViewById(R.id.discover_services);
    messageBtn = (Button) findViewById(R.id.send_message);
    registerBtn = (Button) findViewById(R.id.register);

    hostingBtn.setOnClickListener(this);
    discoverBtn.setOnClickListener(this);
    messageBtn.setOnClickListener(this);
    registerBtn.setOnClickListener(this);


    /*Create a data receiver object that will bind the callback
    with some instantiated object from our app. */
    dataReceiver = new SalutDataReceiver(this, this);


    /*Populate the details for our awesome service. */
    serviceData = new SalutServiceData("testAwesomeService", 60606,
            "HOST");

    /*Create an instance of the Salut class, with all of the necessary data from before.
    * We'll also provide a callback just in case a device doesn't support WiFi Direct, which
    * Salut will tell us about before we start trying to use methods.*/
    network = new Salut(dataReceiver, serviceData, new SalutCallback() {
        @Override
        public void call() {
            // wiFiFailureDiag.show();
            // OR
            Log.e(TAG, "Sorry, but this device does not support WiFi Direct.");
        }
    }) {
        @Override
        public String serialize(Object o) {
            return null;
        }
    };
}

@Override
public void onClick(View v) {

    if(!Salut.isWiFiEnabled(getApplicationContext()))
    {
        Toast.makeText(getApplicationContext(), "Please enable WiFi first.", Toast.LENGTH_SHORT).show();
        return;
    }

    if(v.getId() == R.id.hosting_button)
    {
        setupNetwork();
    }
    else if(v.getId() == R.id.discover_services)
    {
        discoverServices();
    }
    else if(v.getId() == R.id.send_message)
    {
        sendMessage();
    }
    else if(v.getId() == R.id.register)
    {
        registerDevice();
    }
}

private void setupNetwork()
{
    if(!network.isRunningAsHost)
    {
        network.startNetworkService(new SalutDeviceCallback() {
            @Override
            public void call(SalutDevice salutDevice) {
                Toast.makeText(getApplicationContext(), "Device: " + salutDevice.instanceName + " connected.", Toast.LENGTH_SHORT).show();
            }
        });

        hostingBtn.setText("Stop Service");
        discoverBtn.setAlpha(0.5f);
        discoverBtn.setClickable(false);
        network.isRunningAsHost = true;
    }
    else
    {
        network.stopNetworkService(false);
        hostingBtn.setText("Start Service");
        discoverBtn.setAlpha(1f);
        discoverBtn.setClickable(true);
        network.isRunningAsHost = false;
    }
}

private void discoverServices()
{
    if(!network.isRunningAsHost && !network.isDiscovering)
    {
        network.discoverNetworkServices(new SalutCallback() {
            @Override
            public void call() {
                Toast.makeText(getApplicationContext(), "Device: " + network.foundDevices.get(0).instanceName + " found.", Toast.LENGTH_SHORT).show();
            }
        }, true);
        discoverBtn.setText("Stop Discovery");
        hostingBtn.setAlpha(0.5f);
        hostingBtn.setClickable(false);
    }
    else
    {
        network.stopServiceDiscovery(true);
        discoverBtn.setText("Discover Services");
        hostingBtn.setAlpha(1f);
        hostingBtn.setClickable(false);
    }
}

private void registerDevice(){
    network.registerWithHost(network.foundDevices.get(0), new SalutCallback() {
        @Override
        public void call() { //Salut Device Possible Host
            Log.d(TAG, "We're now registered.");
        }
    }, new SalutCallback() {
        @Override
        public void call() {
            Log.d(TAG, "We failed to register.");
        }
    });
}

private void sendMessage(){
    Salut salAux= network;
    Message myMessage = new Message();
    myMessage.description = "See you on the other side!";

    //network.sendToAllDevices(myMessage, new SalutCallback() {
    //    @Override
    //    public void call() {
    //        Log.e(TAG, "Oh no! The data failed to send.");
    //        Toast.makeText(getApplicationContext(), "Oh no! The data failed to send.", Toast.LENGTH_SHORT).show();
    //    }
    //});

    network.sendToDevice(network.foundDevices.get(0), myMessage, new SalutCallback() {
        @Override
        public void call() {
            Log.e(TAG, "Oh no! The data failed to send.");
        }
    });
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    //getMenuInflater().inflate(R.menu.menu_base, menu); TODO Menu Não funciona
    return true;
}

/*Create a callback where we will actually process the data.*/
@Override
public void onDataReceived(Object data) {
    //Data Is Received
    Log.d(TAG, "Received network data.");
    try
    {
        //TODO Se algo quebrar, provavelmente foi aqui.
        Message newMessage = LoganSquare.parse(data.toString(), Message.class);
        Log.d(TAG, newMessage.description);  //See you on the other side!
        Toast.makeText(getApplicationContext(), newMessage.description, Toast.LENGTH_SHORT).show();
        //Do other stuff with data.
    }
    catch (IOException ex)
    {
        Log.e(TAG, "Failed to parse network data.");
    }
}

@Override
public void onDestroy() {
    super.onDestroy();

    if(network.isRunningAsHost)
        network.stopNetworkService(true);
    else
        network.unregisterClient(true);
}

}
`

Thank you previously for your help.

discoverNetworkServices callback is not being called

While the Log says that it finds the Server ("Salut: Found -2030493332 _AwesomeParty._tcp.local.") the callback is never being called, and if I choose to have a timeout, it says It couldn't find any devices.

It doesn't happen every time, but it happens in more than 95% of the tries

Unable to registerWithHost unless client activity created after host activity

I have ClientApp makes discoverNetworkServices
and a HostApp makes startNetworkService and discoverNetworkServices

know if the HostApp launched #THEN the ClientApp launched
the connection is estavlished and everything works fine.

the problem is if the HostApp launched #AFTER the ClientApp the connection will never began

this is how I discoverNetworkServices in ClientApp

ActivityMain.network.discoverNetworkServices(new SalutDeviceCallback() {
                @Override
                public void call(SalutDevice device) {
                    network.registerWithHost(device, new SalutCallback() {
                        @Override
                        public void call() {
                            Toast.makeText(ActivityMain.this, "success", Toast.LENGTH_SHORT).show();
                        }
                    }, new SalutCallback() {
                        @Override
                        public void call() {
                            Toast.makeText(ActivityMain.this, "fail", Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }, true);

i thought true will make behavor work but its not
Please help me with getting connection to work if the host created after the client app

in another subject: Thank you very much for this awesome job I HOPE YOU KEEP WORKING ON IT

serviceAddress is null

I am using Salut 0.5.0 and I have two client devices and a host successfully connected to each other.
Communication between host and client works fine. However, when I invoke sendToDevice to try to send some data from one client to another client:

network.sendToDevice(anotherClientDevice, data, new SalutCallback() {
        @Override
        public void call() {
            Log.d(TAG, "send data to device failed");
        }
    }
);

I got the following exception:
java.lang.IllegalArgumentException: host=null, port=4321
at java.net.InetSocketAddress.(InetSocketAddress.java:99)
at java.net.InetSocketAddress.(InetSocketAddress.java:90)
at com.peak.salut.BackgroundDataSendJob.doOnBackground(BackgroundDataSendJob.java:37)
at com.arasthel.asyncjob.AsyncJob$2.run(AsyncJob.java:59)
at java.lang.Thread.run(Thread.java:818)

It turns out that device.serviceAddress is null in BackgroundDataSendJob:

try {
     dataSocket.connect(new InetSocketAddress(device.serviceAddress, device.servicePort));
     // ...
}

The field Salut.serviceAddress seems to be not properly set in BackgroundClientRegistrationJob and BackgroundServerRegistrationJob.

Any thoughts on this?

10-19 11:09:07.871 7997-7997/ D/WifiP2pManager: Ignored { when=0 what=139313 target=android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler }

run: clear record successfully:0
10-19 11:09:07.825 7997-8305/u D/echiev_wireless: run: strData is:22.558178/113.944876/2017-10-19 11:08:47
10-19 11:09:07.867 7997-7997/ D/echiev_wireless: onSuccess: Added Local Service Success
10-19 11:09:07.871 7997-7997/ D/WifiP2pManager: Ignored { when=0 what=139313 target=android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler }
10-19 11:09:07.872 7997-7997/ D/echiev_wireless: onSuccess: Added service discovery request
10-19 11:09:07.877 7997-7997/ D/echiev_wireless: onSuccess: discoverPeers
10-19 11:09:07.886 7997-7997/ D/echiev_wireless: onSuccess:Service discovery initiated
10-19 11:09:09.850 7997-8305/ D/echiev_wireless: dataMaker: mmm
10-19 11:09:09.851 7997-8305/ D/echiev_wireless: run: clear record successfully:0
10-19 11:09:09.852 7997-8305/ D/echiev_wireless: run: strData is:22.558178/113.944876/2017-10-19 11:08:47
10-19 11:09:09.897 7997-7997/ D/echiev_wireless: onSuccess: Added Local Service Success
10-19 11:09:09.899 7997-7997/ D/WifiP2pManager: Ignored { when=0 what=139313 target=android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler }
10-19 11:09:09.899 7997-7997/ D/echiev_wireless: onSuccess: Added service discovery request
10-19 11:09:09.908 7997-7997/D/echiev_wireless: onSuccess: discoverPeers
10-19 11:09:09.918 7997-7997/ D/echiev_wireless: onSuccess:Service discovery initiated

Unable to connect more than 5 clients !

The library works perfectly when less than or equal to 5 client devices have connected to the host device.
However, the 6th and subsequent clients can't connect.
Is this a constraint on Wifi P2P , my device hardware or the Salut library?

Any help would be appreciated!

Can Host be a Client?

Hello, Thanks your nice library.
It's possible that a Host be a Client itself (at same time) or not ??
And one other question: It's possible that a client be client of multiple hosts (at same time) or not ??
(Sorry for my English mistakes!)

Wifi Not connecting

I got the following issue. My devices are connected to WiFi Direct through Salut. When I manually try to connect to the WiFi Direct SSID (using Group Details) its connecting and disconnecting. I have no idea whether this is WiFi Direct or Salut. Please let me know regarding this.

Unable to connect more than 5 hosts!

The library works perfectly when less than or equal to 5 client devices have connected to the host devices.
However, the 6th and subsequent clients can't connect.
Is this a constraint on Wifi P2P , my device hardware or the Salut library?

Any help would be appreciated!

discoverNetworkServices not finding any, if left idle for 1-2 minutes

Everything works fine in all cases but not
when ClientApp starts and the HostApp starts after it by more than 1-2 minutes
-if it starts immediately it works fine-
despite ClientApp is still discovering i added a handler ever x seconds to check if isDiscovering and it is true but its like the service"device" wont be found, may be the services list is not refreshing please help with this

Dex count guava

It doesn´t make sense to add guava just for a few classes, because it has a dex count of 15000.

Data Sending Error

When I try to send any data, I got sending error.
What's wrong?

@ If you have any sample code, please share it with me.

Many thanks.

..............
if(network.isRunningAsHost) {
network.sendToAllDevices("This is test data", new SalutCallback() {
@OverRide
public void call() {
Log.e(TAG, "Oh no! The data failed to send.");
}
});
.......................

01-04 18:16:08.937 13864-15985/com.innopia.fx3drvier2th D/Salut: Connected, transferring data...
01-04 18:16:08.937 13864-15985/com.innopia.fx3drvier2th D/Salut: An error occurred while sending data to a device.
01-04 18:16:08.937 13864-15985/com.innopia.fx3drvier2th E/SalutTestApp: Oh no! The data failed to send.
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: com.bluelinelabs.logansquare.NoSuchMapperException: Class java.lang.String could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: at com.bluelinelabs.logansquare.LoganSquare.mapperFor(LoganSquare.java:171)
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: at com.bluelinelabs.logansquare.LoganSquare.serialize(LoganSquare.java:100)
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: at com.peak.salut.BackgroundDataSendJob.doOnBackground(BackgroundDataSendJob.java:49)
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: at com.arasthel.asyncjob.AsyncJob$2.run(AsyncJob.java:59)
01-04 18:16:08.947 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.Thread.run(Thread.java:841)
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: Caused by: java.lang.ClassNotFoundException: java.lang.String$$JsonObjectMapper
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.Class.classForName(Native Method)
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.Class.forName(Class.java:251)
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.Class.forName(Class.java:216)
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: at com.bluelinelabs.logansquare.LoganSquare.mapperFor(LoganSquare.java:167)
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: ... 4 more
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: Caused by: java.lang.NoClassDefFoundError: java/lang/String$$JsonObjectMapper
01-04 18:16:08.957 13864-15985/com.innopia.fx3drvier2th W/System.err: ... 8 more
01-04 18:16:08.967 13864-15985/com.innopia.fx3drvier2th W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.String$$JsonObjectMapper" on path: DexPathList[[zip file "/data/app/com.innopia.fx3drvier2th-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.innopia.fx3drvier2th-1, /vendor/lib, /system/lib]]
01-04 18:16:08.967 13864-15985/com.innopia.fx3drvier2th W/System.err: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-04 18:16:08.967 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
01-04 18:16:08.967 13864-15985/com.innopia.fx3drvier2th W/System.err: at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
01-04 18:16:08.967 13864-15985/com.innopia.fx3drvier2th W/System.err: ... 8 more

WiFi connection required for discovery?

I created a simple app using the code in the readme to try out the library. It works great and I'm able to send messages between my two devices. However, I noticed the service discovery only works when the host device is connected to a WiFi network.

It doesn't matter if the client device is connected to the same network, a different one, or not at all. However, when the host device isn't connected to some network, it's not discoverable by the client device (even though WiFi is still turned on!). In either case, I receive a "successfully created service" message but it's like the host is not advertising the service unless it's connected to an existing WiFi network.

I have not used WiFi Direct outside of this library, so I'm not sure what the expected behavior is but I thought the API is supposed to allow devices to connect even without an access point.

Any advice on this would be greatly appreciated!

registerWithHost not working (socket IOException in BackgroundClientRegistrationJob.doOnBackground())

Hi. First of all, thank you for your great work on this project!

I'm already trying for hours to connect two devices without success. After a lot of debugging and testing I've found out that "BackgroundClientRegistrationJob.doOnBackground()" throws an IOException because the socket cannot be connected (Line 40 in BackgroundClientRegistrationJob.java: "registrationSocket.connect(this.hostDeviceAddress);").

What works and doesn't work (written from the perspective of the client side):
The hostDeviceAddress is /192.168.49.1:37500 so that looks fine. I successfully get the connect request dialog on the host side (after calling registerWithHost() on the client side) which I accept, then onConnectionInfoAvailable gets called (client side) soon after and then the GroupInfoListener.onGroupInfoAvailable() method is executed. There in the last line the Salut.this.startRegistrationForClient is called. After that I get the exception in BackgroundClientRegistrationJob.doOnBackground() (line 40) although the devices successfully connected to each other (I can see that in the settings -> wireless -> wifi direct)...

Assumptions

  • Could it be that wifi direct needs a moment to "fully" establish the connection? If so then maybe a small execution delay of BackgroundClientRegistrationJob.doOnBackground() would make it work?
  • Or could it be that the client turns into the host because the WifiP2pConfig.groupOwnerIntent is set to -1 (default) - 0 would indicate the least inclination to be a group owner whereas -1 means that it is up to the system to define the owner (which is quite random).

I would highly appreciate any help/hints and thoughts.

Thank you and best regards

Bug in MainActivity in Demo

When Multiple devices connect they are not being added to the list in the host device.. any idea how to solve that? I tried notfiyDataSetChanged() and it didnt work. Pls let me know.

How Salut Connect to selected group

Hi, thanks for making this awesome library
but i have same question about selecting group, is salut connect automaticaly to a group with same type? or we can show list of group and then connect to seleceted group?

Create Salut instance in Service

Hi!
How can I create Salut instance in Service for background scanning?
SalutDataReceiver require Activity instance.
Thank you

Confused by some Random Errors

Hi Mark..
Very Nice Library great work ... but i'm working on Wifi Direct for the first time so i'm not sure how to use your library... can you please create sample projects showing its basic usage and difference between Host and Client...

it is giving me error when i use startNetworkService function to create a host
Failed to create __signaldispalyservice : Error Code: 0
and when i create an instance it gives this error

06-29 17:47:29.377: E/Salut(21732): Failed to use standard port, another will be used instead.
06-29 17:47:29.377: E/Salut(21732): Failed to get a random port, Salut will not work correctly.
06-29 17:47:29.377: E/Salut(21732): Failed to use standard port, another will be used instead.
06-29 17:47:29.377: E/Salut(21732): Failed to get a random port, __childdisplayservice will not work correctly.

Using Salut for Peer-To-Peer

What I understand of Salut, its primarily for Wifi Direct Service discovery and connection/communication henceforth.

Is Salut already abstracting Peer-to-Peer discovery and functionality or is it limited to Service discovery only?

Any plans for Peer-to-Peer discovery and functionality in upcoming versions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.