diff --git a/SensorHub.Methane/Methane.cs b/SensorHub.Methane/Methane.cs
index a046030..0730f4e 100644
--- a/SensorHub.Methane/Methane.cs
+++ b/SensorHub.Methane/Methane.cs
@@ -5,8 +5,6 @@
using SuperSocket.SocketBase.Protocol;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace SensorHub.Methane
{
@@ -173,6 +171,9 @@
TagHandler methaneHandler = new MethaneTagHandler();
methaneHandler.resolve(tag, session);
+ // 为环能和讯腾设备的uptime字段做特殊处理
+ collectDate = changeTimeToBinForXT(devCode, collectDate);
+
DateTime baseTime = Convert.ToDateTime(collectDate + " " + methaneHandler.CollecTime);
for (int i = 0; i < methaneHandler.DataList.Count; i++)
{
@@ -191,8 +192,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);
if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程
{
@@ -200,7 +201,7 @@
return;
}
}
-
+
Common.sendConfig(session, devCode, routeFlag, source, btPdu);
}
@@ -219,5 +220,44 @@
}
}
+
+ private String changeTimeToBinForXT(String devcode, String colltime)
+ {
+ String retCollTime = "";
+ String xtMin = System.Configuration.ConfigurationManager.AppSettings["xtMin"];
+ String xtMax = System.Configuration.ConfigurationManager.AppSettings["xtMax"];
+ String hnMin1 = System.Configuration.ConfigurationManager.AppSettings["hnMin1"];
+ String hnMax1 = System.Configuration.ConfigurationManager.AppSettings["hnMax1"];
+ String hnMin2 = System.Configuration.ConfigurationManager.AppSettings["hnMin2"];
+ String hnMax2 = System.Configuration.ConfigurationManager.AppSettings["hnMax2"];
+
+ if (String.Compare(devcode, xtMax) > 0 && String.Compare(devcode, hnMax1) > 0 && String.Compare(devcode, hnMax2) > 0)
+ {
+ return colltime;
+ }
+ else if (String.Compare(devcode, xtMin) < 0 && String.Compare(devcode, hnMin1) < 0 && String.Compare(devcode, hnMin2) < 0)
+ {
+ return colltime;
+ }
+ else
+ {
+ Console.WriteLine(devcode);
+ Console.WriteLine(colltime);
+ String[] timeArray = colltime.Split('-');
+
+ int yearValue = int.Parse(timeArray[0].Substring(2));
+ String yearStr = "20" + yearValue.ToString("X2");
+
+ int monthValue = int.Parse(timeArray[1]);
+ String monthStr = monthValue.ToString("X2");
+
+ int dateValue = int.Parse(timeArray[2]);
+ String dateStr = dateValue.ToString("X2");
+
+ retCollTime = yearStr + "-" + monthStr + "-" + dateStr;
+ }
+
+ return retCollTime;
+ }
}
}
diff --git a/SensorHub.Methane/Methane.cs b/SensorHub.Methane/Methane.cs
index a046030..0730f4e 100644
--- a/SensorHub.Methane/Methane.cs
+++ b/SensorHub.Methane/Methane.cs
@@ -5,8 +5,6 @@
using SuperSocket.SocketBase.Protocol;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace SensorHub.Methane
{
@@ -173,6 +171,9 @@
TagHandler methaneHandler = new MethaneTagHandler();
methaneHandler.resolve(tag, session);
+ // 为环能和讯腾设备的uptime字段做特殊处理
+ collectDate = changeTimeToBinForXT(devCode, collectDate);
+
DateTime baseTime = Convert.ToDateTime(collectDate + " " + methaneHandler.CollecTime);
for (int i = 0; i < methaneHandler.DataList.Count; i++)
{
@@ -191,8 +192,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);
if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程
{
@@ -200,7 +201,7 @@
return;
}
}
-
+
Common.sendConfig(session, devCode, routeFlag, source, btPdu);
}
@@ -219,5 +220,44 @@
}
}
+
+ private String changeTimeToBinForXT(String devcode, String colltime)
+ {
+ String retCollTime = "";
+ String xtMin = System.Configuration.ConfigurationManager.AppSettings["xtMin"];
+ String xtMax = System.Configuration.ConfigurationManager.AppSettings["xtMax"];
+ String hnMin1 = System.Configuration.ConfigurationManager.AppSettings["hnMin1"];
+ String hnMax1 = System.Configuration.ConfigurationManager.AppSettings["hnMax1"];
+ String hnMin2 = System.Configuration.ConfigurationManager.AppSettings["hnMin2"];
+ String hnMax2 = System.Configuration.ConfigurationManager.AppSettings["hnMax2"];
+
+ if (String.Compare(devcode, xtMax) > 0 && String.Compare(devcode, hnMax1) > 0 && String.Compare(devcode, hnMax2) > 0)
+ {
+ return colltime;
+ }
+ else if (String.Compare(devcode, xtMin) < 0 && String.Compare(devcode, hnMin1) < 0 && String.Compare(devcode, hnMin2) < 0)
+ {
+ return colltime;
+ }
+ else
+ {
+ Console.WriteLine(devcode);
+ Console.WriteLine(colltime);
+ String[] timeArray = colltime.Split('-');
+
+ int yearValue = int.Parse(timeArray[0].Substring(2));
+ String yearStr = "20" + yearValue.ToString("X2");
+
+ int monthValue = int.Parse(timeArray[1]);
+ String monthStr = monthValue.ToString("X2");
+
+ int dateValue = int.Parse(timeArray[2]);
+ String dateStr = dateValue.ToString("X2");
+
+ retCollTime = yearStr + "-" + monthStr + "-" + dateStr;
+ }
+
+ return retCollTime;
+ }
}
}
diff --git a/SensorHub.Methane/SensorHub.Methane.csproj b/SensorHub.Methane/SensorHub.Methane.csproj
index b7da214..acdfb64 100644
--- a/SensorHub.Methane/SensorHub.Methane.csproj
+++ b/SensorHub.Methane/SensorHub.Methane.csproj
@@ -43,6 +43,7 @@
..\bin\SuperSocket.SocketBase.dll
+
diff --git a/SensorHub.Methane/Methane.cs b/SensorHub.Methane/Methane.cs
index a046030..0730f4e 100644
--- a/SensorHub.Methane/Methane.cs
+++ b/SensorHub.Methane/Methane.cs
@@ -5,8 +5,6 @@
using SuperSocket.SocketBase.Protocol;
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
namespace SensorHub.Methane
{
@@ -173,6 +171,9 @@
TagHandler methaneHandler = new MethaneTagHandler();
methaneHandler.resolve(tag, session);
+ // 为环能和讯腾设备的uptime字段做特殊处理
+ collectDate = changeTimeToBinForXT(devCode, collectDate);
+
DateTime baseTime = Convert.ToDateTime(collectDate + " " + methaneHandler.CollecTime);
for (int i = 0; i < methaneHandler.DataList.Count; i++)
{
@@ -191,8 +192,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);
if (softwareVersion != "" || size != 0 || offset != 0)//进入远程升级流程
{
@@ -200,7 +201,7 @@
return;
}
}
-
+
Common.sendConfig(session, devCode, routeFlag, source, btPdu);
}
@@ -219,5 +220,44 @@
}
}
+
+ private String changeTimeToBinForXT(String devcode, String colltime)
+ {
+ String retCollTime = "";
+ String xtMin = System.Configuration.ConfigurationManager.AppSettings["xtMin"];
+ String xtMax = System.Configuration.ConfigurationManager.AppSettings["xtMax"];
+ String hnMin1 = System.Configuration.ConfigurationManager.AppSettings["hnMin1"];
+ String hnMax1 = System.Configuration.ConfigurationManager.AppSettings["hnMax1"];
+ String hnMin2 = System.Configuration.ConfigurationManager.AppSettings["hnMin2"];
+ String hnMax2 = System.Configuration.ConfigurationManager.AppSettings["hnMax2"];
+
+ if (String.Compare(devcode, xtMax) > 0 && String.Compare(devcode, hnMax1) > 0 && String.Compare(devcode, hnMax2) > 0)
+ {
+ return colltime;
+ }
+ else if (String.Compare(devcode, xtMin) < 0 && String.Compare(devcode, hnMin1) < 0 && String.Compare(devcode, hnMin2) < 0)
+ {
+ return colltime;
+ }
+ else
+ {
+ Console.WriteLine(devcode);
+ Console.WriteLine(colltime);
+ String[] timeArray = colltime.Split('-');
+
+ int yearValue = int.Parse(timeArray[0].Substring(2));
+ String yearStr = "20" + yearValue.ToString("X2");
+
+ int monthValue = int.Parse(timeArray[1]);
+ String monthStr = monthValue.ToString("X2");
+
+ int dateValue = int.Parse(timeArray[2]);
+ String dateStr = dateValue.ToString("X2");
+
+ retCollTime = yearStr + "-" + monthStr + "-" + dateStr;
+ }
+
+ return retCollTime;
+ }
}
}
diff --git a/SensorHub.Methane/SensorHub.Methane.csproj b/SensorHub.Methane/SensorHub.Methane.csproj
index b7da214..acdfb64 100644
--- a/SensorHub.Methane/SensorHub.Methane.csproj
+++ b/SensorHub.Methane/SensorHub.Methane.csproj
@@ -43,6 +43,7 @@
..\bin\SuperSocket.SocketBase.dll
+
diff --git a/TestClass/App.config b/TestClass/App.config
index dfa376d..49fa8f6 100644
--- a/TestClass/App.config
+++ b/TestClass/App.config
@@ -196,7 +196,20 @@
-
+
+
+
+
+
+
+
+
+
+