1 /* 2 * Copyright 2016-2022 The OSHI Project Contributors 3 * SPDX-License-Identifier: MIT 4 */ 5 package oshi.hardware; 6 7 import java.util.Collections; 8 import java.util.List; 9 10 import oshi.annotation.concurrent.ThreadSafe; 11 12 /** 13 * A hardware abstraction layer. Provides access to hardware items such as processors, memory, battery, and disks. 14 */ 15 @ThreadSafe 16 public interface HardwareAbstractionLayer { 17 18 /** 19 * Instantiates a {@link oshi.hardware.ComputerSystem} object. This represents the physical hardware, including 20 * components such as BIOS/Firmware and a motherboard, logic board, etc. 21 * 22 * @return a {@link oshi.hardware.ComputerSystem} object. 23 */ 24 ComputerSystem getComputerSystem(); 25 26 /** 27 * Instantiates a {@link oshi.hardware.CentralProcessor} object. This represents one or more Logical CPUs. 28 * 29 * @return A {@link oshi.hardware.CentralProcessor} object. 30 */ 31 CentralProcessor getProcessor(); 32 33 /** 34 * Instantiates a {@link oshi.hardware.GlobalMemory} object. 35 * 36 * @return A memory object. 37 */ 38 GlobalMemory getMemory(); 39 40 /** 41 * Instantiates a list of {@link oshi.hardware.PowerSource} objects, representing batteries, etc. 42 * 43 * @return A list of PowerSource objects or an empty list if none are present. 44 */ 45 List<PowerSource> getPowerSources(); 46 47 /** 48 * Instantiates a list of {@link oshi.hardware.HWDiskStore} objects, representing physical hard disks or other 49 * similar storage devices. 50 * 51 * @return A list of HWDiskStore objects or an empty list if none are present. 52 */ 53 List<HWDiskStore> getDiskStores(); 54 55 /** 56 * Instantiates a list of {@link LogicalVolumeGroup} objects, representing a storage pool or group of devices, 57 * partitions, volumes, or other implementation specific means of file storage. 58 * <p> 59 * If not yet implemented or if logical volume groups do not exist, returns an empty list. 60 * <p> 61 * Currently implemented for Linux (LVM2), macOS (Core Storage), and Windows (Storage Spaces). 62 * 63 * @return A list of {@link LogicalVolumeGroup} objects or an empty list if none are present. 64 */ 65 default List<LogicalVolumeGroup> getLogicalVolumeGroups() { 66 return Collections.emptyList(); 67 } 68 69 /** 70 * Gets a list of non-local {@link NetworkIF} objects, representing a network interface. The list excludes local 71 * interfaces. 72 * 73 * @return A list of {@link NetworkIF} objects representing the interfaces 74 */ 75 List<NetworkIF> getNetworkIFs(); 76 77 /** 78 * Gets a list {@link NetworkIF} objects, representing a network interface. 79 * 80 * @param includeLocalInterfaces whether to include local interfaces (loopback or no hardware address) in the result 81 * @return A list of {@link NetworkIF} objects representing the interfaces 82 */ 83 List<NetworkIF> getNetworkIFs(boolean includeLocalInterfaces); 84 85 /** 86 * Instantiates a list of {@link oshi.hardware.Display} objects, representing monitors or other video output 87 * devices. 88 * 89 * @return A list of Display objects or an empty list if none are present. 90 */ 91 List<Display> getDisplays(); 92 93 /** 94 * Instantiates a {@link oshi.hardware.Sensors} object, representing CPU temperature and fan speed. 95 * 96 * @return A Sensors object 97 */ 98 Sensors getSensors(); 99 100 /** 101 * Instantiates a list of {@link oshi.hardware.UsbDevice} objects, representing devices connected via a usb port 102 * (including internal devices). 103 * <p> 104 * If the value of {@code tree} is true, the top level devices returned from this method are the USB Controllers; 105 * connected hubs and devices in its device tree share that controller's bandwidth. If the value of {@code tree} is 106 * false, USB devices (not controllers) are listed in a single flat list. 107 * 108 * @param tree If {@code true}, returns devices connected to the existing device, accessible via 109 * {@link UsbDevice#getConnectedDevices()}. If {@code false} returns devices as a flat list with no 110 * connected device information. 111 * @return A list of UsbDevice objects representing (optionally) the USB Controllers and devices connected to them, 112 * or an empty list if none are present 113 */ 114 List<UsbDevice> getUsbDevices(boolean tree); 115 116 /** 117 * Instantiates a list of {@link oshi.hardware.SoundCard} objects, representing the Sound cards. 118 * 119 * @return A list of SoundCard objects or an empty list if none are present. 120 */ 121 List<SoundCard> getSoundCards(); 122 123 /** 124 * Instantiates a list of {@link oshi.hardware.GraphicsCard} objects, representing the Graphics cards. 125 * 126 * @return A list of objects or an empty list if none are present. 127 */ 128 List<GraphicsCard> getGraphicsCards(); 129 }