]> git.basschouten.com Git - openhab-addons.git/blob
a606f7a26c81d252c68aa54c01b2f89aa9ea60cd
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.systeminfo.internal.model;
14
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;
20
21 /**
22  * {@link SysteminfoInterface} defines the methods needed to provide this binding with the required system information.
23  *
24  * @author Svilen Valkanov - Initial contribution
25  * @author Wouter Born - Add null annotations
26  */
27 @NonNullByDefault
28 public interface SysteminfoInterface {
29
30     /**
31      * Initialize logic for the Systeminfo implementation
32      */
33     public void initializeSysteminfo();
34
35     // Operating system info
36     /**
37      * Get the Family of the operating system /e.g. Windows,Unix,.../
38      */
39     public StringType getOsFamily();
40
41     /**
42      * Get the manufacturer of the operating system
43      */
44     public StringType getOsManufacturer();
45
46     /**
47      * Get the version of the operating system
48      *
49      * @return
50      */
51     public StringType getOsVersion();
52
53     // CPU info
54     /**
55      * Get the name of the CPU
56      */
57     public StringType getCpuName();
58
59     /**
60      * Get description about the CPU e.g (model, family, vendor, serial number, identifier, architecture(32bit or
61      * 64bit))
62      */
63     public StringType getCpuDescription();
64
65     /**
66      * Get the number of logical CPUs/cores available for processing.
67      */
68     public DecimalType getCpuLogicalCores();
69
70     /**
71      * Get the number of physical CPUs/cores available for processing.
72      */
73     public DecimalType getCpuPhysicalCores();
74
75     /**
76      * Returns the system cpu load.
77      *
78      * @return the system cpu load between 0 and 1 or null, if no information is available
79      */
80     public @Nullable PercentType getSystemCpuLoad();
81
82     /**
83      * Returns the system load average for the last minute.
84      *
85      * @return the load as a number of processes or null, if no information is available
86      */
87     public @Nullable DecimalType getCpuLoad1();
88
89     /**
90      * Returns the system load average for the last 5 minutes.
91      *
92      * @return the load as number of processes or null, if no information is available
93      */
94     public @Nullable DecimalType getCpuLoad5();
95
96     /**
97      * Returns the system load average for the last 15 minutes.
98      *
99      * @return the load as number of processes or null, if no information is available
100      */
101     public @Nullable DecimalType getCpuLoad15();
102
103     /**
104      * Get the System uptime (time since boot).
105      *
106      * @return time in minutes since boot
107      */
108     public DecimalType getCpuUptime();
109
110     /**
111      * Get the number of threads currently running
112      *
113      * @return number of threads
114      */
115     public DecimalType getCpuThreads();
116
117     // Memory info
118     /**
119      * Returns total size of memory
120      *
121      * @return memory size in MB
122      */
123     public DecimalType getMemoryTotal();
124
125     /**
126      * Returns available size of memory
127      *
128      * @return memory size in MB
129      */
130     public DecimalType getMemoryAvailable();
131
132     /**
133      * Returns used size of memory
134      *
135      * @return memory size in MB
136      */
137     public DecimalType getMemoryUsed();
138
139     /**
140      * Percents of available memory on the machine
141      *
142      * @return percent of available memory or null, if no information is available
143      */
144     public @Nullable DecimalType getMemoryAvailablePercent();
145
146     /**
147      * Percents of used memory on the machine
148      *
149      * @return percent of used memory or null, if no information is available
150      */
151     public @Nullable DecimalType getMemoryUsedPercent();
152
153     // Swap memory info
154     /**
155      * Returns total size of swap memory
156      *
157      * @return memory size in MB or 0, if no there is no swap memory
158      */
159     public @Nullable DecimalType getSwapTotal();
160
161     /**
162      * Returns available size swap of memory
163      *
164      * @return memory size in MB or 0, if no there is no swap memory
165      */
166     public @Nullable DecimalType getSwapAvailable();
167
168     /**
169      * Returns used size of swap memory
170      *
171      * @return memory size in MB or 0, if no there is no swap memory
172      */
173     public @Nullable DecimalType getSwapUsed();
174
175     /**
176      * Percents of available swap memory on the machine
177      *
178      * @return percent of available memory or null, if no there is no swap memory
179      */
180     public @Nullable DecimalType getSwapAvailablePercent();
181
182     /**
183      * Percents of used swap memory on the machine
184      *
185      * @return percent of used memory or null, if no there is no swap memory
186      */
187     public @Nullable DecimalType getSwapUsedPercent();
188
189     // Storage info
190     /**
191      * Returns the total space of the logical storage volume.
192      *
193      * @param deviceIndex - the index of the logical volume
194      * @return storage size in MB
195      * @throws DeviceNotFoundException
196      */
197     public DecimalType getStorageTotal(int deviceIndex) throws DeviceNotFoundException;
198
199     /**
200      * Returns the available storage space on the logical storage volume
201      *
202      * @param deviceIndex - the index of the logical volume
203      * @return storage size in MB
204      * @throws DeviceNotFoundException
205      */
206     public DecimalType getStorageAvailable(int deviceIndex) throws DeviceNotFoundException;
207
208     /**
209      * Gets the used storage space on the logical storage volume
210      *
211      * @param deviceIndex - the index of the logical volume
212      * @return storage size in MB
213      * @throws DeviceNotFoundException
214      */
215     public DecimalType getStorageUsed(int deviceIndex) throws DeviceNotFoundException;
216
217     /**
218      * Gets the percent of available storage on the logical volume
219      *
220      * @param deviceIndex - the index of the logical volume
221      * @return percent of available storage or null
222      * @throws DeviceNotFoundException
223      */
224     public @Nullable DecimalType getStorageAvailablePercent(int deviceIndex) throws DeviceNotFoundException;
225
226     /**
227      * Gets the percent of used storage on the logical volume
228      *
229      * @param deviceIndex - the index of the logical volume
230      * @return percent of used storage or null
231      * @throws DeviceNotFoundException
232      */
233     public @Nullable DecimalType getStorageUsedPercent(int deviceIndex) throws DeviceNotFoundException;
234
235     /**
236      * Gets the name of the logical storage volume
237      *
238      * @throws DeviceNotFoundException
239      */
240     public StringType getStorageName(int deviceIndex) throws DeviceNotFoundException;
241
242     /**
243      * Gets the type of the logical storage volume (e.g. NTFS, FAT32)
244      *
245      * @throws DeviceNotFoundException
246      */
247     public StringType getStorageType(int deviceIndex) throws DeviceNotFoundException;
248
249     /**
250      * Gets the description of the logical storage volume
251      *
252      * @throws DeviceNotFoundException
253      */
254     public StringType getStorageDescription(int deviceIndex) throws DeviceNotFoundException;
255
256     // Hardware drive info
257     /**
258      * Gets the name of the physical storage drive
259      *
260      * @param deviceIndex - index of the storage drive
261      * @throws DeviceNotFoundException
262      */
263     public StringType getDriveName(int deviceIndex) throws DeviceNotFoundException;
264
265     /**
266      * Gets the model of the physical storage drive
267      *
268      * @param deviceIndex - index of the storage drive
269      * @throws DeviceNotFoundException
270      */
271     public StringType getDriveModel(int deviceIndex) throws DeviceNotFoundException;
272
273     /**
274      * Gets the serial number of the physical storage drive
275      *
276      * @param deviceIndex - index of the storage drive
277      * @throws DeviceNotFoundException
278      */
279     public StringType getDriveSerialNumber(int deviceIndex) throws DeviceNotFoundException;
280
281     // Network info
282     /**
283      * Get the Host IP address of the network.
284      *
285      * @param networkIndex - the index of the network
286      * @return 32-bit IPv4 address
287      * @throws DeviceNotFoundException
288      */
289     public StringType getNetworkIp(int networkIndex) throws DeviceNotFoundException;
290
291     /**
292      * Get the name of this network.
293      *
294      * @param networkIndex - the index of the network
295      * @throws DeviceNotFoundException
296      */
297     public StringType getNetworkName(int networkIndex) throws DeviceNotFoundException;
298
299     /**
300      * The description of the network. On some platforms, this is identical to the name.
301      *
302      * @param networkIndex - the index of the network
303      * @throws DeviceNotFoundException
304      */
305     public StringType getNetworkDisplayName(int networkIndex) throws DeviceNotFoundException;
306
307     /**
308      * Gets the MAC Address of the network.
309      *
310      * @param networkIndex - the index of the network
311      * @throws DeviceNotFoundException
312      */
313     public StringType getNetworkMac(int networkIndex) throws DeviceNotFoundException;
314
315     /**
316      * Get number of packets received
317      *
318      * @param networkIndex - the index of the network
319      * @throws DeviceNotFoundException
320      */
321     public DecimalType getNetworkPacketsReceived(int networkIndex) throws DeviceNotFoundException;
322
323     /**
324      * Get number of packets sent
325      *
326      * @param networkIndex - the index of the network
327      * @throws DeviceNotFoundException
328      */
329     public DecimalType getNetworkPacketsSent(int networkIndex) throws DeviceNotFoundException;
330
331     /**
332      * Get data sent in MB for this network
333      *
334      * @param networkIndex - the index of the network
335      * @throws DeviceNotFoundException
336      */
337     public DecimalType getNetworkDataSent(int networkIndex) throws DeviceNotFoundException;
338
339     /**
340      * Get data received in MB for this network
341      *
342      * @param networkIndex - the index of the network
343      * @throws DeviceNotFoundException
344      */
345     public DecimalType getNetworkDataReceived(int networkIndex) throws DeviceNotFoundException;
346
347     // Display info
348     /**
349      * Get information about the display device as product number, manufacturer, serial number, width and height in cm";
350      *
351      * @param deviceIndex - the index of the display device
352      * @throws DeviceNotFoundException
353      */
354     public StringType getDisplayInformation(int deviceIndex) throws DeviceNotFoundException;
355
356     // Sensors info
357     /**
358      * Get the information from the CPU temperature sensors.
359      *
360      * @return Temperature in degrees Celsius if available, null otherwise.
361      */
362     public @Nullable DecimalType getSensorsCpuTemperature();
363
364     /**
365      * Get the information for the CPU voltage.
366      *
367      * @return Voltage in Volts if available, null otherwise.
368      */
369     public @Nullable DecimalType getSensorsCpuVoltage();
370
371     /**
372      * Get fan speed
373      *
374      * @param deviceIndex
375      * @return Speed in rpm or null if unable to measure fan speed
376      * @throws DeviceNotFoundException
377      */
378     public @Nullable DecimalType getSensorsFanSpeed(int deviceIndex) throws DeviceNotFoundException;
379
380     // Battery info
381     /**
382      * Get estimated time remaining for the power source.
383      *
384      * @param deviceIndex
385      * @return minutes remaining charge or null, if the time is estimated as unlimited
386      * @throws DeviceNotFoundException
387      */
388     public @Nullable DecimalType getBatteryRemainingTime(int deviceIndex) throws DeviceNotFoundException;
389
390     /**
391      * Battery remaining capacity.
392      *
393      * @param deviceIndex
394      * @return percentage value /0-100/
395      * @throws DeviceNotFoundException
396      */
397     public DecimalType getBatteryRemainingCapacity(int deviceIndex) throws DeviceNotFoundException;
398
399     /**
400      * Get battery name
401      *
402      * @param deviceIndex
403      * @throws DeviceNotFoundException
404      */
405     public StringType getBatteryName(int deviceIndex) throws DeviceNotFoundException;
406
407     /**
408      * Returns the name of the process
409      *
410      * @param pid - the PID of the process
411      * @throws DeviceNotFoundException - thrown if process with this PID can not be found
412      */
413     public @Nullable StringType getProcessName(int pid) throws DeviceNotFoundException;
414
415     /**
416      * Returns the CPU usage of the process
417      *
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
421      */
422     public @Nullable PercentType getProcessCpuUsage(int pid) throws DeviceNotFoundException;
423
424     /**
425      * Returns the size of RAM memory only usage of the process
426      *
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
430      */
431     public @Nullable DecimalType getProcessMemoryUsage(int pid) throws DeviceNotFoundException;
432
433     /**
434      * Returns the full path of the executing process.
435      *
436      * @param pid - the PID of the process
437      * @throws DeviceNotFoundException - thrown if process with this PID can not be found
438      */
439     public @Nullable StringType getProcessPath(int pid) throws DeviceNotFoundException;
440
441     /**
442      * Returns the number of threads in this process.
443      *
444      * @param pid - the PID of the process
445      * @throws DeviceNotFoundException - thrown if process with this PID can not be found
446      */
447     public @Nullable DecimalType getProcessThreads(int pid) throws DeviceNotFoundException;
448 }