2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.systeminfo.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.library.types.DecimalType;
18 import org.openhab.core.library.types.PercentType;
19 import org.openhab.core.library.types.StringType;
22 * {@link SysteminfoInterface} defines the methods needed to provide this binding with the required system information.
24 * @author Svilen Valkanov - Initial contribution
25 * @author Wouter Born - Add null annotations
28 public interface SysteminfoInterface {
31 * Initialize logic for the Systeminfo implementation
33 public void initializeSysteminfo();
35 // Operating system info
37 * Get the Family of the operating system /e.g. Windows,Unix,.../
39 public StringType getOsFamily();
42 * Get the manufacturer of the operating system
44 public StringType getOsManufacturer();
47 * Get the version of the operating system
51 public StringType getOsVersion();
55 * Get the name of the CPU
57 public StringType getCpuName();
60 * Get description about the CPU e.g (model, family, vendor, serial number, identifier, architecture(32bit or
63 public StringType getCpuDescription();
66 * Get the number of logical CPUs/cores available for processing.
68 public DecimalType getCpuLogicalCores();
71 * Get the number of physical CPUs/cores available for processing.
73 public DecimalType getCpuPhysicalCores();
76 * Returns the system cpu load.
78 * @return the system cpu load between 0 and 1 or null, if no information is available
80 public @Nullable PercentType getSystemCpuLoad();
83 * Returns the system load average for the last minute.
85 * @return the load as a number of processes or null, if no information is available
87 public @Nullable DecimalType getCpuLoad1();
90 * Returns the system load average for the last 5 minutes.
92 * @return the load as number of processes or null, if no information is available
94 public @Nullable DecimalType getCpuLoad5();
97 * Returns the system load average for the last 15 minutes.
99 * @return the load as number of processes or null, if no information is available
101 public @Nullable DecimalType getCpuLoad15();
104 * Get the System uptime (time since boot).
106 * @return time in minutes since boot
108 public DecimalType getCpuUptime();
111 * Get the number of threads currently running
113 * @return number of threads
115 public DecimalType getCpuThreads();
119 * Returns total size of memory
121 * @return memory size in MB
123 public DecimalType getMemoryTotal();
126 * Returns available size of memory
128 * @return memory size in MB
130 public DecimalType getMemoryAvailable();
133 * Returns used size of memory
135 * @return memory size in MB
137 public DecimalType getMemoryUsed();
140 * Percents of available memory on the machine
142 * @return percent of available memory or null, if no information is available
144 public @Nullable DecimalType getMemoryAvailablePercent();
147 * Percents of used memory on the machine
149 * @return percent of used memory or null, if no information is available
151 public @Nullable DecimalType getMemoryUsedPercent();
155 * Returns total size of swap memory
157 * @return memory size in MB or 0, if no there is no swap memory
159 public @Nullable DecimalType getSwapTotal();
162 * Returns available size swap of memory
164 * @return memory size in MB or 0, if no there is no swap memory
166 public @Nullable DecimalType getSwapAvailable();
169 * Returns used size of swap memory
171 * @return memory size in MB or 0, if no there is no swap memory
173 public @Nullable DecimalType getSwapUsed();
176 * Percents of available swap memory on the machine
178 * @return percent of available memory or null, if no there is no swap memory
180 public @Nullable DecimalType getSwapAvailablePercent();
183 * Percents of used swap memory on the machine
185 * @return percent of used memory or null, if no there is no swap memory
187 public @Nullable DecimalType getSwapUsedPercent();
191 * Returns the total space of the logical storage volume.
193 * @param deviceIndex - the index of the logical volume
194 * @return storage size in MB
195 * @throws DeviceNotFoundException
197 public DecimalType getStorageTotal(int deviceIndex) throws DeviceNotFoundException;
200 * Returns the available storage space on the logical storage volume
202 * @param deviceIndex - the index of the logical volume
203 * @return storage size in MB
204 * @throws DeviceNotFoundException
206 public DecimalType getStorageAvailable(int deviceIndex) throws DeviceNotFoundException;
209 * Gets the used storage space on the logical storage volume
211 * @param deviceIndex - the index of the logical volume
212 * @return storage size in MB
213 * @throws DeviceNotFoundException
215 public DecimalType getStorageUsed(int deviceIndex) throws DeviceNotFoundException;
218 * Gets the percent of available storage on the logical volume
220 * @param deviceIndex - the index of the logical volume
221 * @return percent of available storage or null
222 * @throws DeviceNotFoundException
224 public @Nullable DecimalType getStorageAvailablePercent(int deviceIndex) throws DeviceNotFoundException;
227 * Gets the percent of used storage on the logical volume
229 * @param deviceIndex - the index of the logical volume
230 * @return percent of used storage or null
231 * @throws DeviceNotFoundException
233 public @Nullable DecimalType getStorageUsedPercent(int deviceIndex) throws DeviceNotFoundException;
236 * Gets the name of the logical storage volume
238 * @throws DeviceNotFoundException
240 public StringType getStorageName(int deviceIndex) throws DeviceNotFoundException;
243 * Gets the type of the logical storage volume (e.g. NTFS, FAT32)
245 * @throws DeviceNotFoundException
247 public StringType getStorageType(int deviceIndex) throws DeviceNotFoundException;
250 * Gets the description of the logical storage volume
252 * @throws DeviceNotFoundException
254 public StringType getStorageDescription(int deviceIndex) throws DeviceNotFoundException;
256 // Hardware drive info
258 * Gets the name of the physical storage drive
260 * @param deviceIndex - index of the storage drive
261 * @throws DeviceNotFoundException
263 public StringType getDriveName(int deviceIndex) throws DeviceNotFoundException;
266 * Gets the model of the physical storage drive
268 * @param deviceIndex - index of the storage drive
269 * @throws DeviceNotFoundException
271 public StringType getDriveModel(int deviceIndex) throws DeviceNotFoundException;
274 * Gets the serial number of the physical storage drive
276 * @param deviceIndex - index of the storage drive
277 * @throws DeviceNotFoundException
279 public StringType getDriveSerialNumber(int deviceIndex) throws DeviceNotFoundException;
283 * Get the Host IP address of the network.
285 * @param networkIndex - the index of the network
286 * @return 32-bit IPv4 address
287 * @throws DeviceNotFoundException
289 public StringType getNetworkIp(int networkIndex) throws DeviceNotFoundException;
292 * Get the name of this network.
294 * @param networkIndex - the index of the network
295 * @throws DeviceNotFoundException
297 public StringType getNetworkName(int networkIndex) throws DeviceNotFoundException;
300 * The description of the network. On some platforms, this is identical to the name.
302 * @param networkIndex - the index of the network
303 * @throws DeviceNotFoundException
305 public StringType getNetworkDisplayName(int networkIndex) throws DeviceNotFoundException;
308 * Gets the MAC Address of the network.
310 * @param networkIndex - the index of the network
311 * @throws DeviceNotFoundException
313 public StringType getNetworkMac(int networkIndex) throws DeviceNotFoundException;
316 * Get number of packets received
318 * @param networkIndex - the index of the network
319 * @throws DeviceNotFoundException
321 public DecimalType getNetworkPacketsReceived(int networkIndex) throws DeviceNotFoundException;
324 * Get number of packets sent
326 * @param networkIndex - the index of the network
327 * @throws DeviceNotFoundException
329 public DecimalType getNetworkPacketsSent(int networkIndex) throws DeviceNotFoundException;
332 * Get data sent in MB for this network
334 * @param networkIndex - the index of the network
335 * @throws DeviceNotFoundException
337 public DecimalType getNetworkDataSent(int networkIndex) throws DeviceNotFoundException;
340 * Get data received in MB for this network
342 * @param networkIndex - the index of the network
343 * @throws DeviceNotFoundException
345 public DecimalType getNetworkDataReceived(int networkIndex) throws DeviceNotFoundException;
349 * Get information about the display device as product number, manufacturer, serial number, width and height in cm";
351 * @param deviceIndex - the index of the display device
352 * @throws DeviceNotFoundException
354 public StringType getDisplayInformation(int deviceIndex) throws DeviceNotFoundException;
358 * Get the information from the CPU temperature sensors.
360 * @return Temperature in degrees Celsius if available, null otherwise.
362 public @Nullable DecimalType getSensorsCpuTemperature();
365 * Get the information for the CPU voltage.
367 * @return Voltage in Volts if available, null otherwise.
369 public @Nullable DecimalType getSensorsCpuVoltage();
375 * @return Speed in rpm or null if unable to measure fan speed
376 * @throws DeviceNotFoundException
378 public @Nullable DecimalType getSensorsFanSpeed(int deviceIndex) throws DeviceNotFoundException;
382 * Get estimated time remaining for the power source.
385 * @return minutes remaining charge or null, if the time is estimated as unlimited
386 * @throws DeviceNotFoundException
388 public @Nullable DecimalType getBatteryRemainingTime(int deviceIndex) throws DeviceNotFoundException;
391 * Battery remaining capacity.
394 * @return percentage value /0-100/
395 * @throws DeviceNotFoundException
397 public DecimalType getBatteryRemainingCapacity(int deviceIndex) throws DeviceNotFoundException;
403 * @throws DeviceNotFoundException
405 public StringType getBatteryName(int deviceIndex) throws DeviceNotFoundException;
408 * Returns the name of the process
410 * @param pid - the PID of the process
411 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
413 public @Nullable StringType getProcessName(int pid) throws DeviceNotFoundException;
416 * Returns the CPU usage of the process
418 * @param pid - the PID of the process
419 * @return - percentage value /0-100/
420 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
422 public @Nullable PercentType getProcessCpuUsage(int pid) throws DeviceNotFoundException;
425 * Returns the size of RAM memory only usage of the process
427 * @param pid - the PID of the process
428 * @return memory size in MB
429 * @throws DeviceNotFoundException- thrown if process with this PID can not be found
431 public @Nullable DecimalType getProcessMemoryUsage(int pid) throws DeviceNotFoundException;
434 * Returns the full path of the executing process.
436 * @param pid - the PID of the process
437 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
439 public @Nullable StringType getProcessPath(int pid) throws DeviceNotFoundException;
442 * Returns the number of threads in this process.
444 * @param pid - the PID of the process
445 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
447 public @Nullable DecimalType getProcessThreads(int pid) throws DeviceNotFoundException;