001package com.pi4j.system;
002
003/*
004 * #%L
005 * **********************************************************************
006 * ORGANIZATION  :  Pi4J
007 * PROJECT       :  Pi4J :: Java Library (Core)
008 * FILENAME      :  SystemInfo.java
009 *
010 * This file is part of the Pi4J project. More information about
011 * this project can be found here:  https://www.pi4j.com/
012 * **********************************************************************
013 * %%
014 * Copyright (C) 2012 - 2021 Pi4J
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Lesser General Public License as
018 * published by the Free Software Foundation, either version 3 of the
019 * License, or (at your option) any later version.
020 *
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Lesser Public License for more details.
025 *
026 * You should have received a copy of the GNU General Lesser Public
027 * License along with this program.  If not, see
028 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
029 * #L%
030 */
031
032
033import java.io.IOException;
034import java.text.ParseException;
035
036public class SystemInfo {
037
038    // private constructor
039    private SystemInfo() {
040        // forbid object construction
041    }
042
043    public enum BoardType {
044        UNKNOWN,
045        //------------------------
046        RaspberryPi_A,
047        RaspberryPi_B_Rev1,
048        RaspberryPi_B_Rev2,
049        RaspberryPi_A_Plus,
050        RaspberryPi_B_Plus,
051        RaspberryPi_ComputeModule,
052        RaspberryPi_2B,
053        RaspberryPi_3B,
054        RaspberryPi_3B_Plus,
055        RaspberryPi_Zero,
056        RaspberryPi_ComputeModule3,
057        RaspberryPi_ZeroW,
058        RaspberryPi_Alpha,
059        RaspberryPi_3A_Plus,
060        RaspberryPi_ComputeModule3_Plus,
061        RaspberryPi_4B,
062        RaspberryPi_400,
063        RaspberryPi_ComputeModule4,
064        RaspberryPi_Unknown,
065        //------------------------
066        // (LEMAKER BANANAPI)
067        BananaPi,
068        BananaPro,
069        //------------------------
070        // (SINOVOIP BANANAPI)  (see: https://github.com/BPI-SINOVOIP/WiringPi/blob/master/wiringPi/wiringPi_bpi.c#L1318)
071        Bpi_M1,
072        Bpi_M1P,
073        Bpi_M2,
074        Bpi_M2P,
075        Bpi_M2P_H2_Plus,
076        Bpi_M2P_H5,
077        Bpi_M2U,
078        Bpi_M2U_V40,
079        Bpi_M2M,
080        Bpi_M3,
081        Bpi_R1,
082        Bpi_M64,
083        //------------------------
084        Odroid,
085        //------------------------
086        OrangePi,
087        //------------------------
088        NanoPi_M1,
089        NanoPi_M1_Plus,
090        NanoPi_M3,
091        NanoPi_NEO,
092        NanoPi_NEO2,
093        NanoPi_NEO2_Plus,
094        NanoPi_NEO_Air,
095        NanoPi_S2,
096        NanoPi_A64,
097        NanoPi_K2
098        //------------------------
099    }
100
101    public static String getProcessor()  throws IOException, InterruptedException, UnsupportedOperationException {
102        return SystemInfoFactory.getProvider().getProcessor();
103    }
104
105    public static String getModelName() throws IOException, InterruptedException, UnsupportedOperationException {
106        return SystemInfoFactory.getProvider().getModelName();
107    }
108
109    public static String getBogoMIPS() throws IOException, InterruptedException, UnsupportedOperationException {
110        return SystemInfoFactory.getProvider().getBogoMIPS();
111    }
112
113    public static String[] getCpuFeatures() throws IOException, InterruptedException, UnsupportedOperationException {
114        return SystemInfoFactory.getProvider().getCpuFeatures();
115    }
116
117    public static String getCpuImplementer() throws IOException, InterruptedException, UnsupportedOperationException {
118        return SystemInfoFactory.getProvider().getCpuImplementer();
119    }
120
121    public static String getCpuArchitecture() throws IOException, InterruptedException, UnsupportedOperationException {
122        return SystemInfoFactory.getProvider().getCpuArchitecture();
123    }
124
125    public static String getCpuVariant() throws IOException, InterruptedException, UnsupportedOperationException {
126        return SystemInfoFactory.getProvider().getCpuVariant();
127    }
128
129    public static String getCpuPart() throws IOException, InterruptedException, UnsupportedOperationException {
130        return SystemInfoFactory.getProvider().getCpuPart();
131    }
132
133    public static String getCpuRevision() throws IOException, InterruptedException, UnsupportedOperationException {
134        return SystemInfoFactory.getProvider().getCpuRevision();
135    }
136
137    public static String getHardware() throws IOException, InterruptedException, UnsupportedOperationException {
138        return SystemInfoFactory.getProvider().getHardware();
139    }
140
141    public static String getRevision() throws IOException, InterruptedException, UnsupportedOperationException {
142        return SystemInfoFactory.getProvider().getRevision();
143    }
144
145    public static String getSerial() throws IOException, InterruptedException, UnsupportedOperationException {
146        return SystemInfoFactory.getProvider().getSerial();
147    }
148
149    public static String getOsName() throws UnsupportedOperationException {
150        return SystemInfoFactory.getProvider().getOsName();
151    }
152
153    public static String getOsVersion() throws UnsupportedOperationException {
154        return SystemInfoFactory.getProvider().getOsVersion();
155    }
156
157    public static String getOsArch() throws UnsupportedOperationException  {
158        return SystemInfoFactory.getProvider().getOsArch();
159    }
160
161    public static String getOsFirmwareBuild() throws IOException, InterruptedException, UnsupportedOperationException {
162        return SystemInfoFactory.getProvider().getOsFirmwareBuild();
163    }
164
165    public static String getOsFirmwareDate() throws IOException, InterruptedException, ParseException, UnsupportedOperationException {
166        return SystemInfoFactory.getProvider().getOsFirmwareDate();
167    }
168
169    public static String getJavaVendor() throws UnsupportedOperationException  {
170        return SystemInfoFactory.getProvider().getJavaVendor();
171    }
172
173    public static String getJavaVendorUrl() throws UnsupportedOperationException {
174        return SystemInfoFactory.getProvider().getJavaVendorUrl();
175    }
176
177    public static String getJavaVersion() throws UnsupportedOperationException {
178        return SystemInfoFactory.getProvider().getJavaVersion();
179    }
180
181    public static String getJavaVirtualMachine() throws UnsupportedOperationException {
182        return SystemInfoFactory.getProvider().getJavaVirtualMachine();
183    }
184
185    public static String getJavaRuntime() throws UnsupportedOperationException {
186        return SystemInfoFactory.getProvider().getJavaRuntime();
187    }
188
189    public static boolean isHardFloatAbi() throws UnsupportedOperationException {
190        return SystemInfoFactory.getProvider().isHardFloatAbi();
191    }
192
193    public static long getMemoryTotal() throws IOException, InterruptedException, UnsupportedOperationException {
194        return SystemInfoFactory.getProvider().getMemoryTotal();
195    }
196
197    public static long getMemoryUsed() throws IOException, InterruptedException, UnsupportedOperationException {
198        return SystemInfoFactory.getProvider().getMemoryUsed();
199    }
200
201    public static long getMemoryFree() throws IOException, InterruptedException, UnsupportedOperationException {
202        return SystemInfoFactory.getProvider().getMemoryFree();
203    }
204
205    public static long getMemoryShared() throws IOException, InterruptedException, UnsupportedOperationException {
206        return SystemInfoFactory.getProvider().getMemoryShared();
207    }
208
209    public static long getMemoryBuffers() throws IOException, InterruptedException, UnsupportedOperationException {
210        return SystemInfoFactory.getProvider().getMemoryBuffers();
211    }
212
213    public static long getMemoryCached() throws IOException, InterruptedException, UnsupportedOperationException {
214        return SystemInfoFactory.getProvider().getMemoryCached();
215    }
216
217    public static BoardType getBoardType() throws IOException, InterruptedException, UnsupportedOperationException
218    {
219        return SystemInfoFactory.getProvider().getBoardType();
220    }
221
222    public static float getCpuTemperature() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
223        return SystemInfoFactory.getProvider().getCpuTemperature();
224    }
225
226    public static float getCpuVoltage() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
227        return SystemInfoFactory.getProvider().getCpuVoltage();
228    }
229
230    public static float getMemoryVoltageSDRam_C() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
231        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_C();
232    }
233
234    public static float getMemoryVoltageSDRam_I() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
235        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_I();
236    }
237
238    public static float getMemoryVoltageSDRam_P() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
239        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_P();
240    }
241
242    public static boolean getCodecH264Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
243        return SystemInfoFactory.getProvider().getCodecH264Enabled();
244    }
245
246    public static boolean getCodecMPG2Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
247        return SystemInfoFactory.getProvider().getCodecMPG2Enabled();
248    }
249
250    public static boolean getCodecWVC1Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
251        return SystemInfoFactory.getProvider().getCodecWVC1Enabled();
252    }
253
254    public static long getClockFrequencyArm() throws IOException, InterruptedException, UnsupportedOperationException {
255        return SystemInfoFactory.getProvider().getClockFrequencyArm();
256    }
257
258    public static long getClockFrequencyCore() throws IOException, InterruptedException, UnsupportedOperationException {
259        return SystemInfoFactory.getProvider().getClockFrequencyCore();
260    }
261
262    public static long getClockFrequencyH264() throws IOException, InterruptedException, UnsupportedOperationException {
263        return SystemInfoFactory.getProvider().getClockFrequencyH264();
264    }
265
266    public static long getClockFrequencyISP() throws IOException, InterruptedException, UnsupportedOperationException {
267        return SystemInfoFactory.getProvider().getClockFrequencyISP();
268    }
269
270    public static long getClockFrequencyV3D() throws IOException, InterruptedException, UnsupportedOperationException {
271        return SystemInfoFactory.getProvider().getClockFrequencyV3D();
272    }
273
274    public static long getClockFrequencyUART() throws IOException, InterruptedException, UnsupportedOperationException {
275        return SystemInfoFactory.getProvider().getClockFrequencyUART();
276    }
277
278    public static long getClockFrequencyPWM() throws IOException, InterruptedException, UnsupportedOperationException {
279        return SystemInfoFactory.getProvider().getClockFrequencyPWM();
280    }
281
282    public static long getClockFrequencyEMMC() throws IOException, InterruptedException, UnsupportedOperationException {
283        return SystemInfoFactory.getProvider().getClockFrequencyEMMC();
284    }
285
286    public static long getClockFrequencyPixel() throws IOException, InterruptedException, UnsupportedOperationException {
287        return SystemInfoFactory.getProvider().getClockFrequencyPixel();
288    }
289
290    public static long getClockFrequencyVEC() throws IOException, InterruptedException, UnsupportedOperationException {
291        return SystemInfoFactory.getProvider().getClockFrequencyVEC();
292    }
293
294    public static long getClockFrequencyHDMI() throws IOException, InterruptedException, UnsupportedOperationException {
295        return SystemInfoFactory.getProvider().getClockFrequencyHDMI();
296    }
297
298    public static long getClockFrequencyDPI() throws IOException, InterruptedException, UnsupportedOperationException {
299        return SystemInfoFactory.getProvider().getClockFrequencyDPI();
300    }
301}