예제 #1
0
 void comm_AIUIConnectionReceivedEvent(object sender, AIUIConnectionReceivedEventArgs args)
 {
     if (recSetHex.Checked && !recSetASC.Checked)
     {
         SetRecTextDelegate d      = new SetRecTextDelegate(setRecText);
         string             result = "";
         foreach (byte b in args.Source)
         {
             if (b <= 0x0f)
             {
                 result += "0" + Convert.ToString(b, 16) + " ";
             }
             else
             {
                 result += Convert.ToString(b, 16) + " ";
             }
         }
         Invoke(d, result);
     }
     else
     {
         string             str = System.Text.Encoding.UTF8.GetString(args.Source);
         SetRecTextDelegate d   = new SetRecTextDelegate(setRecText);
         Invoke(d, str);
     }
 }
예제 #2
0
        void _aiuiConnection_AIUIConnectionReceivedEvent(object sender, AIUIConnectionReceivedEventArgs args)
        {
            try
            {
                if (MainService.DeviceDebugUIObj != null)
                {
                    MainService.DeviceDebugUIObj.PrintDebugLog(args.Json);
                }
            }
            catch (Exception ex) { }

            //解析Json字符串
            JObject firstObj = (JObject)JsonConvert.DeserializeObject(args.Json);

            bool   isNeedResolve = false;
            JToken eventToken    = firstObj["type"];

            if (eventToken != null)
            {
                if (eventToken.ToString().Equals("aiui_event"))
                {
                    //是aiui_event才解析
                    JToken contentObj = firstObj["content"];
                    if (contentObj != null)
                    {
                        isNeedResolve = true;
                    }
                }
                if (eventToken.ToString().Equals("tts_event"))
                {
                    //是tts_event才解析
                    JToken contentObj = firstObj["content"];
                    if (contentObj != null)
                    {
                        isNeedResolve = true;
                    }
                }

                if (isNeedResolve)
                {
                    //解析Json
                    XfJsonResolver.Resolve(firstObj);
                }
            }
        }
예제 #3
0
 void AIUIConnectionObj_AIUIConnectionReceivedEvent(object sender, AIUIConnectionReceivedEventArgs args)
 {
     System.Console.WriteLine("Recv:" + args.Json);
 }