Ejemplo n.º 1
0
 private void ResendRead_1(object obj)
 {
     Debug.WriteLine(System.Threading.Thread.CurrentThread.Name + "休息1秒!");
     System.Threading.Thread.Sleep(1000);
     try
     {
         MyMessage_1 myMsg = obj as MyMessage_1;
         if (null != myMsg)
         {
             SendHex(myMsg.ID, myMsg.MSG);
         }
     }
     catch (Exception exp) { Debug.WriteLine(exp.Message); }
     finally { s_isFirstSend = true; }
 }
Ejemplo n.º 2
0
 public bool SendHexTwice(uint id, byte[] bts)
 {
     m_timer.Interval = 5000;
     SendHex(id, bts);
     if (s_isFirstSend_1)
     {
         MyMessage_1 myMsg = new MyMessage_1()
         {
             ID = id, MSG = bts
         };
         s_isFirstSend = false;
         Thread t = new Thread(new ParameterizedThreadStart(ResendRead_1))
         {
             Name         = "重新发送读取线程",
             IsBackground = true
         };
         t.Start(myMsg);
     }
     //string msg = System.Text.Encoding.Default.GetString(bts);
     //Debug.WriteLine("GPRS发送数据:" + msg);
     //InvokeMessage(msg, "发送");
     return(DTUdll.Instance.SendHex(id, bts));
 }