示例#1
0
 void CloseAll()
 {
     flgReceiving  = false;
     flgPause      = false;
     btnPause.Text = text.Pause;
     lbMac.Items.Clear();
     BleDevice.DeviceList.Clear();
     if (serial_port_dongle != null)
     {
         if (curDevice != null)
         {
             serial_port_dongle.SendData(BLEDongle.PackageData((byte)BLEDongle.CMD.Disconnect, curDevice.mac));
         }
         serial_port_dongle.StopReceiveData();
         serial_port_dongle.Close();
     }
 }
示例#2
0
 private void lbMac_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (lbMac.SelectedItem != null)
     {
         if (curDevice != null)
         {
             PaintXYZ.Abort();
             serial_port_dongle.SendData(BLEDongle.PackageData((byte)BLEDongle.CMD.Disconnect, curDevice.mac));
             Thread.Sleep(100);
             StartScan();
             Thread.Sleep(100);
         }
         //lbMac.Enabled = false;
         //btnScan.Enabled = false;
         curDevice = BleDevice.DeviceList[lbMac.SelectedItem.ToString()];
         serial_port_dongle.SendData(BLEDongle.PackageData((byte)BLEDongle.CMD.Connect, curDevice.mac));
         btnScan.Text = text.Scan;
         flgReceiving = true;
         //PaintXYZ = new Thread(PaintToGrapgh) { IsBackground = true };
         //PaintXYZ.Start();
     }
 }
示例#3
0
 void StopScan()
 {
     serial_port_dongle.SendData(BLEDongle.PackageData((byte)BLEDongle.CMD.StopScan, null));
     btnScan.Text = text.Scan;
 }