View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.driver.windows.wmi;
6   
7   import java.util.Objects;
8   
9   import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiQuery;
10  import com.sun.jna.platform.win32.COM.WbemcliUtil.WmiResult;
11  
12  import oshi.annotation.concurrent.ThreadSafe;
13  import oshi.util.platform.windows.WmiQueryHandler;
14  
15  /**
16   * Utility to query WMI class {@code Win32_VideoController}
17   */
18  @ThreadSafe
19  public final class Win32VideoController {
20  
21      private static final String WIN32_VIDEO_CONTROLLER = "Win32_VideoController";
22  
23      /**
24       * Video Controller properties
25       */
26      public enum VideoControllerProperty {
27          ADAPTERCOMPATIBILITY, ADAPTERRAM, DRIVERVERSION, NAME, PNPDEVICEID;
28      }
29  
30      private Win32VideoController() {
31      }
32  
33      /**
34       * Queries video controller info for Vista and later.
35       *
36       * @return Information regarding video controllers
37       */
38      public static WmiResult<VideoControllerProperty> queryVideoController() {
39          WmiQuery<VideoControllerProperty> videoControllerQuery = new WmiQuery<>(WIN32_VIDEO_CONTROLLER,
40                  VideoControllerProperty.class);
41          return Objects.requireNonNull(WmiQueryHandler.createInstance()).queryWMI(videoControllerQuery);
42      }
43  }