示例#1
0
 public void Connect(bool receiveHexData)
 {
     if (!ubwDeviceConnector.IsBusy)
     {
         deviceConnectionHelper.receiveHexData = receiveHexData;
         ubwDeviceConnector.Run();
     }
 }
示例#2
0
    public void ReceiveData()
    {
        if (ubwByteDataReceiver != null && ubwByteDataReceiver.IsBusy)
        {
            ubwByteDataReceiver.Abort();
        }

        ubwDataReceiver.Run();
    }
示例#3
0
 public void SendAndReceiveData()
 {
     if (!ubwDataSenderAndReceiver.IsBusy)
     {
         Debug.Log("SendData");
         dataSenderAndReceiverHelper.dataToSend = txtInput.text;
         ubwDataSenderAndReceiver.Run();
     }
 }
示例#4
0
 /**
  * Permet d'initier la recherche
  * @param    caller  Le thread courant
  */
 public void FindDevices(MonoBehaviour caller)
 {
     if (!isDevicesSearching)
     {
         ubw = new UnityBackgroundWorker(caller, FindDevicesBegin, FindDevicesProgress, FindDevicesDone, dfh);
         isDevicesSearching = true;
         ubw.Run();
     }
 }
示例#5
0
 /**
  * Permet de commencer la vérification de communication entre l'application et les devices.
  * @param    caller  Le thread courant
  */
 public void Start(MonoBehaviour caller)
 {
     dataReceiver = new UnityBackgroundWorker(caller, CheckDeviceBegin, CheckDeviceProgress, CheckDeviceDone, dataReceiverHelper);
     try {
         isRunning = true;
         dataReceiver.Run();
     } catch (Exception e) {
         Debug.Log(e.Message);
     }
 }
示例#6
0
 public void FindDevices(bool performFastFind)
 {
     if (!ubwDeviceFinder.IsBusy)
     {
         txtAnswer.text += "Searching for the devices..\n";
         deviceFinderHelper.performFastFind = performFastFind;
         deviceFinderHelper.performLoopFind = false;
         ubwDeviceFinder.Run();
     }
 }
示例#7
0
    public void ReceiveByteData()
    {
        if (ubwDataReceiver != null && ubwDataReceiver.IsBusy)
        {
            ubwDataReceiver.Abort();
        }

        ubwByteDataReceiver.Run();

        //int maxLength = 512;
        //byte[] data = new byte[maxLength];
        //int byteArrayLength=BTM_ReceiveByteDataFast(data, maxLength);
        //if(byteArrayLength==-1)
        //{
        //    Debug.Log("Error!");
        //}
        //for(int i=0;i<byteArrayLength;i++)
        //{
        //    Debug.Log(i + ": " +(int)data[i]);
        //}
    }