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.StringType;
21 * {@link SysteminfoInterface} defines the methods needed to provide this binding with the required system information.
23 * @author Svilen Valkanov - Initial contribution
24 * @author Wouter Born - Add null annotations
27 public interface SysteminfoInterface {
30 * Initialize logic for the Systeminfo implementation
32 public void initializeSysteminfo();
34 // Operating system info
36 * Get the Family of the operating system /e.g. Windows,Unix,.../
38 public StringType getOsFamily();
41 * Get the manufacturer of the operating system
43 public StringType getOsManufacturer();
46 * Get the version of the operating system
50 public StringType getOsVersion();
54 * Get the name of the CPU
56 public StringType getCpuName();
59 * Get description about the CPU e.g (model, family, vendor, serial number, identifier, architecture(32bit or
62 public StringType getCpuDescription();
65 * Get the number of logical CPUs/cores available for processing.
67 public DecimalType getCpuLogicalCores();
70 * Get the number of physical CPUs/cores available for processing.
72 public DecimalType getCpuPhysicalCores();
75 * Returns the system load average for the last minute.
77 * @return the load as a number of processes or null, if no information is available
79 public @Nullable DecimalType getCpuLoad1();
82 * Returns the system load average for the last 5 minutes.
84 * @return the load as number of processes or null, if no information is available
86 public @Nullable DecimalType getCpuLoad5();
89 * Returns the system load average for the last 15 minutes.
91 * @return the load as number of processes or null, if no information is available
93 public @Nullable DecimalType getCpuLoad15();
96 * Get the System uptime (time since boot).
98 * @return time in minutes since boot
100 public DecimalType getCpuUptime();
103 * Get the number of threads currently running
105 * @return number of threads
107 public DecimalType getCpuThreads();
111 * Returns total size of memory
113 * @return memory size in MB
115 public DecimalType getMemoryTotal();
118 * Returns available size of memory
120 * @return memory size in MB
122 public DecimalType getMemoryAvailable();
125 * Returns used size of memory
127 * @return memory size in MB
129 public DecimalType getMemoryUsed();
132 * Percents of available memory on the machine
134 * @return percent of available memory or null, if no information is available
136 public @Nullable DecimalType getMemoryAvailablePercent();
139 * Percents of used memory on the machine
141 * @return percent of used memory or null, if no information is available
143 public @Nullable DecimalType getMemoryUsedPercent();
147 * Returns total size of swap memory
149 * @return memory size in MB or 0, if no there is no swap memory
151 public @Nullable DecimalType getSwapTotal();
154 * Returns available size swap of memory
156 * @return memory size in MB or 0, if no there is no swap memory
158 public @Nullable DecimalType getSwapAvailable();
161 * Returns used size of swap memory
163 * @return memory size in MB or 0, if no there is no swap memory
165 public @Nullable DecimalType getSwapUsed();
168 * Percents of available swap memory on the machine
170 * @return percent of available memory or null, if no there is no swap memory
172 public @Nullable DecimalType getSwapAvailablePercent();
175 * Percents of used swap memory on the machine
177 * @return percent of used memory or null, if no there is no swap memory
179 public @Nullable DecimalType getSwapUsedPercent();
183 * Returns the total space of the logical storage volume.
185 * @param deviceIndex - the index of the logical volume
186 * @return storage size in MB
187 * @throws DeviceNotFoundException
189 public DecimalType getStorageTotal(int deviceIndex) throws DeviceNotFoundException;
192 * Returns the available storage space on the logical storage volume
194 * @param deviceIndex - the index of the logical volume
195 * @return storage size in MB
196 * @throws DeviceNotFoundException
198 public DecimalType getStorageAvailable(int deviceIndex) throws DeviceNotFoundException;
201 * Gets the used storage space on the logical storage volume
203 * @param deviceIndex - the index of the logical volume
204 * @return storage size in MB
205 * @throws DeviceNotFoundException
207 public DecimalType getStorageUsed(int deviceIndex) throws DeviceNotFoundException;
210 * Gets the percent of available storage on the logical volume
212 * @param deviceIndex - the index of the logical volume
213 * @return percent of available storage or null
214 * @throws DeviceNotFoundException
216 public @Nullable DecimalType getStorageAvailablePercent(int deviceIndex) throws DeviceNotFoundException;
219 * Gets the percent of used storage on the logical volume
221 * @param deviceIndex - the index of the logical volume
222 * @return percent of used storage or null
223 * @throws DeviceNotFoundException
225 public @Nullable DecimalType getStorageUsedPercent(int deviceIndex) throws DeviceNotFoundException;
228 * Gets the name of the logical storage volume
230 * @throws DeviceNotFoundException
232 public StringType getStorageName(int deviceIndex) throws DeviceNotFoundException;
235 * Gets the type of the logical storage volume (e.g. NTFS, FAT32)
237 * @throws DeviceNotFoundException
239 public StringType getStorageType(int deviceIndex) throws DeviceNotFoundException;
242 * Gets the description of the logical storage volume
244 * @throws DeviceNotFoundException
246 public StringType getStorageDescription(int deviceIndex) throws DeviceNotFoundException;
248 // Hardware drive info
250 * Gets the name of the physical storage drive
252 * @param deviceIndex - index of the storage drive
253 * @throws DeviceNotFoundException
255 public StringType getDriveName(int deviceIndex) throws DeviceNotFoundException;
258 * Gets the model of the physical storage drive
260 * @param deviceIndex - index of the storage drive
261 * @throws DeviceNotFoundException
263 public StringType getDriveModel(int deviceIndex) throws DeviceNotFoundException;
266 * Gets the serial number of the physical storage drive
268 * @param deviceIndex - index of the storage drive
269 * @throws DeviceNotFoundException
271 public StringType getDriveSerialNumber(int deviceIndex) throws DeviceNotFoundException;
275 * Get the Host IP address of the network.
277 * @param networkIndex - the index of the network
278 * @return 32-bit IPv4 address
279 * @throws DeviceNotFoundException
281 public StringType getNetworkIp(int networkIndex) throws DeviceNotFoundException;
284 * Get the name of this network.
286 * @param networkIndex - the index of the network
287 * @throws DeviceNotFoundException
289 public StringType getNetworkName(int networkIndex) throws DeviceNotFoundException;
292 * The description of the network. On some platforms, this is identical to the name.
294 * @param networkIndex - the index of the network
295 * @throws DeviceNotFoundException
297 public StringType getNetworkDisplayName(int networkIndex) throws DeviceNotFoundException;
300 * Gets the MAC Address of the network.
302 * @param networkIndex - the index of the network
303 * @throws DeviceNotFoundException
305 public StringType getNetworkMac(int networkIndex) throws DeviceNotFoundException;
308 * Get number of packets received
310 * @param networkIndex - the index of the network
311 * @throws DeviceNotFoundException
313 public DecimalType getNetworkPacketsReceived(int networkIndex) throws DeviceNotFoundException;
316 * Get number of packets sent
318 * @param networkIndex - the index of the network
319 * @throws DeviceNotFoundException
321 public DecimalType getNetworkPacketsSent(int networkIndex) throws DeviceNotFoundException;
324 * Get data sent in MB for this network
326 * @param networkIndex - the index of the network
327 * @throws DeviceNotFoundException
329 public DecimalType getNetworkDataSent(int networkIndex) throws DeviceNotFoundException;
332 * Get data received in MB for this network
334 * @param networkIndex - the index of the network
335 * @throws DeviceNotFoundException
337 public DecimalType getNetworkDataReceived(int networkIndex) throws DeviceNotFoundException;
341 * Get information about the display device as product number, manufacturer, serial number, width and height in cm";
343 * @param deviceIndex - the index of the display device
344 * @throws DeviceNotFoundException
346 public StringType getDisplayInformation(int deviceIndex) throws DeviceNotFoundException;
350 * Get the information from the CPU temperature sensors.
352 * @return Temperature in degrees Celsius if available, null otherwise.
354 public @Nullable DecimalType getSensorsCpuTemperature();
357 * Get the information for the CPU voltage.
359 * @return Voltage in Volts if available, null otherwise.
361 public @Nullable DecimalType getSensorsCpuVoltage();
367 * @return Speed in rpm or null if unable to measure fan speed
368 * @throws DeviceNotFoundException
370 public @Nullable DecimalType getSensorsFanSpeed(int deviceIndex) throws DeviceNotFoundException;
374 * Get estimated time remaining for the power source.
377 * @return minutes remaining charge or null, if the time is estimated as unlimited
378 * @throws DeviceNotFoundException
380 public @Nullable DecimalType getBatteryRemainingTime(int deviceIndex) throws DeviceNotFoundException;
383 * Battery remaining capacity.
386 * @return percentage value /0-100/
387 * @throws DeviceNotFoundException
389 public DecimalType getBatteryRemainingCapacity(int deviceIndex) throws DeviceNotFoundException;
395 * @throws DeviceNotFoundException
397 public StringType getBatteryName(int deviceIndex) throws DeviceNotFoundException;
400 * Returns the name of the process
402 * @param pid - the PID of the process
403 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
405 public @Nullable StringType getProcessName(int pid) throws DeviceNotFoundException;
408 * Returns the CPU usage of the process
410 * @param pid - the PID of the process
411 * @return - percentage value /0-100/
412 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
414 public @Nullable DecimalType getProcessCpuUsage(int pid) throws DeviceNotFoundException;
417 * Returns the size of RAM memory only usage of the process
419 * @param pid - the PID of the process
420 * @return memory size in MB
421 * @throws DeviceNotFoundException- thrown if process with this PID can not be found
423 public @Nullable DecimalType getProcessMemoryUsage(int pid) throws DeviceNotFoundException;
426 * Returns the full path of the executing process.
428 * @param pid - the PID of the process
429 * @throws DeviceNotFoundException - thrown if process with this PID can not be found
431 public @Nullable StringType getProcessPath(int pid) throws DeviceNotFoundException;
434 * Returns the number of threads in this 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 DecimalType getProcessThreads(int pid) throws DeviceNotFoundException;