// Function invoked during the onClick event of "StopButton". public void StopButtonFunction(int forceStop = 0) { // Invoke stop function from PluxDeviceManager. bool typeOfStop; // Check how many samples were communicated by the device. typeOfStop = PluxDevManager.StopAcquisitionUnity(forceStop); // Enable About Button. AboutButton.interactable = true; // Enable ConnectButton. if (StopButton.interactable == true) { ConnectButton.interactable = true; } // Enable ScanButton. ScanButton.interactable = true; // Disable StopButton. StopButton.interactable = false; // Disconnect device if a forced stop occurred. if (ConnectText.text == "Disconnect") { ConnectButtonFunction(typeOfStop); } // Show a warning message if something wrong happened. if (typeOfStop == true || forceStop == -1) { // Show info message. ConnectInfoPanel.SetActive(true); // Present a message stating the communication error and hide it after 5 seconds. StartCoroutine(RemoveAfterSeconds(5, ConnectInfoPanel)); } // Hide info message. BLESamplingRateInfoPanel.SetActive(false); Hybrid8SamplingRateInfoPanel.SetActive(false); }
// Function invoked during the onClick event of "StopButton". public void StopButtonFunction(int forceStop = 0) { // Invoke stop function from PluxDeviceManager. bool typeOfStop; typeOfStop = PluxDevManager.StopAcquisitionUnity(forceStop); // Disable StopButton. StopButton.interactable = false; // Enable About Button. AboutButton.interactable = true; // Enable ConnectButton. ConnectButton.interactable = true; // Stop Message. Debug.Log("Acquisition was Stopped :D"); // Disconnect device if a forced stop occurred. ConnectButtonFunction(typeOfStop); }