|
|
|
@ -30,6 +30,7 @@ using K4os.Compression.LZ4.Streams.Abstractions;
|
|
|
|
|
using Mesnac.Log;
|
|
|
|
|
using Microsoft.Xaml.Behaviors.Core;
|
|
|
|
|
using Mysqlx.Crud;
|
|
|
|
|
using Org.BouncyCastle.Utilities;
|
|
|
|
|
using Org.BouncyCastle.Utilities.Encoders;
|
|
|
|
|
using TouchSocket.Core;
|
|
|
|
|
using TouchSocket.Sockets;
|
|
|
|
@ -276,7 +277,7 @@ namespace SocketExample
|
|
|
|
|
string commandState = readStateString.Substring(6, 2);//获取命令
|
|
|
|
|
|
|
|
|
|
if (commandState != "81")
|
|
|
|
|
Infotext += $"({currentTime})客户端接收到信息:\n{hexString}\n";
|
|
|
|
|
Infotext += $"\n({currentTime})客户端接收到信息:\n{hexString}\n";
|
|
|
|
|
|
|
|
|
|
int i = Convert.ToInt32(dataLength, 16);
|
|
|
|
|
if (i != 0)
|
|
|
|
@ -291,9 +292,6 @@ namespace SocketExample
|
|
|
|
|
Array.Copy(data, 5, newData, 5, 4);
|
|
|
|
|
Array.Copy(data, 5, newData, 6, data.Length - 5);
|
|
|
|
|
Timeinfo = $"{time}";//获取时间
|
|
|
|
|
string NewDataString = BitConverter.ToString(newData).Replace("-", " ");
|
|
|
|
|
|
|
|
|
|
int startTemp = 33;
|
|
|
|
|
|
|
|
|
|
//Infotext += $"({currentTime})客户端接收到EPC信息:\n{EPCASC}\n\n";
|
|
|
|
|
|
|
|
|
@ -301,13 +299,11 @@ namespace SocketExample
|
|
|
|
|
ObservableCollection<TagItem> items = new ObservableCollection<TagItem>();
|
|
|
|
|
for (int j = 0; j < taglist.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
int TempLength = taglist[j].EPCstring.Length * 3 - 1;
|
|
|
|
|
EPCinfo = NewDataString.Substring(startTemp, TempLength);
|
|
|
|
|
EPCinfo = BitConverter.ToString(taglist[j].EPC).Replace("-", "");
|
|
|
|
|
items.Add(new TagItem(hexString, taglist[j].EPCstring, EPCinfo, taglist[j].RSSI.ToString(), taglist[j].Count.ToString(), Timeinfo));
|
|
|
|
|
startTemp += 16 + TempLength;
|
|
|
|
|
string year = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
EnsureFolderExists($"日志文件夹/{year}/{Text}");
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "(" + IPtext + ")" + ".txt";
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "标签(" + IPtext + ")" + ".txt";
|
|
|
|
|
EnsureTxtExists(path, Text, IPtext, Porttext);
|
|
|
|
|
writeToTxt(path, $"接收消息:{hexString}\nEPC:{taglist[j].EPCstring}\nHEX:{EPCinfo}\nRSSI:{taglist[j].RSSI.ToString()} Count:{taglist[j].Count.ToString()} Time:{Timeinfo}\n____________________________");
|
|
|
|
|
path = "";
|
|
|
|
@ -328,22 +324,17 @@ namespace SocketExample
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Timeinfo = $"{time}";//获取时间
|
|
|
|
|
|
|
|
|
|
int startTemp = 33;
|
|
|
|
|
|
|
|
|
|
//Infotext += $"({currentTime})客户端接收到EPC信息:\n{EPCASC}\n\n";
|
|
|
|
|
|
|
|
|
|
List<TagInfo> taglist = GetTagInfos(data);
|
|
|
|
|
ObservableCollection<TagItem> items = new ObservableCollection<TagItem>();
|
|
|
|
|
for (int j = 0; j < taglist.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
int TempLength = taglist[j].EPCstring.Length * 3 - 1;
|
|
|
|
|
EPCinfo = hexString.Substring(startTemp, TempLength);
|
|
|
|
|
EPCinfo = BitConverter.ToString(taglist[j].EPC).Replace("-", "");
|
|
|
|
|
items.Add(new TagItem(hexString, taglist[j].EPCstring, EPCinfo, taglist[j].RSSI.ToString(), taglist[j].Count.ToString(), Timeinfo));
|
|
|
|
|
startTemp += 16 + TempLength;
|
|
|
|
|
string year = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
EnsureFolderExists($"日志文件夹/{year}/{Text}");
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "(" + IPtext + ")" + ".txt";
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "标签(" + IPtext + ")" + ".txt";
|
|
|
|
|
EnsureTxtExists(path, Text, IPtext, Porttext);
|
|
|
|
|
writeToTxt(path, $"接收消息:{hexString}\nEPC:{taglist[j].EPCstring}\nHEX:{EPCinfo}\nRSSI:{taglist[j].RSSI.ToString()} Count:{taglist[j].Count.ToString()} Time:{Timeinfo}\n____________________________");
|
|
|
|
|
path = "";
|
|
|
|
@ -570,7 +561,7 @@ namespace SocketExample
|
|
|
|
|
TagItems = items;
|
|
|
|
|
string year = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
|
|
EnsureFolderExists($"日志文件夹/{year}/{Text}");
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "(" + IPtext + ")" + ".txt";
|
|
|
|
|
path = $"日志文件夹/{year}/{Text}/" + Text + "标签(" + IPtext + ")" + ".txt";
|
|
|
|
|
EnsureTxtExists(path, Text, IPtext, Porttext);
|
|
|
|
|
writeToTxt(path, $"接收消息:{hexString}\nEPC:{EPCASC}\nHEX:{EPCinfo}\nRSSI:{RSSIinfo} Count:{Countinfo} Time:{Timeinfo}\n____________________________");
|
|
|
|
|
path = "";
|
|
|
|
|