0

Fail to join session - ALLJOYN_JOINSESSION_REPLY_FAILED

asked 2015-07-02 23:48:36 -0800

Baokeyai gravatar image

Hello,

I have the following setup

Arduino Yun with the Linino Distro + AlljoynJS running a little sample script to test signals. I can successfully make a client/service script on the Yun that activates the signal so now I'm trying to make it work cross platform from my Windows desktop or Android phone.

Regardless of Desktop or Android, after finding the session on the BusListener, I attempt to join the session. When I invoke the JoinSession, I get the ALLJOYN_JOINSESSION_REPLY_FAILED error.

private void joinSession(String advertisedName, short transport) {
    short contactPort = SERVICE_CONTACT_PORT;
    SessionOpts sessionOpts = new SessionOpts();
    sessionOpts.traffic = SessionOpts.TRAFFIC_MESSAGES;
    sessionOpts.isMultipoint = false;
    sessionOpts.proximity = SessionOpts.PROXIMITY_ANY;
    sessionOpts.transports = transport;

    Mutable.IntegerValue sessionId = new Mutable.IntegerValue();
    busAttachment.enableConcurrentCallbacks();
    Status status = busAttachment.joinSession(advertisedName, contactPort, sessionId, sessionOpts, new SessionListener());
    if (status != Status.OK) {
        return;
    }
}

advertisedName typically looks something like "org.alljoyn.BusNode.NW1aLaaW" and when I call busAttachment.findAdvertisedName, the arg looks like "org.alljoyn.BusNode".

On the Android device I've successfully confirmed the items added to the manifest

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

On my Windows desktop, I've attempted looking at Wireshark, but quite frankly am not aware of what should be helping me identify the issue.

Additionally, when I run the control panel application on my Android phone and run the sample ledslider.js application on my Yun, it definitely discovers the device, connects and all the happy path jazz.

Please help and let me know if I'm missing something obvious or you need more code snippets.

Thanks in advance!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-07-03 11:14:16 -0800

Baokeyai gravatar image

Well I was able to find the answer by following the logic in the ControlPanel demo and the core library (Thank goodness for opensource).

My assumption on why it works is since the Arduino is using the thin core, my desktop/android app needed to request a name on the bus and perform the quiet advertisement.

After that, since the AlljoynJS library seems to use the "About" services, I had to register an About listener which would give me the actual session host and the contact port.

Once I did that, I was successfully able to join and do the rest of the magic.

Regards!

edit flag offensive delete publish link more
0

answered 2015-07-05 02:18:55 -0800

praveenb gravatar image

You are correct.

The name org.alljoyn.BusNode.<guid-hex-string> is quietly advertised by routing nodes exclusively for thin leaf node discovery, and not for any other purposes. A thin leaf node kicks off a query for any routing nodes advertising org.alljoyn.BusNode.* and connects to one routing node among the query responders.

JoinSession api, is used to establish a session between two AllJoyn nodes. The client / joiner needs to supply a name and a port as a parameter to Join a session with the host. For JoinSession to be successful, the requirements are that the hosting end should own the name and have bound the port. Names are owned by RequestName api and Ports are bound via BindSessionPort api.

In the example you provided, because the hoster never invoked RequestName api (the application is not meant to / required to do this) with the parameter org.alljoyn.BusNode.<guid-hex-string>, the name is not owned by the host. Expectedly, JoinSession api fails when invoked with the advertisedName org.alljoyn.BusNode.<guid-hex-string> by client / joiner.

When using About functionality, JoinSession is invoked using the unique connection name of the host. Note: By definition, unique name of an app is owned by the app.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-07-02 23:48:36 -0800

Seen: 197 times

Last updated: Jul 05 '15