Beispiel #1
0
 public void SendData()
 {
     try
     {
         if (com != null /*&& com.IsConnected()*/)
         {
             //byte[] sysc = new byte[] { 0xFF, 0xFE, 0xFD, 0xFC };
             //byte[] data = new byte[] { 0x01 };
             // ICommandBase comm = new SetRawDataMode(0);
             byte[] datasend = { 0xA5 };
             com.SendCommand(datasend);
         }
         else
         {
             MessageBox.Show("Disconnected");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 private void btnTestSend_Click(object sender, EventArgs e)
 {
     try
     {
         if (com != null && com.IsConnected())
         {
             //byte[] sysc = new byte[] { 0xFF, 0xFE, 0xFD, 0xFC };
             //byte[] data = new byte[] { 0x01 };
             ICommandBase comm     = new GetRawDataMode(1);
             byte[]       datasend = comm.Serialize();
             com.SendCommand(datasend);
             //com.OnComReaderReceived += new ComReaderReceived(this._port_DataReceived);
         }
         else
         {
             MessageBox.Show("Disconnected");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }