Beispiel #1
0
 private void onRecvedData()
 {
     ADebug.Log("onRecvedData OnDataRecvedProc");
     while (true)
     {
         int    num;
         byte[] buffer = null;
         if (this.connector.ReadData(out buffer, out num) != ApolloResult.Success)
         {
             return;
         }
         try
         {
             ApolloMessage message = ApolloMessageManager.Instance.UnpackResponseData(buffer, num);
             if (message != null)
             {
                 ADebug.Log(string.Concat(new object[] { "Recved:", message.Command, " and resp is:", message.Response }));
                 ADebug.Log(string.Concat(new object[] { "OnDataRecvedProc: apolloMessage.Handler != null?: ", message.Handler != null, " apolloMessage.HandlerWithReceipt != null?: ", message.HandlerWithReceipt != null, " apolloMessage.HandlerWithoutReceipt != null?: ", message.HandlerWithoutReceipt != null }));
                 message.HandleMessage();
             }
             else
             {
                 ADebug.LogError("OnDataRecvedProc UnpackResponseData error");
             }
         }
         catch (Exception exception)
         {
             ADebug.LogException(exception);
         }
     }
 }
Beispiel #2
0
 private void onRecvedData()
 {
     ADebug.Log("onRecvedData OnDataRecvedProc");
     while (true)
     {
         byte[]       data = null;
         int          realSize;
         ApolloResult apolloResult = this.connector.ReadData(out data, out realSize);
         if (apolloResult != ApolloResult.Success)
         {
             break;
         }
         try
         {
             ApolloMessage apolloMessage = ApolloMessageManager.Instance.UnpackResponseData(data, realSize);
             if (apolloMessage != null)
             {
                 ADebug.Log(string.Concat(new object[]
                 {
                     "Recved:",
                     apolloMessage.Command,
                     " and resp is:",
                     apolloMessage.Response
                 }));
                 ADebug.Log(string.Concat(new object[]
                 {
                     "OnDataRecvedProc: apolloMessage.Handler != null?: ",
                     apolloMessage.Handler != null,
                     " apolloMessage.HandlerWithReceipt != null?: ",
                     apolloMessage.HandlerWithReceipt != null,
                     " apolloMessage.HandlerWithoutReceipt != null?: ",
                     apolloMessage.HandlerWithoutReceipt != null
                 }));
                 apolloMessage.HandleMessage();
             }
             else
             {
                 ADebug.LogError("OnDataRecvedProc UnpackResponseData error");
             }
         }
         catch (Exception exception)
         {
             ADebug.LogException(exception);
         }
     }
 }