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:  http://www.pi4j.com/
012 * **********************************************************************
013 * %%
014 * Copyright (C) 2012 - 2016 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_Zero,
055        RaspberryPi_Alpha,
056        RaspberryPi_Unknown,
057        //------------------------
058        BananaPi,
059        BananaPro,
060        //------------------------
061        Odroid
062    }
063
064    public static String getProcessor()  throws IOException, InterruptedException, UnsupportedOperationException {
065        return SystemInfoFactory.getProvider().getProcessor();
066    }
067
068    public static String getModelName() throws IOException, InterruptedException, UnsupportedOperationException {
069        return SystemInfoFactory.getProvider().getModelName();
070    }
071
072    public static String getBogoMIPS() throws IOException, InterruptedException, UnsupportedOperationException {
073        return SystemInfoFactory.getProvider().getBogoMIPS();
074    }
075
076    public static String[] getCpuFeatures() throws IOException, InterruptedException, UnsupportedOperationException {
077        return SystemInfoFactory.getProvider().getCpuFeatures();
078    }
079
080    public static String getCpuImplementer() throws IOException, InterruptedException, UnsupportedOperationException {
081        return SystemInfoFactory.getProvider().getCpuImplementer();
082    }
083
084    public static String getCpuArchitecture() throws IOException, InterruptedException, UnsupportedOperationException {
085        return SystemInfoFactory.getProvider().getCpuArchitecture();
086    }
087
088    public static String getCpuVariant() throws IOException, InterruptedException, UnsupportedOperationException {
089        return SystemInfoFactory.getProvider().getCpuVariant();
090    }
091
092    public static String getCpuPart() throws IOException, InterruptedException, UnsupportedOperationException {
093        return SystemInfoFactory.getProvider().getCpuPart();
094    }
095
096    public static String getCpuRevision() throws IOException, InterruptedException, UnsupportedOperationException {
097        return SystemInfoFactory.getProvider().getCpuRevision();
098    }
099
100    public static String getHardware() throws IOException, InterruptedException, UnsupportedOperationException {
101        return SystemInfoFactory.getProvider().getHardware();
102    }
103
104    public static String getRevision() throws IOException, InterruptedException, UnsupportedOperationException {
105        return SystemInfoFactory.getProvider().getRevision();
106    }
107
108    public static String getSerial() throws IOException, InterruptedException, UnsupportedOperationException {
109        return SystemInfoFactory.getProvider().getSerial();
110    }
111
112    public static String getOsName() throws UnsupportedOperationException {
113        return SystemInfoFactory.getProvider().getOsName();
114    }
115
116    public static String getOsVersion() throws UnsupportedOperationException {
117        return SystemInfoFactory.getProvider().getOsVersion();
118    }
119
120    public static String getOsArch() throws UnsupportedOperationException  {
121        return SystemInfoFactory.getProvider().getOsArch();
122    }
123
124    public static String getOsFirmwareBuild() throws IOException, InterruptedException, UnsupportedOperationException {
125        return SystemInfoFactory.getProvider().getOsFirmwareBuild();
126    }
127
128    public static String getOsFirmwareDate() throws IOException, InterruptedException, ParseException, UnsupportedOperationException {
129        return SystemInfoFactory.getProvider().getOsFirmwareDate();
130    }
131
132    public static String getJavaVendor() throws UnsupportedOperationException  {
133        return SystemInfoFactory.getProvider().getJavaVendor();
134    }
135
136    public static String getJavaVendorUrl() throws UnsupportedOperationException {
137        return SystemInfoFactory.getProvider().getJavaVendorUrl();
138    }
139
140    public static String getJavaVersion() throws UnsupportedOperationException {
141        return SystemInfoFactory.getProvider().getJavaVersion();
142    }
143
144    public static String getJavaVirtualMachine() throws UnsupportedOperationException {
145        return SystemInfoFactory.getProvider().getJavaVirtualMachine();
146    }
147
148    public static String getJavaRuntime() throws UnsupportedOperationException {
149        return SystemInfoFactory.getProvider().getJavaRuntime();
150    }
151
152    public static boolean isHardFloatAbi() throws UnsupportedOperationException {
153        return SystemInfoFactory.getProvider().isHardFloatAbi();
154    }
155
156    public static long getMemoryTotal() throws IOException, InterruptedException, UnsupportedOperationException {
157        return SystemInfoFactory.getProvider().getMemoryTotal();
158    }
159
160    public static long getMemoryUsed() throws IOException, InterruptedException, UnsupportedOperationException {
161        return SystemInfoFactory.getProvider().getMemoryUsed();
162    }
163
164    public static long getMemoryFree() throws IOException, InterruptedException, UnsupportedOperationException {
165        return SystemInfoFactory.getProvider().getMemoryFree();
166    }
167
168    public static long getMemoryShared() throws IOException, InterruptedException, UnsupportedOperationException {
169        return SystemInfoFactory.getProvider().getMemoryShared();
170    }
171
172    public static long getMemoryBuffers() throws IOException, InterruptedException, UnsupportedOperationException {
173        return SystemInfoFactory.getProvider().getMemoryBuffers();
174    }
175
176    public static long getMemoryCached() throws IOException, InterruptedException, UnsupportedOperationException {
177        return SystemInfoFactory.getProvider().getMemoryCached();
178    }
179
180    public static BoardType getBoardType() throws IOException, InterruptedException, UnsupportedOperationException
181    {
182        return SystemInfoFactory.getProvider().getBoardType();
183    }
184
185    public static float getCpuTemperature() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
186        return SystemInfoFactory.getProvider().getCpuTemperature();
187    }
188
189    public static float getCpuVoltage() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
190        return SystemInfoFactory.getProvider().getCpuVoltage();
191    }
192
193    public static float getMemoryVoltageSDRam_C() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
194        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_C();
195    }
196
197    public static float getMemoryVoltageSDRam_I() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
198        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_I();
199    }
200
201    public static float getMemoryVoltageSDRam_P() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException {
202        return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_P();
203    }
204
205    public static boolean getCodecH264Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
206        return SystemInfoFactory.getProvider().getCodecH264Enabled();
207    }
208
209    public static boolean getCodecMPG2Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
210        return SystemInfoFactory.getProvider().getCodecMPG2Enabled();
211    }
212
213    public static boolean getCodecWVC1Enabled() throws IOException, InterruptedException, UnsupportedOperationException {
214        return SystemInfoFactory.getProvider().getCodecWVC1Enabled();
215    }
216
217    public static long getClockFrequencyArm() throws IOException, InterruptedException, UnsupportedOperationException {
218        return SystemInfoFactory.getProvider().getClockFrequencyArm();
219    }
220
221    public static long getClockFrequencyCore() throws IOException, InterruptedException, UnsupportedOperationException {
222        return SystemInfoFactory.getProvider().getClockFrequencyCore();
223    }
224
225    public static long getClockFrequencyH264() throws IOException, InterruptedException, UnsupportedOperationException {
226        return SystemInfoFactory.getProvider().getClockFrequencyH264();
227    }
228
229    public static long getClockFrequencyISP() throws IOException, InterruptedException, UnsupportedOperationException {
230        return SystemInfoFactory.getProvider().getClockFrequencyISP();
231    }
232
233    public static long getClockFrequencyV3D() throws IOException, InterruptedException, UnsupportedOperationException {
234        return SystemInfoFactory.getProvider().getClockFrequencyV3D();
235    }
236
237    public static long getClockFrequencyUART() throws IOException, InterruptedException, UnsupportedOperationException {
238        return SystemInfoFactory.getProvider().getClockFrequencyUART();
239    }
240
241    public static long getClockFrequencyPWM() throws IOException, InterruptedException, UnsupportedOperationException {
242        return SystemInfoFactory.getProvider().getClockFrequencyPWM();
243    }
244
245    public static long getClockFrequencyEMMC() throws IOException, InterruptedException, UnsupportedOperationException {
246        return SystemInfoFactory.getProvider().getClockFrequencyEMMC();
247    }
248
249    public static long getClockFrequencyPixel() throws IOException, InterruptedException, UnsupportedOperationException {
250        return SystemInfoFactory.getProvider().getClockFrequencyPixel();
251    }
252
253    public static long getClockFrequencyVEC() throws IOException, InterruptedException, UnsupportedOperationException {
254        return SystemInfoFactory.getProvider().getClockFrequencyVEC();
255    }
256
257    public static long getClockFrequencyHDMI() throws IOException, InterruptedException, UnsupportedOperationException {
258        return SystemInfoFactory.getProvider().getClockFrequencyHDMI();
259    }
260
261    public static long getClockFrequencyDPI() throws IOException, InterruptedException, UnsupportedOperationException {
262        return SystemInfoFactory.getProvider().getClockFrequencyDPI();
263    }
264}