|
|
@ -34,60 +34,112 @@ public class DeviceInfo : MonoBehaviour |
|
|
|
Destroy(item.gameObject); |
|
|
|
Destroy(item.gameObject); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (info.deviceType == 256 || info.deviceType == 258) |
|
|
|
Debug.Log("数据:" + info.timelyData); |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
设备类型code (136-用户信息传输装置, 258-消防水泵状态, |
|
|
|
|
|
|
|
401-消防水箱水位, 302-消防主管网压力, 305-消火栓末端压力, |
|
|
|
|
|
|
|
256-喷淋泵, 301-喷淋主管网压力, 304-喷淋末端压力, |
|
|
|
|
|
|
|
451-正压送风机, 452-防火排烟风机, 453-补风机) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
InfoBase infobase = JsonConvert.DeserializeObject<InfoBase>(info.timelyData.ToString()); |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("名称 : " + infobase.deviceName); |
|
|
|
|
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("名称:" + pinfo.deviceName); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("类型 : " + infobase.deviceTypeName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (info.deviceType == 256 || info.deviceType == 258) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("状态:" + pinfo.startStopStatus); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("手自动状态 : " + (pinfo.manualAutomaticState == "0" ? "自动" : "手动")); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("状态:" + pinfo.faultStatus); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("电源状态 : " + (pinfo.powerState == "0" ? "已上电" : "未上电")); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("电源状态:" + pinfo.powerState); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("故障信息 : " + (pinfo.faultStatus == "0" ? "正常" : "故障")); |
|
|
|
} |
|
|
|
} |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("描述:" + pinfo.descript); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("启停状态 : " + (pinfo.startStopStatus == "0" ? "停止" : "启动")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (info.deviceType == 401) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
SXInfo pinfo = JsonConvert.DeserializeObject<SXInfo>(info.timelyData.ToString()); |
|
|
|
{ |
|
|
|
{ |
|
|
|
PLInfo pinfo = JsonConvert.DeserializeObject<PLInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("楼层:" + pinfo.floor); |
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("水位 : " + pinfo.level); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("预警状态 : " + (pinfo.alarmStatus == "0" ? "正常" : "告警")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (info.deviceType == 305) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
XHSInfo pinfo = JsonConvert.DeserializeObject<XHSInfo>(info.timelyData.ToString()); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("压力 : " + pinfo.pressure); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("预警状态 : " + (pinfo.alarmStatus == "0" ? "正常" : "告警")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("楼层 : " + infobase.floor); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GameObject go = Instantiate(infoItem, infoParent); |
|
|
|
|
|
|
|
go.GetComponent<DeviceInfoItem>().Bind("描述 : " + infobase.descript); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gameObject.SetActive(true); |
|
|
|
gameObject.SetActive(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
public class PLInfo |
|
|
|
public class InfoBase |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public string deviceType;//类型例如"256" |
|
|
|
|
|
|
|
public string devInterface;//"spraypump" |
|
|
|
|
|
|
|
public string openProjectId;//"1150" |
|
|
|
|
|
|
|
public string deviceTypeName;//"喷淋泵" |
|
|
|
|
|
|
|
public string ulogtime;// "1712793073050" |
|
|
|
|
|
|
|
public int isOnline;//1 在线状态 |
|
|
|
|
|
|
|
public string deviceNo;//"2020000006461" |
|
|
|
|
|
|
|
public string deviceName; //"水泵控制柜6461" |
|
|
|
|
|
|
|
public string logTime;//"2024-04-11 07:51:12" |
|
|
|
|
|
|
|
public string devSystem;// "sprinkler" |
|
|
|
|
|
|
|
public string appKey;// "849248896159842305" |
|
|
|
|
|
|
|
public string descript;//描述 |
|
|
|
|
|
|
|
public string floor;//楼层 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//manualAutomaticState 手自动状态(0 自动,1 手动) TRUE string |
|
|
|
|
|
|
|
//powerState 电源状态(0 已上电,1 未上电) TRUE string |
|
|
|
|
|
|
|
//faultStatus 故障信息(0 正常,1 故障) TRUE string |
|
|
|
|
|
|
|
//startStopStatus 启停状态(0 停止,1 启动) TRUE string |
|
|
|
|
|
|
|
public class PLInfo : InfoBase |
|
|
|
{ |
|
|
|
{ |
|
|
|
public string deviceType; |
|
|
|
|
|
|
|
public string devInterface; |
|
|
|
|
|
|
|
public string startStopStatus; |
|
|
|
public string startStopStatus; |
|
|
|
public string openProjectId; |
|
|
|
|
|
|
|
public string deviceTypeName; |
|
|
|
|
|
|
|
public string faultStatus; |
|
|
|
public string faultStatus; |
|
|
|
public string ulogtime; |
|
|
|
|
|
|
|
public int isOnline; |
|
|
|
|
|
|
|
public string deviceNo; |
|
|
|
|
|
|
|
public string deviceName; |
|
|
|
|
|
|
|
public string logTime; |
|
|
|
|
|
|
|
public string powerState; |
|
|
|
public string powerState; |
|
|
|
public string manualAutomaticState; |
|
|
|
public string manualAutomaticState; |
|
|
|
public string devSystem; |
|
|
|
} |
|
|
|
public string appKey; |
|
|
|
public class XHSInfo : InfoBase |
|
|
|
public string descript; |
|
|
|
{ |
|
|
|
public string floor; |
|
|
|
public string pressure; |
|
|
|
|
|
|
|
public string alarmStatus; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public class SXInfo : InfoBase |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public string level; |
|
|
|
|
|
|
|
public string alarmStatus; |
|
|
|
} |
|
|
|
} |