0

foundAdvertisedName is called twice in v14.12

asked 2015-03-31 04:55:27 -0700

markus_andreasson gravatar image

The BusListener callback foundAdvertisedName is called twice in AllJoyn v14.12. I'm sure this was not the case in v14.06.

When running the code below on two devices, one is started as client and the other as service, two identical sessions (except for the session ID) are created. The two sessions are both valid and I can call methods on both.

Is this a consequence from something unconventional in my code, or is there a bug in v14.12?

The following is logged on the service side:

D/ExampleActivity﹕ registerBusObject: OK
E/PERMISSION_MGR﹕ 3363.891 ****** ERROR PERMISSION_MGR lepDisp4_0 ...ndroid/PermissionDB.cc:182 | Failed to open /data/system/packages.xml: ER_FAIL
D/ExampleActivity﹕ connect: OK
D/ExampleActivity﹕ requestName(com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652): OK
D/ExampleActivity﹕ advertiseName(com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652): OK
D/ExampleActivity﹕ bindSessionPort: OK
D/ExampleActivity﹕ acceptSessionJoiner: 1234, :kKUC2sug.2
D/ExampleActivity﹕ sessionJoined: 1234, 1448136712, :kKUC2sug.2
D/ExampleActivity﹕ acceptSessionJoiner: 1234, :kKUC2sug.2
D/ExampleActivity﹕ sessionJoined: 1234, 2029123174, :kKUC2sug.2

The following is logged on the client side:

D/ExampleActivity﹕ registerBusObject: OK
E/PERMISSION_MGR﹕ 3343.049 ****** ERROR PERMISSION_MGR lepDisp4_0 ...ndroid/PermissionDB.cc:182 | Failed to open /data/system/packages.xml: ER_FAIL
D/ExampleActivity﹕ connect: OK
D/ExampleActivity﹕ findAdvertisedName(com.example.alljoyn): OK
D/ExampleActivity﹕ foundAdvertisedName: com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652 prefix: com.example.alljoyn
D/ExampleActivity﹕ Join session with com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652
D/ExampleActivity﹕ foundAdvertisedName: com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652 prefix: com.example.alljoyn
D/ExampleActivity﹕ joinSession(1448136712): OK
D/ExampleActivity﹕ Join session with com.example.alljoyn._fe9821470ecacb6b96a58c7ad0154652
D/ExampleActivity﹕ joinSession(2029123174): OK

The code:

package com.example.alljoyntest;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;

import org.alljoyn.bus.BusAttachment;
import org.alljoyn.bus.BusException;
import org.alljoyn.bus.BusListener;
import org.alljoyn.bus.BusObject;
import org.alljoyn.bus.Mutable;
import org.alljoyn.bus.ProxyBusObject;
import org.alljoyn.bus.SessionListener;
import org.alljoyn.bus.SessionOpts;
import org.alljoyn.bus.SessionPortListener;
import org.alljoyn.bus.Status;
import org.alljoyn.bus.annotation.BusInterface;
import org.alljoyn.bus.annotation.BusMethod;

import java.io.IOException;
import java.util.ArrayList;

public class ExampleActivity extends Activity {

    static {
        System.loadLibrary("alljoyn_java");
    }

    private final static String TAG = ExampleActivity.class.getSimpleName();

    private AllJoynContext mAllJoynContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mAllJoynContext = new AllJoynContext(this);

        setContentView(R.layout.example_layout);

        findViewById(R.id.connect_client).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mAllJoynContext.connect(true);
            }
        });

        findViewById(R.id.connect_service).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mAllJoynContext.connect(false);
            }
        });

        findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mAllJoynContext.send();
            }
        });

        findViewById(R.id.disconnect).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mAllJoynContext.disconnect();
            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mAllJoynContext.disconnect();
    }

    private class AllJoynContext {
        private static final String BUS_OBJECT_PATH = "/ExampleService";
        private static final String WELL_KNOWN_NAME = "com.example.alljoyn";
        private static final short CONTACT_PORT = 1234 ...
(more)
edit retag flag offensive close merge delete

Comments

I would either ask on the core mailing list or file a bug

ry.jones ( 2015-04-01 07:02:18 -0700 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2015-04-01 09:15:42 -0700

You are seeing advertisements for TRANSPORT_TCP and TRANSPORT_UDP (check the transport parameter to foundAdvertisedName).

14.12 includes TRANSPORT_UDP in TRANSPORT_ANY whereas 14.06 did not.

edit flag offensive delete publish link more

Comments

Thanks, you are right.

markus_andreasson ( 2015-04-01 09:32:00 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-03-31 04:55:27 -0700

Seen: 275 times

Last updated: Apr 01 '15