diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/bin/SensorHub.Well.pdb b/bin/SensorHub.Well.pdb index 058be5a..1c12989 100644 --- a/bin/SensorHub.Well.pdb +++ b/bin/SensorHub.Well.pdb Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/bin/SensorHub.Well.pdb b/bin/SensorHub.Well.pdb index 058be5a..1c12989 100644 --- a/bin/SensorHub.Well.pdb +++ b/bin/SensorHub.Well.pdb Binary files differ diff --git a/bin/SuperSocket.SocketService.InstallLog b/bin/SuperSocket.SocketService.InstallLog index 11b93b9..b69aef9 100644 --- a/bin/SuperSocket.SocketService.InstallLog +++ b/bin/SuperSocket.SocketService.InstallLog @@ -280,3 +280,16 @@ logtoconsole = assemblypath = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.exe logfile = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.InstallLog +正在安装程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog +正在安装服务 SensorHubServiceXC... +已成功安装服务 SensorHubServiceXC。 +正在日志 Application 中创建 EventLog 源 SensorHubServiceXC... +正在提交程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/bin/SensorHub.Well.pdb b/bin/SensorHub.Well.pdb index 058be5a..1c12989 100644 --- a/bin/SensorHub.Well.pdb +++ b/bin/SensorHub.Well.pdb Binary files differ diff --git a/bin/SuperSocket.SocketService.InstallLog b/bin/SuperSocket.SocketService.InstallLog index 11b93b9..b69aef9 100644 --- a/bin/SuperSocket.SocketService.InstallLog +++ b/bin/SuperSocket.SocketService.InstallLog @@ -280,3 +280,16 @@ logtoconsole = assemblypath = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.exe logfile = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.InstallLog +正在安装程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog +正在安装服务 SensorHubServiceXC... +已成功安装服务 SensorHubServiceXC。 +正在日志 Application 中创建 EventLog 源 SensorHubServiceXC... +正在提交程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog diff --git a/bin/TestClass.exe b/bin/TestClass.exe index 21dac9c..0eb29ee 100644 --- a/bin/TestClass.exe +++ b/bin/TestClass.exe Binary files differ diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/bin/SensorHub.Well.pdb b/bin/SensorHub.Well.pdb index 058be5a..1c12989 100644 --- a/bin/SensorHub.Well.pdb +++ b/bin/SensorHub.Well.pdb Binary files differ diff --git a/bin/SuperSocket.SocketService.InstallLog b/bin/SuperSocket.SocketService.InstallLog index 11b93b9..b69aef9 100644 --- a/bin/SuperSocket.SocketService.InstallLog +++ b/bin/SuperSocket.SocketService.InstallLog @@ -280,3 +280,16 @@ logtoconsole = assemblypath = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.exe logfile = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.InstallLog +正在安装程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog +正在安装服务 SensorHubServiceXC... +已成功安装服务 SensorHubServiceXC。 +正在日志 Application 中创建 EventLog 源 SensorHubServiceXC... +正在提交程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog diff --git a/bin/TestClass.exe b/bin/TestClass.exe index 21dac9c..0eb29ee 100644 --- a/bin/TestClass.exe +++ b/bin/TestClass.exe Binary files differ diff --git a/bin/TestClass.exe.config b/bin/TestClass.exe.config index c8dc165..2757ed8 100644 --- a/bin/TestClass.exe.config +++ b/bin/TestClass.exe.config @@ -30,6 +30,7 @@ + @@ -37,6 +38,7 @@ + @@ -50,12 +52,14 @@ + + @@ -119,7 +123,7 @@ - + @@ -148,31 +152,37 @@ + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - + + + diff --git a/SensorHub.HydrogenSulfide/HydrogenSulfide.cs b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs new file mode 100644 index 0000000..027c49a --- /dev/null +++ b/SensorHub.HydrogenSulfide/HydrogenSulfide.cs @@ -0,0 +1,228 @@ +using SensorHub.Servers; +using SensorHub.Servers.Commands.CASICCommands; +using SensorHub.Servers.JsonFormat; +using SuperSocket.SocketBase.Command; +using SuperSocket.SocketBase.Protocol; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SensorHub.HydrogenSulfide +{ + public class HydrogenSulfide : CommandBase + { + public override void ExecuteCommand(CasicSession session, StringRequestInfo requestInfo) + { + //TODO: construct the receving casic data + String preamble = requestInfo.Parameters[0]; + String version = requestInfo.Parameters[1]; + String leng = requestInfo.Parameters[2]; + String devCode = requestInfo.Parameters[3]; + String routeFlag = requestInfo.Parameters[4]; + String dstNodeAddr = requestInfo.Parameters[5]; + String pduType = requestInfo.Parameters[6]; + String seq = requestInfo.Parameters[7]; + String settings = requestInfo.Parameters[8]; + String source = requestInfo.Parameters[9]; + String exist = requestInfo.Parameters[10]; + + String devName = "HydrogenSulfide"; + + if (source.Contains("-")) + { + session.Send("HTTP/1.1 200 OK\r\n\r\n\r\n"); + session.Close(); + } + + //print the receving data + String devType = "硫化氢监测终端"; + String operType = Common.getOpeTypeByPdu(pduType); + session.Logger.Info("AD接收数据:" + requestInfo.Body); + session.Logger.Info("设备类型:" + devType); + session.Logger.Info("操作类型:" + operType); + session.Logger.Info("来源:" + source); + session.Logger.Info("会话:" + session.HubAddr + "," + session.SessionID); + + byte[] btPdu = new byte[2]; //2个字节 + btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); + btPdu[1] = 0x9E; // 最高位=1表示不拆包; 0x1E = 30 表示设备类型=30 + + if (exist == "0")//数据没有缓存 + { + //判断是返回的设置确认数据帧, 回复第三方 + if (operType == "SetResponse") + { + Common.sendSetResponse(session, devCode, devName); + return; + } + + //获取电量信息,系统时间,传递给对应的handler + List tags = Common.getTags(settings, session); + + //具体业务处理 + String collectDate = ""; + int cell = -1; + int? pci = null; + int? rsrp = null; + int? snr = null; + + String softwareVersion = ""; + uint offset = 0; + uint size = 0; + + List eventList = new List(); + List datasList = new List(); + List startupList = new List(); + + foreach (Tag tag in tags) + { + if (!(tag is UploadTag)) + { + //非业务处理 + if (tag != null && tag is CellTag) + { + CellTag cellTag = (CellTag)tag; + cell = cellTag.Cell; + continue; + } + + if (tag != null && tag is PCITag) + { + PCITag pciTag = (PCITag)tag; + pci = pciTag.PCI; + continue; + } + + if (tag != null && tag is RSRPTag) + { + RSRPTag rsrpTag = (RSRPTag)tag; + rsrp = rsrpTag.RSRP; + continue; + } + + if (tag != null && tag is SNRTag) + { + SNRTag snrTag = (SNRTag)tag; + snr = snrTag.SNR; + continue; + } + + if (tag != null && tag is SystemDateTag) + { + SystemDateTag systemDateTag = (SystemDateTag)tag; + collectDate = systemDateTag.CollectDate; + continue; + } + + if (tag != null && tag is SensorException0Tag) + { + SensorException0Tag sensorException0 = tag as SensorException0Tag; + int state = sensorException0.state; + + if (state == 0) continue; + + eventList.Add(getHydrogenSulfideAlarm(state)); + + session.Logger.Info("通道一发送容错信息:oid:" + tag.Oid + ";value:" + state); + continue; + } + + if (tag != null && tag is SensorStartupTag) + { + SensorStartupTag sensorStartup = tag as SensorStartupTag; + String imei = sensorStartup.IMEI; + String iccid = sensorStartup.ICCID; + + startupList.Add(imei); + startupList.Add(iccid); + + // 开机上报三码不需要下发配置 + needConfig = false; + + session.Logger.Info("设备开机上报,设备编号DEVCODE:" + devCode + " IMEI:" + imei + " ICCID:" + iccid); + continue; + } + + //非业务处理 + if (tag != null && tag is SoftwareVersionTag) + { + SoftwareVersionTag versionTag = (SoftwareVersionTag)tag; + softwareVersion = versionTag.Version; + continue; + } + + if (tag != null && tag is OffsetTag) + { + OffsetTag offsetTag = (OffsetTag)tag; + offset = offsetTag.Offset; + continue; + } + + if (tag != null && tag is SizeTag) + { + SizeTag sizeTag = (SizeTag)tag; + size = sizeTag.Size; + continue; + } + } + else + { + //业务处理 + UploadTag uploadTag = tag as UploadTag; + switch (uploadTag.BizType) + { + case 5: + //气体浓度 + TagHandler pWatcherHandler = new HydrogenSulfideTagHandler(); + pWatcherHandler.resolve(tag, session); + + DateTime baseTime = Convert.ToDateTime(collectDate + " " + pWatcherHandler.CollecTime); + for (int i = 0; i < pWatcherHandler.DataList.Count; i++) + { + DateTime upTime = baseTime.AddMinutes(i * pWatcherHandler.Interval); + String uptime = upTime.ToString("yyyy") + upTime.ToString("MM") + upTime.ToString("dd") + + upTime.ToString("HH") + upTime.ToString("mm") + upTime.ToString("ss"); + + datasList.Add(new HydrogenSulfideDatasJson(uptime, (float)pWatcherHandler.DataList[i])); + } + + break; + default: + session.Logger.Info("未知业务类型!"); + break; + } + } + } + + // Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + + if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程 + { + Common.remoteUpgrade(session, operType, devName, devCode, btPdu, softwareVersion, size, offset, source); + return; + } + } + + // Common.senderSM4Config(session, devCode, btPdu, source); + Common.sendConfig(session, devCode, routeFlag, source, btPdu); + } + + private String getHydrogenSulfideAlarm(int state) + { + switch (state) + { + case 0: + return "HydrogenSulfideNormal";// 硫化氢正常 + case 1: + return "HydrogenSulfideCommunicationFailure"; // 传感器通信失败 采集失败 + case 2: + return "HydrogenSulfideError"; // 硫化氢传感器异常 + default: + return "HydrogenSulfideUnknown"; // 管盯未知异常 + + } + } + } +} diff --git a/SensorHub.LG/LG.cs b/SensorHub.LG/LG.cs index 84c9025..6fcab1d 100644 --- a/SensorHub.LG/LG.cs +++ b/SensorHub.LG/LG.cs @@ -217,8 +217,8 @@ } } - //Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); - Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + Common.sendMessage(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); + // Common.kafkaProduce(session, devName, devCode, cell, pci, rsrp, snr, eventList, datasList, startupList); byte[] btPdu = new byte[2]; //2个字节 btPdu[0] = Common.getRespOperType(operType, source == "433" ? true : false); diff --git a/SensorHub.Tube/Tube.cs b/SensorHub.Tube/Tube.cs index aa7464c..5c59842 100644 --- a/SensorHub.Tube/Tube.cs +++ b/SensorHub.Tube/Tube.cs @@ -52,7 +52,7 @@ //判断是返回的设置确认数据帧, 回复第三方 if (operType == "SetResponse") { - Common.sendSetResponse(session, devCode, "Tube"); + Common.sendSetResponse(session, devCode, devName); return; } diff --git a/bin/Config/log4net.config b/bin/Config/log4net.config index 6d973f7..efa786b 100644 --- a/bin/Config/log4net.config +++ b/bin/Config/log4net.config @@ -19,7 +19,7 @@ - + diff --git a/bin/InstallUtil.InstallLog b/bin/InstallUtil.InstallLog index e0c6dd3..f107865 100644 --- a/bin/InstallUtil.InstallLog +++ b/bin/InstallUtil.InstallLog @@ -2533,3 +2533,17 @@ “提交”阶段已成功完成。 已完成事务处理安装。 + +正在运行事务处理安装。 + +正在开始安装的“安装”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“安装”阶段已成功完成,正在开始“提交”阶段。 +查看日志文件的内容以获得 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe 程序集的进度。 +该文件位于 C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog。 + +“提交”阶段已成功完成。 + +已完成事务处理安装。 diff --git a/bin/SensorHub.Concentrator.dll b/bin/SensorHub.Concentrator.dll index d8cac69..d7000b8 100644 --- a/bin/SensorHub.Concentrator.dll +++ b/bin/SensorHub.Concentrator.dll Binary files differ diff --git a/bin/SensorHub.Concentrator.pdb b/bin/SensorHub.Concentrator.pdb index 806c0bb..bfd751d 100644 --- a/bin/SensorHub.Concentrator.pdb +++ b/bin/SensorHub.Concentrator.pdb Binary files differ diff --git a/bin/SensorHub.Config.dll b/bin/SensorHub.Config.dll index cbaeeb0..86fc9f1 100644 --- a/bin/SensorHub.Config.dll +++ b/bin/SensorHub.Config.dll Binary files differ diff --git a/bin/SensorHub.Config.pdb b/bin/SensorHub.Config.pdb index 75f3be9..640b1c6 100644 --- a/bin/SensorHub.Config.pdb +++ b/bin/SensorHub.Config.pdb Binary files differ diff --git a/bin/SensorHub.CorrEnv.dll b/bin/SensorHub.CorrEnv.dll index 9a861bb..b167928 100644 --- a/bin/SensorHub.CorrEnv.dll +++ b/bin/SensorHub.CorrEnv.dll Binary files differ diff --git a/bin/SensorHub.CorrEnv.pdb b/bin/SensorHub.CorrEnv.pdb index 78e2197..2d93ca2 100644 --- a/bin/SensorHub.CorrEnv.pdb +++ b/bin/SensorHub.CorrEnv.pdb Binary files differ diff --git a/bin/SensorHub.CorrRate.dll b/bin/SensorHub.CorrRate.dll index ec7a5a6..69b44b3 100644 --- a/bin/SensorHub.CorrRate.dll +++ b/bin/SensorHub.CorrRate.dll Binary files differ diff --git a/bin/SensorHub.CorrRate.pdb b/bin/SensorHub.CorrRate.pdb index 739afc0..2d93dd3 100644 --- a/bin/SensorHub.CorrRate.pdb +++ b/bin/SensorHub.CorrRate.pdb Binary files differ diff --git a/bin/SensorHub.Correlator.dll b/bin/SensorHub.Correlator.dll index 25af731..7177250 100644 --- a/bin/SensorHub.Correlator.dll +++ b/bin/SensorHub.Correlator.dll Binary files differ diff --git a/bin/SensorHub.Correlator.pdb b/bin/SensorHub.Correlator.pdb index 1cb5781..bc01a0b 100644 --- a/bin/SensorHub.Correlator.pdb +++ b/bin/SensorHub.Correlator.pdb Binary files differ diff --git a/bin/SensorHub.Dig.dll b/bin/SensorHub.Dig.dll index c2699d6..9fec4c8 100644 --- a/bin/SensorHub.Dig.dll +++ b/bin/SensorHub.Dig.dll Binary files differ diff --git a/bin/SensorHub.Dig.pdb b/bin/SensorHub.Dig.pdb index 18025e9..479f036 100644 --- a/bin/SensorHub.Dig.pdb +++ b/bin/SensorHub.Dig.pdb Binary files differ diff --git a/bin/SensorHub.FireHydrant.dll b/bin/SensorHub.FireHydrant.dll index e50ffd4..fb714d1 100644 --- a/bin/SensorHub.FireHydrant.dll +++ b/bin/SensorHub.FireHydrant.dll Binary files differ diff --git a/bin/SensorHub.FireHydrant.pdb b/bin/SensorHub.FireHydrant.pdb index 2d62173..b61cf99 100644 --- a/bin/SensorHub.FireHydrant.pdb +++ b/bin/SensorHub.FireHydrant.pdb Binary files differ diff --git a/bin/SensorHub.LG.dll b/bin/SensorHub.LG.dll index efb5e5b..bcac676 100644 --- a/bin/SensorHub.LG.dll +++ b/bin/SensorHub.LG.dll Binary files differ diff --git a/bin/SensorHub.LG.pdb b/bin/SensorHub.LG.pdb index da64737..ee3218f 100644 --- a/bin/SensorHub.LG.pdb +++ b/bin/SensorHub.LG.pdb Binary files differ diff --git a/bin/SensorHub.Lamp.dll b/bin/SensorHub.Lamp.dll index bf80b72..2650bef 100644 --- a/bin/SensorHub.Lamp.dll +++ b/bin/SensorHub.Lamp.dll Binary files differ diff --git a/bin/SensorHub.Lamp.pdb b/bin/SensorHub.Lamp.pdb index dd709a1..884df63 100644 --- a/bin/SensorHub.Lamp.pdb +++ b/bin/SensorHub.Lamp.pdb Binary files differ diff --git a/bin/SensorHub.Lamphouse.dll b/bin/SensorHub.Lamphouse.dll index 900d0ac..bd966b5 100644 --- a/bin/SensorHub.Lamphouse.dll +++ b/bin/SensorHub.Lamphouse.dll Binary files differ diff --git a/bin/SensorHub.Lamphouse.pdb b/bin/SensorHub.Lamphouse.pdb index 95dc30a..fbddbf6 100644 --- a/bin/SensorHub.Lamphouse.pdb +++ b/bin/SensorHub.Lamphouse.pdb Binary files differ diff --git a/bin/SensorHub.Liquid.dll b/bin/SensorHub.Liquid.dll index e7b46ae..fd95378 100644 --- a/bin/SensorHub.Liquid.dll +++ b/bin/SensorHub.Liquid.dll Binary files differ diff --git a/bin/SensorHub.Liquid.pdb b/bin/SensorHub.Liquid.pdb index d0b97a6..1019a5b 100644 --- a/bin/SensorHub.Liquid.pdb +++ b/bin/SensorHub.Liquid.pdb Binary files differ diff --git a/bin/SensorHub.Locator.dll b/bin/SensorHub.Locator.dll index cd3c80d..502e36f 100644 --- a/bin/SensorHub.Locator.dll +++ b/bin/SensorHub.Locator.dll Binary files differ diff --git a/bin/SensorHub.Locator.pdb b/bin/SensorHub.Locator.pdb index b06878d..9bfb2e0 100644 --- a/bin/SensorHub.Locator.pdb +++ b/bin/SensorHub.Locator.pdb Binary files differ diff --git a/bin/SensorHub.Locator2.dll b/bin/SensorHub.Locator2.dll index c8c5cca..ebd0139 100644 --- a/bin/SensorHub.Locator2.dll +++ b/bin/SensorHub.Locator2.dll Binary files differ diff --git a/bin/SensorHub.Locator2.pdb b/bin/SensorHub.Locator2.pdb index 2c33c19..374b9e7 100644 --- a/bin/SensorHub.Locator2.pdb +++ b/bin/SensorHub.Locator2.pdb Binary files differ diff --git a/bin/SensorHub.Methane.dll b/bin/SensorHub.Methane.dll index 509260c..9cad21a 100644 --- a/bin/SensorHub.Methane.dll +++ b/bin/SensorHub.Methane.dll Binary files differ diff --git a/bin/SensorHub.Methane.pdb b/bin/SensorHub.Methane.pdb index 301ea49..3e8ae03 100644 --- a/bin/SensorHub.Methane.pdb +++ b/bin/SensorHub.Methane.pdb Binary files differ diff --git a/bin/SensorHub.MultiLeak.dll b/bin/SensorHub.MultiLeak.dll index d8504b3..9c52c6b 100644 --- a/bin/SensorHub.MultiLeak.dll +++ b/bin/SensorHub.MultiLeak.dll Binary files differ diff --git a/bin/SensorHub.MultiLeak.pdb b/bin/SensorHub.MultiLeak.pdb index 13a948e..b2874aa 100644 --- a/bin/SensorHub.MultiLeak.pdb +++ b/bin/SensorHub.MultiLeak.pdb Binary files differ diff --git a/bin/SensorHub.Noise.dll b/bin/SensorHub.Noise.dll index b3f37d6..abd4048 100644 --- a/bin/SensorHub.Noise.dll +++ b/bin/SensorHub.Noise.dll Binary files differ diff --git a/bin/SensorHub.Noise.pdb b/bin/SensorHub.Noise.pdb index 660d236..4cc62d0 100644 --- a/bin/SensorHub.Noise.pdb +++ b/bin/SensorHub.Noise.pdb Binary files differ diff --git a/bin/SensorHub.NoiseDig.dll b/bin/SensorHub.NoiseDig.dll index c476e0d..d92f3d9 100644 --- a/bin/SensorHub.NoiseDig.dll +++ b/bin/SensorHub.NoiseDig.dll Binary files differ diff --git a/bin/SensorHub.NoiseDig.pdb b/bin/SensorHub.NoiseDig.pdb index b44dc1c..38ca28f 100644 --- a/bin/SensorHub.NoiseDig.pdb +++ b/bin/SensorHub.NoiseDig.pdb Binary files differ diff --git a/bin/SensorHub.Servers.dll b/bin/SensorHub.Servers.dll index 071dcd1..ebd87b7 100644 --- a/bin/SensorHub.Servers.dll +++ b/bin/SensorHub.Servers.dll Binary files differ diff --git a/bin/SensorHub.Servers.pdb b/bin/SensorHub.Servers.pdb index 054bca2..be74deb 100644 --- a/bin/SensorHub.Servers.pdb +++ b/bin/SensorHub.Servers.pdb Binary files differ diff --git a/bin/SensorHub.TempHumi.dll b/bin/SensorHub.TempHumi.dll index 10524c8..7d635c7 100644 --- a/bin/SensorHub.TempHumi.dll +++ b/bin/SensorHub.TempHumi.dll Binary files differ diff --git a/bin/SensorHub.TempHumi.pdb b/bin/SensorHub.TempHumi.pdb index 24fb51b..c9f000b 100644 --- a/bin/SensorHub.TempHumi.pdb +++ b/bin/SensorHub.TempHumi.pdb Binary files differ diff --git a/bin/SensorHub.TempPressure.dll b/bin/SensorHub.TempPressure.dll index 8e5be4f..e029ef5 100644 --- a/bin/SensorHub.TempPressure.dll +++ b/bin/SensorHub.TempPressure.dll Binary files differ diff --git a/bin/SensorHub.TempPressure.pdb b/bin/SensorHub.TempPressure.pdb index 737af69..7cd0601 100644 --- a/bin/SensorHub.TempPressure.pdb +++ b/bin/SensorHub.TempPressure.pdb Binary files differ diff --git a/bin/SensorHub.Utility.dll b/bin/SensorHub.Utility.dll index 42bc0af..76d1d95 100644 --- a/bin/SensorHub.Utility.dll +++ b/bin/SensorHub.Utility.dll Binary files differ diff --git a/bin/SensorHub.Utility.pdb b/bin/SensorHub.Utility.pdb index 519c15b..5df4d40 100644 --- a/bin/SensorHub.Utility.pdb +++ b/bin/SensorHub.Utility.pdb Binary files differ diff --git a/bin/SensorHub.WasteGas.dll b/bin/SensorHub.WasteGas.dll index 7ec11aa..aabc702 100644 --- a/bin/SensorHub.WasteGas.dll +++ b/bin/SensorHub.WasteGas.dll Binary files differ diff --git a/bin/SensorHub.WasteGas.pdb b/bin/SensorHub.WasteGas.pdb index 5b089d6..eeda5c8 100644 --- a/bin/SensorHub.WasteGas.pdb +++ b/bin/SensorHub.WasteGas.pdb Binary files differ diff --git a/bin/SensorHub.WaterMeter.dll b/bin/SensorHub.WaterMeter.dll index 0f4e6bb..8fa8917 100644 --- a/bin/SensorHub.WaterMeter.dll +++ b/bin/SensorHub.WaterMeter.dll Binary files differ diff --git a/bin/SensorHub.WaterMeter.pdb b/bin/SensorHub.WaterMeter.pdb index f39b62d..cff5773 100644 --- a/bin/SensorHub.WaterMeter.pdb +++ b/bin/SensorHub.WaterMeter.pdb Binary files differ diff --git a/bin/SensorHub.Well.dll b/bin/SensorHub.Well.dll index fa34d43..c661020 100644 --- a/bin/SensorHub.Well.dll +++ b/bin/SensorHub.Well.dll Binary files differ diff --git a/bin/SensorHub.Well.pdb b/bin/SensorHub.Well.pdb index 058be5a..1c12989 100644 --- a/bin/SensorHub.Well.pdb +++ b/bin/SensorHub.Well.pdb Binary files differ diff --git a/bin/SuperSocket.SocketService.InstallLog b/bin/SuperSocket.SocketService.InstallLog index 11b93b9..b69aef9 100644 --- a/bin/SuperSocket.SocketService.InstallLog +++ b/bin/SuperSocket.SocketService.InstallLog @@ -280,3 +280,16 @@ logtoconsole = assemblypath = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.exe logfile = E:\gwq\SensorHub_EY\bin\SuperSocket.SocketService.InstallLog +正在安装程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog +正在安装服务 SensorHubServiceXC... +已成功安装服务 SensorHubServiceXC。 +正在日志 Application 中创建 EventLog 源 SensorHubServiceXC... +正在提交程序集“C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe”。 +受影响的参数是: + logtoconsole = + assemblypath = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.exe + logfile = C:\casic\tanyue\Workspace VS\SensorHub\bin\SuperSocket.SocketService.InstallLog diff --git a/bin/TestClass.exe b/bin/TestClass.exe index 21dac9c..0eb29ee 100644 --- a/bin/TestClass.exe +++ b/bin/TestClass.exe Binary files differ diff --git a/bin/TestClass.exe.config b/bin/TestClass.exe.config index c8dc165..2757ed8 100644 --- a/bin/TestClass.exe.config +++ b/bin/TestClass.exe.config @@ -30,6 +30,7 @@ + @@ -37,6 +38,7 @@ + @@ -50,12 +52,14 @@ + + @@ -119,7 +123,7 @@ - + @@ -148,31 +152,37 @@ + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - + + + diff --git a/bin/TestClass.pdb b/bin/TestClass.pdb index 0cd7011..56906d2 100644 --- a/bin/TestClass.pdb +++ b/bin/TestClass.pdb Binary files differ