/// <summary> /// 向智能主机执行回调方法 /// </summary> /// <param name="body"></param> /// <returns></returns> public static string CallbackMsg(AIAnswers _Semantics) { log.Info("智能家居CallbackMsg回调:::::::" + _Semantics.Questions); Console.WriteLine("智能家居CallbackMsg回调:::::::" + _Semantics.Questions); log.Info($"智能家居smarthome{_Semantics.SessionId}回调完毕:::::::"); return("sendok"); }
//public string SendMsg(string msg) //{ // try // { // string sendMsg = $"connect user:wali_Server type:other msg:wali_{user};8;815;0$/r$\r\n"; // //Console.WriteLine($"发送:{sendMsg}"); // //通过 clientSocket 注册用户{ DateTime.Now.ToString("yyyyMMdd-HHmmss:fff")} // byte[] sendBuffer = Encoding.UTF8.GetBytes(sendMsg); // clientSocket.Send(sendBuffer); // clientSocket.ReceiveTimeout = 1500; // //Console.WriteLine($"【{Thread.CurrentThread.ManagedThreadId.ToString("00")}】发送SmartHome内容:{msg}"); // int receiveL = clientSocket.Receive(result); // string returnMsg = Encoding.UTF8.GetString(result, 0, receiveL); // Console.WriteLine($"发送返回:{returnMsg} 返回时间:{DateTime.Now.ToString("yyyyMMdd-HHmmss:fff")}"); // return returnMsg; // //string returnMsg = SmartRequest.SendSync(msg); // //return $"{msg} 返回 {returnMsg}"; // } // catch (Exception ex) // { // Console.WriteLine($"连接服务器失败,请按回车键退出!{ex.Message}"); // return null; // } //} public string CallbackMsg(AIAnswers _Semantics) { try { //string sendMsg = "connect user:wali_Server type:other msg:wali_C40BCB80050A;8;815;0$/r$\r\n"; //string returnMsg = ""; ////通过 clientSocket 发送指令 //clientSocket.Send(Encoding.UTF8.GetBytes(msg)); //int receiveL2 = clientSocket.Receive(result); //returnMsg = Encoding.UTF8.GetString(result, 0, receiveL2); //if (string.IsNullOrEmpty(returnMsg)) //{ // returnMsg = $"{msg}无回调结果"; //} //return returnMsg; return("smartHome回调"); //string returnMsg = SmartRequest.SendSync(msg); //return $"{msg} 回调 {returnMsg}"; } catch (Exception ex) { Console.WriteLine(ex.Message); return(ex.Message); } }
public string CallbackMsg(AIAnswers _Semantics) { return($"窗帘购买成功!"); }
public string CallbackMsg(AIAnswers semantics) { return($"已为您播放《卷珠帘》"); }