diff --git a/ProductionSystem/Untils/MFSerialInfo.cs b/ProductionSystem/Untils/MFSerialInfo.cs index 2169746..8254b57 100644 --- a/ProductionSystem/Untils/MFSerialInfo.cs +++ b/ProductionSystem/Untils/MFSerialInfo.cs @@ -1,25 +1,69 @@ using System; +using System.Collections.Generic; +using System.Threading; using NewLife.Log; using NewLife.Threading; namespace ProductionSystem.Untils { - public class MFSerialInfo: IDisposable + public class MfSerialInfo: IDisposable { TimerX _timer; private MFSerial _mfser; + + public byte Entrance { get; set; } + public byte Export { get; set; } public Action MsgFunc { get; set; } - public MFSerialInfo(MFSerial mfser) + public MfSerialInfo() { - _mfser = mfser; - _timer = new TimerX(DoBackup, mfser, 200, 500) { Async = true }; + _mfser =new MFSerial(); + _timer = new TimerX(DoBackup, _mfser, 200, 500) { Async = true }; + + + } + + private string _data; + + public MfSerialInfo (byte entrance, byte export):this() + { + this.Entrance = entrance; + this.Export = export; + + _mfser.SetLinSet(); + // + _mfser.SetId(new List() + { + entrance, + export + }); + + } + + /// + /// 发送几次数据 + /// + /// + /// + public void SendMsg(string data,int num=3) + { + _mfser.SendMsg(Entrance,data); + Thread.Sleep(500); + for (int i = 0; i < num; i++) + { + _mfser.SendLinMasterSend(Export); + Thread.Sleep(100); + } + + } + + public void Dispose() {