Class SmcUtilFFM

java.lang.Object
oshi.util.platform.mac.SmcUtilFFM

@ThreadSafe public final class SmcUtilFFM extends Object
Provides access to SMC calls on macOS using FFM
  • Field Details

  • Method Details

    • smcOpen

      public static int smcOpen()
      Open a connection to SMC.
      Returns:
      The io_connect_t port (nonzero) if successful, 0 if failure. Caller must close with smcClose(int).
    • smcClose

      public static int smcClose(int conn)
      Close connection to SMC.
      Parameters:
      conn - The io_connect_t port returned by smcOpen()
      Returns:
      0 if successful, nonzero if failure
    • smcGetFloat

      public static double smcGetFloat(int conn, String key)
      Get a value from SMC which is in a floating point datatype (SP78, FPE2, FLT)
      Parameters:
      conn - The connection
      key - The key to retrieve
      Returns:
      Double representing the value
    • smcGetFirstFloat

      public static double smcGetFirstFloat(int conn, String... keys)
      Get the first positive value from a list of SMC keys.
      Parameters:
      conn - The connection
      keys - The keys to try in order
      Returns:
      The first value greater than 0, or 0 if all keys fail
    • smcGetLong

      public static long smcGetLong(int conn, String key)
      Get a 64-bit integer value from SMC
      Parameters:
      conn - The connection
      key - The key to retrieve
      Returns:
      Long representing the value