Package utils

Class AvailabilityChecker

java.lang.Object
utils.AvailabilityChecker

public class AvailabilityChecker extends Object
This class is used to check the availability of the python environment and the eye-tracking device, and to get the eye tracker name and the available frequencies.
  • Constructor Details

    • AvailabilityChecker

      public AvailabilityChecker()
  • Method Details

    • checkPythonEnvironment

      public static boolean checkPythonEnvironment(String pythonInterpreter) throws IOException, InterruptedException
      Check the availability of the python environment, i.e., whether the required python packages are installed.
      Parameters:
      pythonInterpreter - The path of the python interpreter.
      Returns:
      true if the python environment is available, false otherwise.
      Throws:
      IOException
      InterruptedException
    • checkEyeTracker

      public static boolean checkEyeTracker(String pythonInterpreter) throws IOException, InterruptedException
      Check the availability of the eye-tracking device.
      Parameters:
      pythonInterpreter - The path of the python interpreter.
      Returns:
      true if the eye-tracking device is available, false otherwise.
      Throws:
      IOException
      InterruptedException
    • getEyeTrackerName

      public static String getEyeTrackerName(String pythonInterpreter) throws IOException, InterruptedException
      Get the name of the eye-tracking device.
      Parameters:
      pythonInterpreter - The path of the python interpreter.
      Returns:
      The name of the eye tracker.
      Throws:
      IOException
      InterruptedException
    • getFrequencies

      public static List<String> getFrequencies(String pythonInterpreter) throws IOException, InterruptedException
      Get the available frequencies of the eye-tracking device.
      Parameters:
      pythonInterpreter - The path of the python interpreter.
      Returns:
      The available frequencies of the eye tracker.
      Throws:
      IOException
      InterruptedException
    • runPythonScript

      private static String runPythonScript(String pythonInterpreter, String pythonScript) throws IOException, InterruptedException
      Run a python script with ProcessBuilder and use BufferedReader to get the first line of the output.
      Parameters:
      pythonInterpreter - The path of the python interpreter.
      pythonScript - The python script to run.
      Returns:
      The first line of the output.
      Throws:
      IOException
      InterruptedException