Hardware
The information refer to the available hardware of the device
Available information
On macOS target the available hardware information are the below:
| Category | Property | Description | Source |
|---|---|---|---|
| Computer System | computerSystem |
The details of the computer system, firmware, and baseboard | MacOsHardware.computerSystem |
| CPU | processorInfo |
The details of the system's central processor (CPU) | MacOsHardware.processorInfo |
| Memory | globalMemory |
The details about the system's global, virtual, and physical memory | MacOsHardware.globalMemory |
| Power Source | powerSourceDescription |
The capacity, electrical measurements, and charging state of the internal battery | MacOsHardware.powerSourceDescription |
| Disk Storage | disks |
A list of physical and synthesized disks with their partitions | MacOsHardware.disks |
| Network Interfaces | networkInterfaces |
A list of network interfaces, their addresses, and traffic statistics | MacOsHardware.networkInterfaces |
| Displays | displaysInfo |
A list of available display identification information | MacOsHardware.displaysInfo |
| USB Devices | usbDevices |
A list of USB devices with their nested connected devices | MacOsHardware.usbDevices |
| Bluetooth Devices | bluetoothDevices |
A list of Bluetooth devices paired with the system | MacOsHardware.bluetoothDevices |
| Printers | printers |
A list of printing destinations configured on the system | MacOsHardware.printers |
| Sound Cards | soundCards |
A list of audio devices available on the system | MacOsHardware.soundCards |
| Graphics Cards | graphicCards |
A list of graphics cards available on the system | MacOsHardware.graphicCards |
API source
The information are retrievable using the MacOsInfo.hardware API:
Retrieve a MacOsInfo instance before accessing the hardware information
Hardware API
Retrieve a MacOsHardware instance from macOsInfo instance
Properties
The below properties are readable properties provided by the hardware instance
Reading a hardware property retrieves a new snapshot of the corresponding information. Read the property again to retrieve updated information
computerSystem
The computer system identity, firmware, and baseboard information
processorInfo
The central processor identity, topology, frequencies, caches, and CPU load ticks
globalMemory
The global memory information, including virtual and physical memory
powerSourceDescription
The internal power source capacity, electrical measurements, and charging state
val powerSourceDescription: MacOsPowerSource = hardware.powerSourceDescription
println(powerSourceDescription)
Warning
Reading powerSourceDescription throws an IllegalStateException when the internal battery service is unavailable
disks
List of physical and synthesized disks with their I/O statistics and associated partitions
networkInterfaces
List of network interfaces with their identities, assigned addresses, and traffic statistics
displaysInfo
List of available display identification information
usbDevices
List of USB devices with their nested connected devices
bluetoothDevices
List of Bluetooth devices paired with the system, including disconnected devices
val bluetoothDevices: List<MacOsBluetoothDevice> = hardware.bluetoothDevices
println(bluetoothDevices)
The connected property indicates whether a device is currently connected. A batteryLevel of -1 indicates that
a battery reading is unavailable
printers
List of printers configured on the system
soundCards
List of sound cards with their names, driver versions, and codec descriptions
graphicCards
List of graphics cards with their identities, hardware revisions, and video-memory values