Commit 2f28bb24 顾剑亮

debug

1 个父辈 078036de
正在显示 87 个修改的文件 包含 1519 行增加110 行删除
此文件类型无法预览
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Asa.RFID
{
/// <summary>
/// HiStation RFID
/// </summary>
public class HiStation
{
private Thread tRecon; //重连线程
private Thread tListen; //监听网络
private Socket _client; //客户端
private bool _loop; //循环
private short _mark; //事务处理标识
private bool _dataMode; //自动发送数据模式
private bool _conOnce;
private bool _intact;
private List<byte> _receive;
//private log4net.ILog Common.log;
private readonly byte[] FRAME_HEAD = Encoding.ASCII.GetBytes("1234");
private readonly byte[] FRAME_END = new byte[] { 0x0D, 0x0A };
/// <summary>
/// 连接事件
/// </summary>
public delegate void Connected_Event(string ip);
/// <summary>
/// 已连接时触发
/// </summary>
public event Connected_Event Connected;
/// <summary>
/// 接收事件
/// </summary>
/// <param name="ip"></param>
/// <param name="uid"></param>
/// <param name="data"></param>
public delegate void Received_Event(string ip, string uid, string data);
/// <summary>
/// 接收到数据事件
/// </summary>
public event Received_Event Received;
/// <summary>
/// HiStation RFID
/// </summary>
/// <param name="logName">日志名称</param>
public HiStation(string logName = "HFReader")
{
_mark = 0;
_dataMode = false;
_conOnce = false;
_receive = new List<byte>();
if (Common.log == null)
Common.log = log4net.LogManager.GetLogger(logName);
}
/// <summary>
/// IP地址
/// </summary>
public string IP { set; get; } = "192.168.1.7";
/// <summary>
/// 是否连接
/// </summary>
public bool IsConn { get; private set; } = false;
/// <summary>
/// 打开设备
/// </summary>
public void Open()
{
_loop = true;
IsConn = false;
tRecon = new Thread(new ThreadStart(Reconn)) { Name = "Reconnect" };
tListen = new Thread(new ThreadStart(Listen)) { Name = "Listen" };
tRecon.Start();
tListen.Start();
Common.log.Info(string.Format("Open[{0}] OK", IP));
}
/// <summary>
/// 关闭设备
/// </summary>
public void Close()
{
_loop = false;
IsConn = false;
try
{
if (_client != null)
{
//TriggerMode(false);
//Thread.Sleep(50);
_client.Shutdown(SocketShutdown.Both);
_client.Close();
}
Common.log.Info(string.Format("Close[{0}] OK", IP));
}
catch (Exception ex)
{
Common.log.Error(string.Format("Close[{0}] ERROR", IP), ex);
}
finally
{
_client = null;
}
}
/// <summary>
/// 初始化(用于修改硬件参数,不用每次调用)
/// </summary>
public void Init()
{
_dataMode = false;
Write(0, 1); //设备地址1
Wait();
Write(1, 2); //波特率
Wait();
Write(2, 0); //禁止AFI
Wait();
Write(3, 20); //盘点超时时间,20*5ms
Wait();
Write(4, 1); //命令触发
Wait();
Write(5, 1); //操作模式
Wait();
Write(6, 0x20); //寄存器地址
Wait();
Write(7, 4); //寄存器数量
Wait();
Write(8, 10); //触发时间,10*5ms
Wait();
Write(9, 1); //输出格式
Wait();
Write(10, 0x1234); //数据帧枕头
Wait();
Write(11, 9); //记录保持时间,9*5ms
Wait();
}
/// <summary>
/// 触发模式
/// </summary>
/// <param name="auto"></param>
public void TriggerMode(bool auto)
{
if (auto)
{
_dataMode = false;
Write(4, 0);
Wait();
_dataMode = true;
}
else
{
_dataMode = false;
Write(4, 1);
}
}
/// <summary>
/// 监听网络
/// </summary>
private void Listen()
{
while (_loop)
{
Thread.Sleep(10);
if (!IsConn) continue;
if (_client == null) continue;
try
{
if (_client.Available > 0)
{
byte[] buff = new byte[_client.ReceiveBufferSize];
int count = _client.Receive(buff);
byte[] temp = new byte[count];
Array.Copy(buff, 0, temp, 0, count);
Common.log.Debug("Receive[" + IP + "]: " + HexBuff(temp));
_receive.AddRange(temp);
while (_receive.Count > 6)
{
if (!IsConn) break;
if (_dataMode)
DataProcess();
else
CmdProcess();
//if (_receive[0] == FRAME_HEAD[0] && _receive[1] == FRAME_HEAD[1] && _receive[2] == FRAME_HEAD[2] && _receive[3] == FRAME_HEAD[3])
// DataProcess();
//else
// CmdProcess();
}
}
}
catch (Exception ex)
{
Common.log.Error(string.Format("Listen[{0}] ERROR", IP), ex);
IsConn = false;
}
}
}
/// <summary>
/// 数据处理
/// </summary>
private void DataProcess()
{
try
{
for (int i = 0; i < _receive.Count - 4; i++)
{
if (_receive[i] == FRAME_HEAD[0] && _receive[i + 1] == FRAME_HEAD[1] &&
_receive[i + 2] == FRAME_HEAD[2] && _receive[i + 3] == FRAME_HEAD[3])
{
if (_receive.Count >= 38 + i) //每帧数据,帧头2*2字节+UID8*2字节+数据8*2字节+回车2字节
{
if (_receive[i + 36] == FRAME_END[0] && _receive[i + 37] == FRAME_END[1])
{
string uid = Encoding.ASCII.GetString(_receive.ToArray(), i + 4, 16);
string data = Encoding.ASCII.GetString(_receive.ToArray(), i + 20, 16);
Common.log.Debug(string.Format("解析完成[{0}] uid={1} data={2}", IP, uid, data));
string ID;
if (data.Length > 6)
ID = (char)Convert.ToInt32(data.Substring(2, 2), 16) + Convert.ToInt32(data.Substring(4, 2), 16).ToString();
else
ID = data;
Received?.Invoke(IP, uid, ID);
}
else
{
Common.log.Error(string.Format("解析错误[{0}]", IP));
}
_receive.RemoveRange(0, i + 38);
}
else
{
break;
}
}
}
}
catch (Exception ex)
{
Common.log.Error(string.Format("DataProcess[{0}] ERROR", IP), ex);
}
}
/// <summary>
/// 命令处理
/// </summary>
private void CmdProcess()
{
try
{
int len = 0;
byte[] temp = BitConverter.GetBytes(_mark); //事务处理标识
for (int i = 0; i < _receive.Count - 2; i++)
{
if (_receive[i] == temp[1] && _receive[i + 1] == temp[0])
{
len = 6 + i;
if (_receive.Count >= len)
{
len += _receive[i + 5];
if (_receive.Count >= len)
{
_intact = true;
_receive.RemoveRange(0, len);
}
else
{
break;
}
}
else
{
break;
}
}
}
}
catch (Exception ex)
{
Common.log.Error(string.Format("CmdProcess[{0}] ERROR", IP), ex);
}
}
/// <summary>
/// 重连
/// </summary>
private void Reconn()
{
while (_loop)
{
if (IsConn != _conOnce)
{
_conOnce = IsConn;
Connected?.Invoke(IP);
}
if (!IsConn)
{
Thread.Sleep(500);
if (!_loop) break;
IsConn = Connect();
}
Thread.Sleep(1000);
}
}
/// <summary>
/// 建立Socket连接
/// </summary>
/// <returns></returns>
private bool Connect()
{
bool rtn;
try
{
rtn = CheckIP(IP);
if (rtn)
{
//建立连接
_client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 500);
_client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
_client.Connect(System.Net.IPAddress.Parse(IP), 502);
Thread.Sleep(100); //需要等待一会才能获取连接状态
Common.log.Info("Socket[" + IP + "] Connected");
}
}
catch (Exception ex)
{
rtn = false;
Common.log.Error(string.Format("Connect[{0}] ERROR", IP), ex);
}
return rtn;
}
/// <summary>
/// 检查IP
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
private bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
Common.log.Info(string.Format("非法的IP地址[{0}]", IP));
return false;
}
//Ping服务端
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 1000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
Common.log.Info(string.Format("Ping[{0}]请求没有响应", IP));
return false;
}
return true;
}
/// <summary>
/// 16进制转换
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
/// <summary>
/// 读取保持寄存器,0x03功能码
/// </summary>
/// <param name="address"></param>
/// <param name="count"></param>
private void Read(short address, short count)
{
byte[] temp;
byte[] buffer = new byte[12];
GetMark();
temp = BitConverter.GetBytes(_mark); //事务处理标识
buffer[0] = temp[1]; //高位
buffer[1] = temp[0]; //低位
buffer[2] = 0;
buffer[3] = 0; //协议标识
buffer[4] = 0;
buffer[5] = 0x06; //后面字节数
buffer[6] = 0xFF; //主设备
buffer[7] = 0x03; //功能码
temp = BitConverter.GetBytes(address); //寄存器起始地址
buffer[8] = temp[1]; //高位
buffer[9] = temp[0]; //低位
temp = BitConverter.GetBytes(count); //寄存器个数
buffer[10] = temp[1]; //高位
buffer[11] = temp[0]; //低位
try
{
_intact = false;
Common.log.Debug("Read[" + IP + "] " + HexBuff(buffer));
if (_client != null)
_client.Send(buffer);
}
catch (Exception ex)
{
IsConn = false;
Common.log.Error(string.Format("Read[{0}] ERROR", IP), ex);
}
}
/// <summary>
/// 写入保持寄存器,0x10功能码
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
private void Write(short address, short value)
{
byte[] temp;
byte[] buffer = new byte[15];
GetMark();
temp = BitConverter.GetBytes(_mark); //事务处理标识
buffer[0] = temp[1]; //高位
buffer[1] = temp[0]; //低位
buffer[2] = 0;
buffer[3] = 0; //协议标识
buffer[4] = 0;
buffer[5] = 0x09; //后面字节数
buffer[6] = 0xFF; //主设备
buffer[7] = 0x10; //功能码
temp = BitConverter.GetBytes(address); //寄存器起始地址
buffer[8] = temp[1]; //高位
buffer[9] = temp[0]; //低位
buffer[10] = 0;
buffer[11] = 1; //寄存器个数
buffer[12] = 2; //数据长度
temp = BitConverter.GetBytes(value); //寄存器个数
buffer[13] = temp[1]; //高位
buffer[14] = temp[0]; //低位
try
{
_intact = false;
Common.log.Debug("Write[" + IP + "] " + HexBuff(buffer));
if (_client != null)
_client.Send(buffer);
}
catch (Exception ex)
{
IsConn = false;
Common.log.Error(string.Format("Write[{0}] ERROR", IP), ex);
}
}
private void GetMark()
{
if (_mark == short.MaxValue)
_mark = 1;
else
_mark++;
}
private void Wait()
{
int count = 0;
do
{
Thread.Sleep(5);
count += 5;
if (count == 2000)
break;
}
while (!_intact);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Asa.RFID
{
/// <summary>
/// 读取所有RFID
/// </summary>
public class ReadAll2 : IReadAll
{
private HiStation[] _device;
private Dictionary<string, string> _id; //RFID编号
private string _logName;
public event IReadAll.ReceivedEvent Received;
public event IReadAll.ReceiveBufferEvent ReceiveBuffer;
/// <summary>
/// 读取所有RFID
/// </summary>
/// <param name="logName">日志名称</param>
public ReadAll2(string logName = "HFReader")
{
_logName = logName;
_id = new Dictionary<string, string>();
if (Common.log == null)
Common.log = log4net.LogManager.GetLogger(logName);
}
public void Start(int port)
{
}
/// <summary>
/// 开启
/// </summary>
/// <param name="ip"></param>
public void Start(string[] ip)
{
try
{
_id.Clear();
_device = new HiStation[ip.Length];
for (int i = 0; i < _device.Length; i++)
{
_id.Add(ip[i], "000");
_device[i] = new HiStation(_logName) { IP = ip[i] };
_device[i].Connected += ReadAll_Connected;
_device[i].Received += ReadAll_Received;
_device[i].Open();
}
Common.log.Info("Server Start");
}
catch (Exception ex)
{
Common.log.Error("Start", ex);
}
}
/// <summary>
/// 停止
/// </summary>
public void Stop()
{
if (_device != null)
{
for (int i = 0; i < _device.Length; i++)
{
try
{
_device[i].TriggerMode(false);
System.Threading.Thread.Sleep(50);
_device[i].Close();
}
catch (Exception ex)
{
Common.log.Error("Stop", ex);
}
}
}
_device = null;
Common.log.Info("Server Stop");
}
/// <summary>
/// 读取ID号
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public string Read(string ip)
{
if (_id.TryGetValue(ip, out string value))
{
Common.log.Info("[" + ip + "]Read " + value);
return value;
}
else
{
Common.log.Info("[" + ip + "]Read 没有找到");
return "000";
}
}
/// <summary>
/// 清除缓存
/// </summary>
/// <param name="ip"></param>
public void Clear(string ip)
{
if (_id.ContainsKey(ip))
{
_id[ip] = "000";
Common.log.Info("[" + ip + "]Clear");
}
else
{
Common.log.Info("[" + ip + "]Clear 没有找到");
}
}
private void ReadAll_Connected(string ip)
{
int index = -1;
foreach (var ss in _id.Keys)
{
index++;
if (ss == ip)
break;
}
if (index != -1)
_device[index].TriggerMode(true);
}
private void ReadAll_Received(string ip, string uid, string data)
{
Common.log.Debug("Received IP=" + ip + " uid=" + uid + " data=" + data);
if (_id[ip] == data)
{
}
else
{
_id[ip] = data;
Received?.Invoke(ip, data);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Asa.RFID
{
/// <summary>
/// 读取所有RFID
/// </summary>
public class ReadAll : IReadAll
{
///// <summary>
///// 接收数据包事件
///// </summary>
///// <param name="ip"></param>
///// <param name="id"></param>
//public delegate void ReceivedEvent(string ip, string id);
///// <summary>
///// 接收数据包
///// </summary>
//public event ReceivedEvent Received;
///// <summary>
///// 接收网卡缓存事件
///// </summary>
///// <param name="ip"></param>
///// <param name="buffer"></param>
//public delegate void ReceiveBufferEvent(string ip, byte[] buffer);
///// <summary>
///// 接收网卡缓存
///// </summary>
//public event ReceiveBufferEvent ReceiveBuffer;
private bool _loop;
private Socket _server; //服务端
private List<Client> _client; //所有客户端
private Thread tListenClient; //监听客户端连接
private Dictionary<string, string> _id; //RFID编号
private log4net.ILog log = null;
private const int CLIENT_SLEEP = 10;
public event IReadAll.ReceivedEvent Received;
public event IReadAll.ReceiveBufferEvent ReceiveBuffer;
/// <summary>
/// 读取所有RFID
/// </summary>
/// <param name="logName">日志名称</param>
public ReadAll(string logName)
{
_id = new Dictionary<string, string>();
if (log == null)
log = log4net.LogManager.GetLogger(logName);
}
/// <summary>
/// 开启
/// </summary>
/// <param name="port">RFID设备的端口</param>
public void Start(int port = 13000)
{
try
{
IPEndPoint localEP = new IPEndPoint(IPAddress.Any, port);
_server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_server.Bind(localEP);
_server.Listen(100);
_loop = true;
_client = new List<Client>();
tListenClient = new Thread(new ThreadStart(ListenClient));
tListenClient.Start();
log.Info("Server Start");
}
catch (Exception ex)
{
log.Error("Start", ex);
}
}
public void Start(string[] ip)
{
}
/// <summary>
/// 停止
/// </summary>
public void Stop()
{
_loop = false;
for (int i = 0; i < _client.Count; i++)
ClientClose(i);
try
{
_id.Clear();
_server.Close();
_client = null;
log.Info("Server Stop");
}
catch (Exception ex)
{
log.Error("Stop", ex);
}
}
/// <summary>
/// 读取ID号
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public string Read(string ip)
{
if (_id.TryGetValue(ip, out string value))
{
log.Info("Read " + ip + " -> " + value);
return value;
}
else
{
log.Info("Read " + ip + " not exist, return 000");
return "000";
}
}
/// <summary>
/// 清除缓存
/// </summary>
/// <param name="ip"></param>
public void Clear(string ip)
{
if (_id.ContainsKey(ip))
{
_id[ip] = "000";
log.Info("Clear " + ip);
}
else
{
log.Info("Clear " + ip + " not exist");
}
}
private void ClientClose(int idx)
{
try
{
_client[idx].Loop = false;
_client[idx].IsConn = false;
_client[idx].Socket.Close();
log.Info(_client[idx].IP + " Close");
}
catch (Exception ex)
{
log.Error(_client[idx].IP + " ClientClose", ex);
}
}
private void ListenClient()
{
while (_loop)
{
try
{
Socket socket = _server.Accept(); //这边会暂停,不需要sleep
IPEndPoint ep = (IPEndPoint)socket.RemoteEndPoint;
Thread listen = new Thread(new ParameterizedThreadStart(ListenNet));
string ip = ep.Address.ToString();
//新的客户端
Client client = new Client
{
IP = ip,
Loop = true,
IsConn = true,
Socket = socket,
ListenNet = listen,
};
//重连后关闭旧连接
int idx = _client.FindIndex(s => s.IP.Equals(ip));
if (idx > -1)
{
_id[_client[idx].IP] = "000";
_client[idx].IsConn = false;
_client[idx].Loop = false;
_client[idx].Socket.Close();
log.Info(_client[idx].IP + " 重连,删除重复。");
_client.RemoveAt(idx);
}
//添加到数组
if (!_id.ContainsKey(client.IP))
_id.Add(client.IP, "000");
_client.Add(client);
log.Info(client.IP + " 连接");
listen.Start(_client.Count - 1);
}
catch (SocketException)
{
//关闭连接,退出阻塞Accept
log.Error("Socket Close");
}
catch (Exception ex)
{
log.Error("ListenClient", ex);
}
}
}
private void ListenNet(object obj)
{
const int LENGTH = 8; //实际使用8字节
Client client = _client[(int)obj];
List<byte> receive = new List<byte>();
byte[] buff = new byte[client.Socket.ReceiveBufferSize];
while (client.Loop)
{
Thread.Sleep(CLIENT_SLEEP);
try
{
if (!client.Loop) break;
if (client.Socket.Available > 0)
{
int count = client.Socket.Receive(buff);
byte[] temp = new byte[count];
Array.Copy(buff, 0, temp, 0, count);
//16进制字符串转字节数组
string s = Encoding.ASCII.GetString(temp);
s = s.Replace("\r", "");
s = s.Replace("\n", "");
log.Debug("ListenNet " + s);
temp = new byte[s.Length / 2];
for (int i = 0; i < temp.Length; i++)
{
temp[i] = Convert.ToByte(s.Substring(i * 2, 2), 16);
}
receive.AddRange(temp);
log.Debug("Receive[" + client.IP + "]: " + HexBuff(temp));
//Task.Run(() => ReceiveBuffer?.Invoke(client.IP, temp));
do
{
//查找包头
int idx = receive.FindIndex(n => n == 0x5A);
if (idx == -1)
{
log.Debug("清除缓存[" + client.IP + "]: " + HexBuff(receive));
receive.Clear();
break;
}
//长度不够,半个包
int len = idx + LENGTH;
if (len > receive.Count) break;
//查找包尾
if (receive[len - 3] == 0x4A) //一个系统的0,两个校验位
{
byte[] arr = new byte[LENGTH];
receive.CopyTo(idx, arr, 0, 4);
receive.CopyTo(idx + 4, arr, 4, 4);
log.Info("Packet[" + client.IP + "]: " + HexBuff(arr));
TriggerEvent(client.IP, arr);
//2020年6月5日
//Task.Run(() => TriggerEvent(client.IP, arr));
}
else
{
log.Debug("没有包尾[" + client.IP + "]: " + HexBuff(receive));
}
receive.RemoveRange(0, len);
} while (true);
}
}
catch (Exception ex)
{
log.Error(client.IP + " ListenNet", ex);
}
}
}
private void TriggerEvent(string ip, byte[] buff)
{
string s;
if (buff[1] == 0)
{
s = "000";
log.Info(ip + " byte 0");
}
else
{
s = (char)buff[1] + buff[2].ToString();
}
//添加到缓存
if (_id[ip].Equals(s))
{
log.Debug("相同ID[" + ip + "]: " + s);
}
else
{
_id[ip] = s;
log.Info("Trigger[" + ip + "]: " + s);
Task.Run(() => Received?.Invoke(ip, s));
}
}
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
private string HexBuff(List<byte> buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Count; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
private class Client
{
public bool Loop;
public string IP;
public bool IsConn;
public Socket Socket;
public Thread ListenNet;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Asa.RFID
{
public static class Common
{
public static log4net.ILog log = null;
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("RFID-HiStation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RFID-HiStation")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("4d5996f8-7206-480d-834a-be1db5fb05b2")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4D5996F8-7206-480D-834A-BE1DB5FB05B2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa.RFID</RootNamespace>
<AssemblyName>Asa.RFID.HiStation</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Class2.cs" />
<Compile Include="Class3.cs" />
<Compile Include="Common.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RFID_Interface\RFID_Interface.csproj">
<Project>{e7a36c72-093b-428e-a4e3-4739ee0bf4cc}</Project>
<Name>RFID_Interface</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
此文件类型无法预览
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\bin\Debug\log4net.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.pdb
D:\Neotel\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.dll
D:\Neotel\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.pdb
D:\Neotel\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.dll
D:\Neotel\RFID\RFID-HiStation\bin\Debug\log4net.dll
D:\Neotel\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.pdb
D:\Neotel\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csprojAssemblyReference.cache
D:\Neotel\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CoreCompileInputs.cache
D:\Neotel\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CopyComplete
D:\Neotel\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.dll
D:\Neotel\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.pdb
C:\Neotel\Program\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.dll
C:\Neotel\Program\RFID\RFID-HiStation\bin\Debug\Asa.RFID.HiStation.pdb
C:\Neotel\Program\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.dll
C:\Neotel\Program\RFID\RFID-HiStation\bin\Debug\Asa.RFID.IReadAll.pdb
C:\Neotel\Program\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csprojAssemblyReference.cache
C:\Neotel\Program\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CoreCompileInputs.cache
C:\Neotel\Program\RFID\RFID-HiStation\obj\Debug\RFID-HiStation.csproj.CopyComplete
C:\Neotel\Program\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.dll
C:\Neotel\Program\RFID\RFID-HiStation\obj\Debug\Asa.RFID.HiStation.pdb
......@@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFID_HFReader", "RFID_HFRea
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFID_HFReader_Debug", "RFID_HFReader_Debug\RFID_HFReader_Debug.csproj", "{5C55663B-DBDA-490B-A80F-0ABB173AEF88}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFID_Interface", "RFID_Interface\RFID_Interface.csproj", "{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RFID-HiStation", "RFID-HiStation\RFID-HiStation.csproj", "{4D5996F8-7206-480D-834A-BE1DB5FB05B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -51,6 +55,22 @@ Global
{5C55663B-DBDA-490B-A80F-0ABB173AEF88}.Release|Any CPU.Build.0 = Release|Any CPU
{5C55663B-DBDA-490B-A80F-0ABB173AEF88}.Release|x86.ActiveCfg = Release|x86
{5C55663B-DBDA-490B-A80F-0ABB173AEF88}.Release|x86.Build.0 = Release|x86
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Debug|x86.ActiveCfg = Debug|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Debug|x86.Build.0 = Debug|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Release|Any CPU.Build.0 = Release|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Release|x86.ActiveCfg = Release|Any CPU
{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}.Release|x86.Build.0 = Release|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Debug|x86.Build.0 = Debug|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Release|Any CPU.Build.0 = Release|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Release|x86.ActiveCfg = Release|Any CPU
{4D5996F8-7206-480D-834A-BE1DB5FB05B2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -12,28 +12,28 @@ namespace Asa.RFID
/// <summary>
/// 读取所有RFID
/// </summary>
public class ReadAll
public class ReadAll1 : IReadAll
{
/// <summary>
/// 接收数据包事件
/// </summary>
/// <param name="ip"></param>
/// <param name="id"></param>
public delegate void ReceivedEvent(string ip, string id);
/// <summary>
/// 接收数据包
/// </summary>
public event ReceivedEvent Received;
/// <summary>
/// 接收网卡缓存事件
/// </summary>
/// <param name="ip"></param>
/// <param name="buffer"></param>
public delegate void ReceiveBufferEvent(string ip, byte[] buffer);
/// <summary>
/// 接收网卡缓存
/// </summary>
public event ReceiveBufferEvent ReceiveBuffer;
///// <summary>
///// 接收数据包事件
///// </summary>
///// <param name="ip"></param>
///// <param name="id"></param>
//public delegate void ReceivedEvent(string ip, string id);
///// <summary>
///// 接收数据包
///// </summary>
//public event ReceivedEvent Received;
///// <summary>
///// 接收网卡缓存事件
///// </summary>
///// <param name="ip"></param>
///// <param name="buffer"></param>
//public delegate void ReceiveBufferEvent(string ip, byte[] buffer);
///// <summary>
///// 接收网卡缓存
///// </summary>
//public event ReceiveBufferEvent ReceiveBuffer;
......@@ -42,22 +42,25 @@ namespace Asa.RFID
private List<Client> _client; //所有客户端
private Thread tListenClient; //监听客户端连接
private Dictionary<string, string> _id; //RFID编号
private log4net.ILog log;
private log4net.ILog log = null;
private const int CLIENT_SLEEP = 10;
public event IReadAll.ReceivedEvent Received;
public event IReadAll.ReceiveBufferEvent ReceiveBuffer;
/// <summary>
/// 读取所有RFID
/// </summary>
/// <param name="logName">日志名称</param>
public ReadAll(string logName)
public ReadAll1(string logName)
{
_id = new Dictionary<string, string>();
log = log4net.LogManager.GetLogger(logName);
if (log == null)
log = log4net.LogManager.GetLogger(logName);
}
/// <summary>
/// 开启
/// </summary>
......@@ -84,6 +87,11 @@ namespace Asa.RFID
}
}
public void Start(string[] ip)
{
}
/// <summary>
/// 停止
/// </summary>
......@@ -145,6 +153,12 @@ namespace Asa.RFID
private void ClientClose(int idx)
{
try
......@@ -230,8 +244,9 @@ namespace Asa.RFID
int count = client.Socket.Receive(buff);
byte[] temp = new byte[count];
Array.Copy(buff, 0, temp, 0, count);
receive.AddRange(temp);
log.Debug(" Receive[" + client.IP + "]: " + HexBuff(temp));
log.Debug("Receive[" + client.IP + "]: " + HexBuff(temp));
Task.Run(() => ReceiveBuffer?.Invoke(client.IP, temp));
do
......@@ -240,8 +255,8 @@ namespace Asa.RFID
int idx = receive.FindIndex(n => n == 0x5A);
if (idx == -1)
{
log.Debug("清除缓存[" + client.IP + "]: " + HexBuff(receive));
receive.Clear();
log.Debug(client.IP + " 整个缓存没有找到包头0x5A,清除缓存。");
break;
}
......@@ -256,11 +271,16 @@ namespace Asa.RFID
receive.CopyTo(idx, arr, 0, 4);
receive.CopyTo(idx + 5, arr, 4, 4);
log.Info("Packet[" + client.IP + "]: " + HexBuff(arr));
Task.Run(() => TriggerEvent(client.IP, arr));
TriggerEvent(client.IP, arr);
//2020年6月5日
//Task.Run(() => TriggerEvent(client.IP, arr));
}
else
{
log.Debug(client.IP + " 指定字节没有包尾," + HexBuff(receive, idx, 9));
log.Debug("没有包尾[" + client.IP + "]: " + HexBuff(receive));
}
receive.RemoveRange(0, len);
} while (true);
......@@ -287,12 +307,18 @@ namespace Asa.RFID
s = (char)buff[1] + buff[2].ToString();
}
if (!_id[ip].Equals(s))
//添加到缓存
if (_id[ip].Equals(s))
{
log.Debug("相同ID[" + ip + "]: " + s);
}
else
{
_id[ip] = s;
log.Info("Trigger " + ip + " -> " + s);
Received?.Invoke(ip, s);
log.Info("Trigger[" + ip + "]: " + s);
Task.Run(() => Received?.Invoke(ip, s));
}
}
private string HexBuff(byte[] buff)
......@@ -305,13 +331,13 @@ namespace Asa.RFID
return s;
}
private string HexBuff(List<byte> buff, int start, int len)
private string HexBuff(List<byte> buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < len; i++)
s += buff[i + start].ToString("X2") + " ";
for (int i = 0; i < buff.Count; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
......@@ -325,7 +351,5 @@ namespace Asa.RFID
}
}
}
......@@ -8,7 +8,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa.RFID</RootNamespace>
<AssemblyName>Asa.RFID</AssemblyName>
<AssemblyName>Asa.RFID.HFRead</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
......@@ -21,7 +21,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Asa.RFID.xml</DocumentationFile>
<DocumentationFile>bin\Debug\Asa.RFID.HFRead.xml</DocumentationFile>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
......@@ -45,12 +47,18 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ReadAll.cs" />
<Compile Include="HFReader1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RFID_Interface\RFID_Interface.csproj">
<Project>{e7a36c72-093b-428e-a4e3-4739ee0bf4cc}</Project>
<Name>RFID_Interface</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetFileName)"
copy "$(TargetDir)$(TargetName).xml" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetName).xml"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.RFID</name>
<name>Asa.RFID.HFRead</name>
</assembly>
<members>
<member name="T:Asa.RFID.ReadAll">
<member name="T:Asa.RFID.ReadAll1">
<summary>
读取所有RFID
</summary>
</member>
<member name="T:Asa.RFID.ReadAll.ReceivedEvent">
<summary>
接收数据包事件
</summary>
<param name="ip"></param>
<param name="id"></param>
</member>
<member name="E:Asa.RFID.ReadAll.Received">
<summary>
接收数据包
</summary>
</member>
<member name="T:Asa.RFID.ReadAll.ReceiveBufferEvent">
<summary>
接收网卡缓存事件
</summary>
<param name="ip"></param>
<param name="buffer"></param>
</member>
<member name="E:Asa.RFID.ReadAll.ReceiveBuffer">
<summary>
接收网卡缓存
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.#ctor(System.String)">
<member name="M:Asa.RFID.ReadAll1.#ctor(System.String)">
<summary>
读取所有RFID
</summary>
<param name="logName">日志名称</param>
</member>
<member name="M:Asa.RFID.ReadAll.Start(System.Int32)">
<member name="M:Asa.RFID.ReadAll1.Start(System.Int32)">
<summary>
开启
</summary>
<param name="port">RFID设备的端口</param>
</member>
<member name="M:Asa.RFID.ReadAll.Stop">
<member name="M:Asa.RFID.ReadAll1.Stop">
<summary>
停止
</summary>
</member>
<member name="M:Asa.RFID.ReadAll.Read(System.String)">
<member name="M:Asa.RFID.ReadAll1.Read(System.String)">
<summary>
读取ID号
</summary>
<param name="ip"></param>
<returns></returns>
</member>
<member name="M:Asa.RFID.ReadAll.Clear(System.String)">
<member name="M:Asa.RFID.ReadAll1.Clear(System.String)">
<summary>
清除缓存
</summary>
......
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
此文件类型无法预览
此文件类型无法预览
69c039e606bb9165e14128328c07bf92dd159bcc
3bf2123f61e462f98293a71c3705cf62ab1802c0
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\RFID.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\Asa.RFID.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\Asa.RFID.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\log4net.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\RFID.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\RFID.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.HFRead.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.HFRead.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.HFRead.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.IReadAll.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\bin\Debug\Asa.RFID.IReadAll.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\Asa.RFID.HFRead.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID\obj\Debug\Asa.RFID.HFRead.pdb
......@@ -12,7 +12,7 @@ namespace RFID_Debug
{
public partial class Form1 : Form
{
private Asa.RFID.ReadAll read;
private Asa.RFID.HFReader1 read;
public Form1()
{
......@@ -31,7 +31,7 @@ namespace RFID_Debug
private void Form1_Load(object sender, EventArgs e)
{
read = new Asa.RFID.ReadAll("RollingLogFileAppender");
read = new Asa.RFID.HFReader1("RollingLogFileAppender");
//read.Received += Read_Received;
read.ReceiveBuffer += Read_ReceiveBuffer;
}
......
......@@ -23,6 +23,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -32,6 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
......@@ -92,6 +94,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetFileName)"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
dae59b7058d208e5ffe3231183ee4d194d58f1db
59165c7d8d04c21b0667232e63d5cf2ca22cf77c
......@@ -12,4 +12,3 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Debug\obj\Debug\RFID_
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Debug\bin\Debug\Asa.RFID.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Debug\bin\Debug\Asa.RFID.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Debug\bin\Debug\Asa.RFID.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Debug\bin\Debug\log4net.dll
......@@ -112,8 +112,8 @@ namespace Asa.RFID
if (autoScan)
AutoScanRead();
else
FindIDMode();
//else
// FindIDMode();
}
/// <summary>
......
......@@ -22,6 +22,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Asa.RFID.HFReader.xml</DocumentationFile>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
......@@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
......@@ -38,7 +40,7 @@
<DocumentationFile>bin\Debug\Asa.RFID.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
......@@ -48,7 +50,7 @@
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
......@@ -75,7 +77,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetFileName)"
copy "$(TargetDir)$(TargetName).xml" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetName).xml"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
41fe085d0abc68030e109433fbfa5b3ef359a6da
a40ac34a172bfd483e269dfe9e4a4ebea403c9dc
......@@ -9,7 +9,6 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_old\obj\Debug\Asa.RFI
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\bin\Debug\Asa.RFID.HFReader.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\bin\Debug\Asa.RFID.HFReader.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\bin\Debug\Asa.RFID.HFReader.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\bin\Debug\HFReader9CSharp.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\obj\Debug\RFID_HFReader.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\obj\Debug\RFID_HFReader.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader\obj\Debug\Asa.RFID.HFReader.dll
......
......@@ -38,6 +38,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -47,6 +48,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
......@@ -54,7 +56,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
......@@ -64,12 +66,15 @@
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
......@@ -146,6 +151,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "D:\OneDrive - 上海挚锦科技有限公司\DLL\RFID\$(TargetFileName)"</PostBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
\ No newline at end of file
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
b644603fc31ffca78a5b7897e8dfe94eeb64a158
3912e82c529aa47bcfcd4a34281eddb72e8ecf2f
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.FrmMain.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.Properties.Resources.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.UserControl1.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csproj.GenerateResource.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\RFID_HFReader_Debug.exe.config
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\RFID_HFReader_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\RFID_HFReader_Debug.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\Asa.RFID.HFReader.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\log4net.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\HFReader9CSharp.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\Asa.RFID.HFReader.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\bin\Debug\Asa.RFID.HFReader.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csprojAssemblyReference.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.FrmMain.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.Properties.Resources.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_Debug.UserControl1.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csproj.GenerateResource.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_HFReader_Debug\obj\Debug\RFID_HFReader_Debug.pdb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Asa.RFID
{
public interface IReadAll
{
public delegate void ReceivedEvent(string ip, string id);
public event ReceivedEvent Received;
public delegate void ReceiveBufferEvent(string ip, byte[] buffer);
public event ReceiveBufferEvent ReceiveBuffer;
public void Start(int port);
public void Start(string[] ip);
public void Stop();
public string Read(string ip);
public void Clear(string ip);
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("RFID_Interface")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RFID_Interface")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e7a36c72-093b-428e-a4e3-4739ee0bf4cc")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E7A36C72-093B-428E-A4E3-4739EE0BF4CC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa.RFID</RootNamespace>
<AssemblyName>Asa.RFID.IReadAll</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Interface.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Interface\obj\Debug\RFID_Interface.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.pdb
D:\Neotel\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.dll
D:\Neotel\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.pdb
D:\Neotel\RFID\RFID_Interface\obj\Debug\RFID_Interface.csprojAssemblyReference.cache
D:\Neotel\RFID\RFID_Interface\obj\Debug\RFID_Interface.csproj.CoreCompileInputs.cache
D:\Neotel\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.dll
D:\Neotel\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.pdb
C:\Neotel\Program\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.dll
C:\Neotel\Program\RFID\RFID_Interface\bin\Debug\Asa.RFID.IReadAll.pdb
C:\Neotel\Program\RFID\RFID_Interface\obj\Debug\RFID_Interface.csprojAssemblyReference.cache
C:\Neotel\Program\RFID\RFID_Interface\obj\Debug\RFID_Interface.csproj.CoreCompileInputs.cache
C:\Neotel\Program\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.dll
C:\Neotel\Program\RFID\RFID_Interface\obj\Debug\Asa.RFID.IReadAll.pdb
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!