using EZSockets; using RequestServer.HttpServer; using ResponseServer.HttpServer; using System; using System.Collections.Generic; using System.Linq; using System.Net.NetworkInformation; using System.Text; using System.Threading; using System.Threading.Tasks; namespace HttpServer.mitsubishi { class MitsubishiServer { private static string ON_LINE_STATE = "在线"; public static Dictionary deviceList { get; set; } = new Dictionary(); public ResponseBody requestHttpServer(RequestBody requestBody) { string ip = requestBody.serverUrl; string port = requestBody.port; string fun = requestBody.type; ResponseBody responseBody = new ResponseBody(); //先ping Ping pingSender = new Ping(); PingReply reply = pingSender.Send(requestBody.serverUrl); if (reply.Status != IPStatus.Success) { //responseBody.result = true; responseBody.msg = "调用失败"; } else { try { MitCom mitCom = new MitCom(requestBody.serverUrl); mitCom.GetSimConnect("M700M", "1", "10", ip); responseBody.deviceState = ON_LINE_STATE; if (fun == ActionTypeEnum.Collect.ToString()) { } } catch (Exception e) { responseBody.msg = "调用失败"; YG.Log.Instance.WriteLogAdd($"三菱连接结果-ex-->> " + e.Message); //deviceList.Remove(requestBody.serverUrl); } } return responseBody; } } }