示例#1
0
 public void Disconnect()
 {
     if (msgBus != null)
     {
         if (sJoinComplete)
         {
             msgBus.LeaveSession(theSessionId);
         }
         msgBus = null;
     }
     sJoinComplete = false;
 }
示例#2
0
 public void LeaveSession()
 {
     Debug.Log("in LeaveSession.");
     if (currentSessionId != 0)
     {
         AllJoyn.QStatus status = AllJoyn.QStatus.NONE;
         if (sessionListener != null)
         {
             Debug.Log("clear session listener");
             status          = msgBus.SetSessionListener(null, currentSessionId);
             sessionListener = null;
             if (!status)
             {
                 chatText = "SetSessionListener failed status(" + status.ToString() + ")\n" + chatText;
                 Debug.Log("SetSessionListener status(" + status.ToString() + ")");
             }
         }
         Debug.Log("about to leave session");
         status = msgBus.LeaveSession(currentSessionId);
         if (status)
         {
             chatText = "Chat LeaveSession SUCCESS (Session id=" + currentSessionId + ")\n" + chatText;
             Debug.Log("Chat LeaveSession SUCCESS (Session id=" + currentSessionId + ")");
             currentSessionId     = 0;
             currentJoinedSession = null;
         }
         else
         {
             chatText = "Chat LeaveSession failed (status=" + status.ToString() + ")\n" + chatText;
             Debug.Log("Chat LeaveSession failed (status=" + status.ToString() + ")");
         }
     }
     else
     {
         currentJoinedSession = null;
     }
     Debug.Log("done LeaveSession.");
 }