/** * 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(); } }
/** * 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); } }
void Start() { deviceFinderHelper = new DeviceFinderHelper() { performFastFind = true, performLoopFind = false }; deviceConnectionHelper = new DeviceConnectionHelper(); dataSenderAndReceiverHelper = new DataCommunicationHelper(); dataReceiverHelper = new DataCommunicationHelper(); byteDataSenderHelper = new ByteDataCommunicationHelper(); byteDataReceiverHelper = new ByteDataCommunicationHelper() { dataToSend = new byte[maxByteLength], receivedData = new byte[maxByteLength], maxLength = maxByteLength }; ubwDeviceFinder = new UnityBackgroundWorker(this, BGW_DeviceFinder, BGW_DeviceFinder_Progress, BGW_DeviceFinder_Done, deviceFinderHelper); ubwDeviceConnector = new UnityBackgroundWorker(this, BGW_DeviceConnector, BGW_DeviceConnector_Progress, BGW_DeviceConnector_Done, deviceConnectionHelper); ubwDataSenderAndReceiver = new UnityBackgroundWorker(this, BGW_SendAndReceiveData, BGW_SendAndReceiveData_Progress, BGW_SendAndReceiveData_Done, dataSenderAndReceiverHelper); ubwDataReceiver = new UnityBackgroundWorker(this, BGW_ReceiveData, BGW_ReceiveData_Progress, BGW_ReceiveData_Done, dataReceiverHelper); ubwByteDataReceiver = new UnityBackgroundWorker(this, BGW_ReceiveByteData, BGW_ReceiveByteData_Progress, BGW_ReceiveByteData_Done, byteDataReceiverHelper); FindDevices(true); StartCoroutine(StatusCoroutine()); }