예제 #1
0
        public void CloseDown()
        {
            if(msgBus == null)
                return; //no need to clean anything up
            AllJoynStarted = false;
            LeaveSession();
            AllJoyn.QStatus status = msgBus.CancelFindAdvertisedName(SERVICE_NAME);
            if(!status) {
                chatText = "CancelAdvertisedName failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("CancelAdvertisedName failed status(" + status.ToString() + ")");
            }
            status = msgBus.CancelAdvertisedName(myAdvertisedName, opts.Transports);
            if(!status) {
                chatText = "CancelAdvertisedName failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("CancelAdvertisedName failed status(" + status.ToString() + ")");
            }
            status = msgBus.ReleaseName(myAdvertisedName);
            if(!status) {
                chatText = "ReleaseName failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("ReleaseName status(" + status.ToString() + ")");
            }
            status = msgBus.UnbindSessionPort(SERVICE_PORT);
            if(!status) {
                chatText = "UnbindSessionPort failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("UnbindSessionPort status(" + status.ToString() + ")");
            }

            status = msgBus.Disconnect(connectedVal);
            if(!status) {
                chatText = "Disconnect failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("Disconnect status(" + status.ToString() + ")");
            }

            AllJoyn.InterfaceDescription.Member chatMember = testIntf.GetMember("chat");
            status = msgBus.UnregisterSignalHandler(this.ChatSignalHandler, chatMember, null);
            chatMember = null;
            if(!status) {
                chatText = "UnregisterSignalHandler failed status(" + status.ToString() + ")\n" + chatText;
                Debug.Log("UnregisterSignalHandler status(" + status.ToString() + ")");
            }
            if(sessionListener != null) {
                status = msgBus.SetSessionListener(null, currentSessionId);
                sessionListener = null;
                if(!status) {
                    chatText = "SetSessionListener failed status(" + status.ToString() + ")\n" + chatText;
                    Debug.Log("SetSessionListener status(" + status.ToString() + ")");
                }
            }
            chatText = "No Exceptions(" + status.ToString() + ")\n" + chatText;
            Debug.Log("No Exceptions(" + status.ToString() + ")");
            currentSessionId = 0;
            currentJoinedSession = null;
            sFoundName.Clear();

            connectedVal = null;
            msgBus = null;
            busListener = null;
            sessionPortListener = null;
            testObj = null;
            testIntf = null;
            opts = null;
            myAdvertisedName = null;

            AllJoynStarted = false;

            AllJoyn.StopAllJoynProcessing(); //Stop processing alljoyn callbacks
        }
예제 #2
0
        public void CloseDown()
        {
            if (msgBus == null)
                return;
            AllJoynStarted = false;
            LeaveSession();
            AllJoyn.QStatus status = msgBus.CancelFindAdvertisedName(SERVICE_NAME);
            if (!status){
                DebugLog("CancelAdvertisedName failed status(" + status.ToString() + ")");
            }
            status = msgBus.CancelAdvertisedName(myAdvertisedName, opts.Transports);
            if (!status) {
                DebugLog("CancelAdvertisedName failed status(" + status.ToString() + ")");
            }
            status = msgBus.ReleaseName(myAdvertisedName);
            if (!status) {
                DebugLog("ReleaseName status(" + status.ToString() + ")");
            }
            status = msgBus.UnbindSessionPort(SERVICE_PORT);
            if (!status) {
                DebugLog("UnbindSessionPort status(" + status.ToString() + ")");
            }

            status = msgBus.Disconnect(connectedVal);
            if (!status) {
                DebugLog("Disconnect status(" + status.ToString() + ")");
            }

            AllJoyn.InterfaceDescription.Member vectorMember = testIntf.GetMember("vector");
            status = msgBus.UnregisterSignalHandler(this.VectorSignalHandler, vectorMember, null);
            vectorMember = null;
            if (!status) {
                DebugLog("UnregisterSignalHandler Vector status(" + status.ToString() + ")");
            }
            if (sessionListener != null) {
                status = msgBus.SetSessionListener(null, currentSessionId);
                sessionListener = null;
                if (!status) {
                    DebugLog("SetSessionListener status(" + status.ToString() + ")");
                }
            }
            DebugLog("No Exceptions(" + status.ToString() + ")");
            currentSessionId = 0;
            currentJoinedSession = null;
            sFoundName.Clear();

            connectedVal = null;
            msgBus = null;
            busListener = null;
            sessionPortListener = null;
            testObj = null;
            testIntf = null;
            opts = null;
            myAdvertisedName = null;

            AllJoynStarted = false;

            sFoundName = new ArrayList();

            AllJoyn.StopAllJoynProcessing();
        }