|
@@ -15,6 +15,7 @@ namespace HttpServer.mitsubishi
|
|
|
{
|
|
|
private static string ON_LINE_STATE = "在线";
|
|
|
public static Dictionary<string, MitCom> deviceList { get; set; } = new Dictionary<string, MitCom>();
|
|
|
+
|
|
|
public static ResponseBody requestHttpServer(RequestBody requestBody)
|
|
|
{
|
|
|
string ip = requestBody.serverUrl;
|
|
@@ -22,9 +23,9 @@ namespace HttpServer.mitsubishi
|
|
|
string fun = requestBody.type;
|
|
|
|
|
|
ResponseBody responseBody = new ResponseBody();
|
|
|
- MitCom mitCom = null;
|
|
|
- //先ping
|
|
|
- Ping pingSender = new Ping();
|
|
|
+ MitCom mitCom = null;
|
|
|
+ //先ping
|
|
|
+ Ping pingSender = new Ping();
|
|
|
PingReply reply = pingSender.Send(requestBody.serverUrl);
|
|
|
if (reply.Status != IPStatus.Success)
|
|
|
{
|
|
@@ -37,9 +38,9 @@ namespace HttpServer.mitsubishi
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- mitCom = new MitCom();
|
|
|
+ mitCom = new MitCom(requestBody.serverUrl);
|
|
|
mitCom.GetSimConnect("M700M", "1", "10", requestBody.serverUrl);
|
|
|
- deviceList.Add(requestBody.serverUrl, mitCom);
|
|
|
+ //deviceList.Add(requestBody.serverUrl, mitCom);
|
|
|
responseBody.deviceState = ON_LINE_STATE;
|
|
|
}
|
|
|
catch (Exception e)
|
|
@@ -83,6 +84,7 @@ namespace HttpServer.mitsubishi
|
|
|
//mitCom.GetParaValue(30, 8002, 1, 1, out pvValue);
|
|
|
int runTime;
|
|
|
mitCom.GetRunTime(out runTime);
|
|
|
+ mitCom.SimClose();
|
|
|
responseBody.powerOnTime = (runTime/60).ToString();
|
|
|
}
|
|
|
}
|