唐山轨道机控制端TCP服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

using EGFramework;
using Newtonsoft.Json;
namespace Emergency_platform{
public class ResponsePatrol : IResponse
{
public string action { set; get; }
public string taskid { set; get; }
public List<int> cabinetid { set; get; }
public bool TrySetData(string protocolData, byte[] protocolBytes)
{
try
{
ResponsePatrol data = JsonConvert.DeserializeObject<ResponsePatrol>(protocolData);
if(data.action == "patrol"){
this.action = data.action;
this.taskid = data.taskid;
this.cabinetid = data.cabinetid;
return true;
}
return false;
}
catch (System.Exception)
{
return false;
throw;
}
}
}
public class RequestPatrol : IRequest
{
public string action = "identify";
public string date { set; get; }
public string taskid { set; get; }
public int cabinetid = 1;
public List<PatrolTarget> target { set; get; }
public RequestPatrol(){
date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
target = new List<PatrolTarget>();
}
public RequestPatrol(List<PatrolTarget> target){
this.target = target;
date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
public byte[] ToProtocolByteData()
{
return null;
}
public string ToProtocolData()
{
return JsonConvert.SerializeObject(this);
}
}
public struct PatrolTarget{
public string name { set; get; }
public string result { set; get; }
public PatrolTarget(string name_,string result_){
name = name_;
result = result_;
}
}
}