Package utils
Class AvailabilityChecker
java.lang.Object
utils.AvailabilityChecker
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkEyeTracker
(String pythonInterpreter) Check the availability of the eye-tracking device.static boolean
checkPythonEnvironment
(String pythonInterpreter) Check the availability of the python environment, i.e., whether the required python packages are installed.static String
getEyeTrackerName
(String pythonInterpreter) Get the name of the eye-tracking device.getFrequencies
(String pythonInterpreter) Get the available frequencies of the eye-tracking device.private static String
runPythonScript
(String pythonInterpreter, String pythonScript) Run a python script withProcessBuilder
and useBufferedReader
to get the first line of the output.
-
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 withProcessBuilder
and useBufferedReader
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
-