View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.platform.unix.aix;
6   
7   import java.util.List;
8   import java.util.function.Supplier;
9   
10  import oshi.annotation.concurrent.ThreadSafe;
11  import oshi.hardware.common.AbstractSensors;
12  
13  /**
14   * Sensors not available except counting fans from lscfg
15   */
16  @ThreadSafe
17  final class AixSensors extends AbstractSensors {
18  
19      private final Supplier<List<String>> lscfg;
20  
21      AixSensors(Supplier<List<String>> lscfg) {
22          this.lscfg = lscfg;
23      }
24  
25      @Override
26      public double queryCpuTemperature() {
27          // Not available in general without specialized software
28          return 0d;
29      }
30  
31      @Override
32      public int[] queryFanSpeeds() {
33          // Speeds are not available in general without specialized software
34          // We can count fans from lscfg and return an appropriate sized array of zeroes.
35          int fans = 0;
36          for (String s : lscfg.get()) {
37              if (s.contains("Air Mover")) {
38                  fans++;
39              }
40          }
41          return new int[fans];
42      }
43  
44      @Override
45      public double queryCpuVoltage() {
46          // Not available in general without specialized software
47          return 0d;
48      }
49  }