1

Android Config Client receives "Illegal BusAttachment received"

asked 2015-07-07 21:19:20 -0700

trandatnh gravatar image

updated 2015-07-22 02:57:04 -0700

I used to be able to test the configuration app on Android Phone. Today I try the sample and I

  • can receive the Announcement message
  • can select the device to configure.

But whenever I update the device name or any other actions like refresh, reset device, ... I receive the exception Illegal BusAttachment received from my Android Phone.

The current setup:

  • OpenWRT is running ConfigService (14.06 or 14.12)
  • Android is running ConfigClient (14.12 or 15.04)

I follow the instruction from here: https://allseenalliance.org/developer...

Update: I try to debug and find that this function call cause the issue

configClient = configService.createFeatureConfigClient(peer.busName, null, peer.port);

Full function startConfigSession

/**
 * Create config client and create a session
 *
 * @param peer The {@link Device} to connect
 * @throws Exception If failed to create the configClient or to establish session
 */
public void startConfigSession(Device peer) throws Exception {

    if (peer == null || peer.busName == null) {

        throw new IllegalArgumentException("Received peer or peer.busName is undefined");
    }

    //If the configClient is already connected with the received peer, no need to create an additional session
    if (configClient != null && configClient.getPeerName().equals(peer.busName)) {

        if (configClient.isConnected()) {

            Log.d(TAG, "ConfigClient is already in the session with the peer: '" + peer.busName + "', sid: '"
                    + configClient.getSessionId() + "'");

            return;
        }
    }
    //Need to create a new configClient
    else {
        try {

            //Try to close the previous connection, if exists
            stopConfigSession();
            configClient = configService.createFeatureConfigClient(peer.busName, null, peer.port);
        } catch (Exception e) {

            String m = e.getMessage();
            Log.d(TAG, "startSession: Exception: " + m);
            e.printStackTrace();
            updateTheUiAboutError("startSession: Exception: " + m);
            throw e;
        }
    }

    //Instead of checking the returned status, we check the isConnected() method.
    //It takes into account both the Status.Ok and the Status.ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED
    Status status = configClient.connect();
    if (!configClient.isConnected()) {

        throw new Exception("Failed to connect to the peer: '" + peer.busName + "', Status: '" + status + "'");
    }

    Log.d(TAG, "The session with the peer: '" + peer.busName + "', has been established successfully, sid: '" +
            configClient.getSessionId() + "'");
}
edit retag flag offensive close merge delete

Comments

you might try on the core mailing list. https://lists.allseenalliance.org/mailman/listinfo/allseen-core

ry.jones ( 2015-08-07 21:01:00 -0700 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-08-08 04:52:59 -0700

trandatnh gravatar image

I debugged and found that the reason of this error is because the example code disconnect AllJoyn when the main activity is destroyed, this is just a bug in the Example not the bug with AllJoyn actuallly, I will give detail answer later.

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

Question Tools

Follow
1 follower

Stats

Asked: 2015-07-07 21:19:20 -0700

Seen: 57 times

Last updated: Jul 22 '15