/** * Implementation of the functionality related to connecting our app to the AllJoyn bus. We expect * that this method will only be called in the context of the AllJoyn bus handler thread; and * while we are in the DISCONNECTED state. */ private void doConnect() { Log.i(TAG, "doConnect()"); org.alljoyn.bus.alljoyn.DaemonInit.PrepareDaemon(getApplicationContext()); assert (mBusAttachmentState == BusAttachmentState.DISCONNECTED); mBus.useOSLogging(true); mBus.setDebugLevel("ALLJOYN_JAVA", 7); mBus.registerBusListener(mBusListener); mBus.registerAboutListener(mTestListener); /* * To make a service available to other AllJoyn peers, first * register a BusObject with the BusAttachment at a specific * object path. Our service is implemented by the ChatService * BusObject found at the "/chatService" object path. */ // Status status = mBus.registerBusObject(mChatService, OBJECT_PATH); // if (Status.OK != status) { // mChatApplication.alljoynError(ChatApplication.Module.HOST, "Unable to register the chat bus // object: (" + status + ")"); // return; // } Status status = mBus.connect(); if (status != Status.OK) { mActivity.alljoynError( MainActivity.Module.GENERAL, "Unable to connect to the bus: (" + status + ")"); return; } status = mBus.registerSignalHandlers(this); if (status != Status.OK) { mActivity.alljoynError( MainActivity.Module.GENERAL, "Unable to register signal handlers: (" + status + ")"); return; } mBusAttachmentState = BusAttachmentState.CONNECTED; }