Exemplo n.º 1
0
 public Au400Bo(ComPortSetting set, bool isContinueTransfer)
     : base(set)
 {
     _isContinueTransfer = isContinueTransfer;
     portInstance.DataReceived += portInstance_DataReceived;
     _auItems = new List<AU400Dto>();
 }
 public ComHelperBase(ComPortSetting set)
 {
     _setting = set;
     portInstance = new SerialPort();
     portInstance.BaudRate = _setting.BaudRate;
     portInstance.PortName = _setting.PortName;
     portInstance.DataBits = _setting.DataBits;
     portInstance.StopBits =  _setting.StopBits;
     portInstance.Parity = _setting.Parity;
     portInstance.DtrEnable = _setting.Dtr;
     portInstance.RtsEnable = _setting.Rts;
     timer = new System.Timers.Timer(_setting.ReadTimeout);
 }
Exemplo n.º 3
0
 public bool InsertPort(ComPortSetting port)
 {
     db.tbPorts.AddtbPortsRow(port.PortName, port.DataBits, port.BaudRate, (int)port.StopBits, port.Parity.ToString(), port.Rts);
     try
     {
         db.AcceptChanges();
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Exemplo n.º 4
0
        public void TestMethod1()
        {
            //setting
                var setting = new ComPortSetting();
            var roche = new RocheE4111Bo(setting);
            roche._data = @"
            06
            1H|\^&|
            ||cobas-
            e411^1||
            |||host|
            RSUPL^BA
            TCH|P|1
            P|1
            O|1|
            ngoc 14|
            151^0001
            ^2^^S1^S
            C|^^^125
            ^1\^^^10
            ^1\^^^50
            ^1|R||20
            15091817
            0041||||
            N||||1||
            |||||201
            50918172
            428|||F
            R|1|^^^1
            25/1/not
            |13.87|p
            mol/l||N
            ||F||bms
            erv|||E1

            R|2|^^^
            10/1/not
            |1.86|uI
            U/ml||N|
            |F51

            ";
            roche.ParsingData();
        }
Exemplo n.º 5
0
 public KX21IBo(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _kxItems = new List<KX21iDto>();
 }
Exemplo n.º 6
0
 private void btnGet_Click(object sender, EventArgs e)
 {
     try
     {
         //setting
         var setting = new ComPortSetting()
         {
             BaudRate = int.Parse(cbBaudRate.Text),
             DataBits = int.Parse(cbDataBits.Text),
             StopBits = (StopBits)Enum.Parse(typeof(StopBits), cbStopBits.Text),
             Parity = (Parity)Enum.Parse(typeof(Parity), cbParity.Text),
             PortName = cbPortName.Text,
             ReadTimeout = 1000,
             Rts = chkRts.Checked,
             Dtr = chkDtr.Checked
         };
         // khai báo và mở cổng
         au = new RocheE4111Bo(setting);
         au.Open();
         Log("Mở cổng thành công");
         btnGet.Enabled = false;
         // khai báo sự kiện nhận được dữ liệu thành công
         au.ReceiveDataComplelted += au_ReceiveDataComplelted;
     }
     catch (Exception ex)
     {
         Log("Mở cổng thất bại");
     }
 }
Exemplo n.º 7
0
 public Celdyn3200(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _cendynItems = new List<Celdyn3200Dto>();
 }
Exemplo n.º 8
0
 public RocheE4111Bo(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _auItems = new List<Roche4111Dto>();
 }
Exemplo n.º 9
0
 public SiemensBo(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _auItems = new List<SiemensDto>();
 }
Exemplo n.º 10
0
 public Au400Bo(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _auItems = new List<AU400Dto>();
 }
Exemplo n.º 11
0
        public bool UpdatePort(ComPortSetting port)
        {
            var tmp = db.tbPorts.FindByPortName(port.PortName);

            tmp.BaudRate = port.BaudRate;
            tmp.DataBit = port.DataBits;
            tmp.Dts = port.Rts;
            tmp.Parity = port.Parity.ToString();
            tmp.StopBit = int.Parse(port.StopBits.ToString());
            try
            {
                db.AcceptChanges();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            var rgx = new Regex(@"^[0-9]*$");
            var check = rgx.IsMatch("1|");
            Console.WriteLine(check);
            //setting
            var setting = new ComPortSetting
            {
                BaudRate = 9600,
                DataBits = 8,
                Parity = Parity.None,
                PortName = "Com1",
                StopBits = StopBits.One,
                ReadTimeout = 1000
            };
            var roche = new RocheE4111Bo(setting);
            roche._data = @"1H|\^&|
            ||cobas-
            e411^1||
            |||host|
            RSUPL^BA
            TCH|P|1
            P|1
            O|1|
            phuc 12|
            129^0001
            ^1^^S1^S
            C|^^^125
            ^1\^^^10
            ^1\^^^50
            ^1|R||20
            15091010
            5229||||
            N||||1||
            |||||201
            50910111
            605|||F
            R|1|^^^1
            25/1/not
            |15.18|p
            mol/l||N
            ||F||bms
            erv|||E1

            R|2|^^^
            10/1/not
            |4.93|uI
            U/ml||H|
            |F3F

            06
            2||bmse
            rv|||E1
            C|1|I|40
            |I
            R|3|^
            ^^50/1/n
            ot|2.01|
            nmol/l||
            N||F||bm
            serv|||E
            1
            L|1|N
            D2

            ";
            roche.ParsingData();
        }
Exemplo n.º 13
0
 public Urisys1100Bo(ComPortSetting set)
     : base(set)
 {
     portInstance.DataReceived += portInstance_DataReceived;
     _urisys1100Items = new List<Urisys1100Dto>();
 }