Class VideoControllerService

java.lang.Object
io.github.eggy03.ferrumx.windows.service.display.VideoControllerService
All Implemented Interfaces:
CommonServiceInterface<VideoController>

public class VideoControllerService extends Object implements CommonServiceInterface<VideoController>
Service class for fetching video controller (GPU) information from the system.

This class executes the CimQuery.VIDEO_CONTROLLER_QUERY PowerShell command and maps the resulting JSON into a list of VideoController objects.

Thread safety

Methods of class are not thread safe.

Usage examples


 // Convenience API (creates its own short-lived session)
 VideoControllerService videoControllerService = new VideoControllerService();
 List<VideoController> controllers = videoControllerService.get();

 // API with re-usable session (caller manages session lifecycle)
 try (PowerShell session = PowerShell.openSession()) {
     VideoControllerService videoControllerService = new VideoControllerService();
     List<VideoController> controllers = videoControllerService.get(session);
 }
 
Since:
2.0.0
Author:
Egg-03
  • Constructor Details

    • VideoControllerService

      public VideoControllerService()
  • Method Details

    • get

      @NotNull public @NotNull List<VideoController> get()
      Retrieves a list of video controllers (GPUs) present in the system.

      Each invocation creates and uses a short-lived PowerShell session internally.

      Specified by:
      get in interface CommonServiceInterface<VideoController>
      Returns:
      a list of VideoController objects representing the video controllers. Returns an empty list if none are detected.
      Throws:
      com.google.gson.JsonSyntaxException - if there is an error executing the PowerShell command or parsing the output.
    • get

      @NotNull public @NotNull List<VideoController> get(com.profesorfalken.jpowershell.PowerShell powerShell)
      Retrieves a list of video controllers (GPUs) present in the system using the caller's PowerShell session.
      Specified by:
      get in interface CommonServiceInterface<VideoController>
      Parameters:
      powerShell - an existing PowerShell session managed by the caller
      Returns:
      a list of VideoController objects representing the video controllers. Returns an empty list if none are detected.
      Throws:
      com.google.gson.JsonSyntaxException - if there is an error executing the PowerShell command or parsing the output.