|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO.Ports;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Philisense.Congress.Control.TICheckController
|
|
|
|
|
{
|
|
|
|
|
internal class TICheckCardOperator
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
byte[] startWriteBytes;
|
|
|
|
|
private byte[] heartBeatWriteBytes;
|
|
|
|
|
private byte[] beepWriteBytes;
|
|
|
|
|
private byte[] redToGreenWriteBytes;
|
|
|
|
|
private byte[] greenToRedWriteBytes;
|
|
|
|
|
private byte[] readBytes;
|
|
|
|
|
|
|
|
|
|
public TICheckCardOperator()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
InitWriteBytes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Start(Action<IDictionary<string, object>> parameterMap, Action<IDictionary<string, object>> resultmap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop(Action<IDictionary<string, object>> resultmap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Record(Action<IDictionary<string, object>> parameterMap, Action<IDictionary<string, object>> resultmap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init(IDictionary<string, object> parameterMap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SerialPort OpenPort(IDictionary<string, object> parameterMap)
|
|
|
|
|
{
|
|
|
|
|
// 打开串口逻辑
|
|
|
|
|
SerialPort serialPort = new SerialPort();
|
|
|
|
|
// 设置串口参数
|
|
|
|
|
// ...
|
|
|
|
|
return serialPort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//public void Operate(SerialPort serialPort, IList<byte> recvBuf, Channel<ResultStruct> c, ref ResultStruct res)
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
public void PortClose(SerialPort serialPort)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitWriteBytes()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SearchForSerialPortNo(Action<IDictionary<string, object>> resultmap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SearchForDevice(Action<IDictionary<string, object>> resultmap)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct ResultStruct
|
|
|
|
|
{
|
|
|
|
|
public string cardId;
|
|
|
|
|
public int state; // 1正常发送心跳包,2发送蜂鸣,3发送红变绿,4发送绿变红
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|