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 - 2019 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_Unknown, 060 //------------------------ 061 // (LEMAKER BANANAPI) 062 BananaPi, 063 BananaPro, 064 //------------------------ 065 // (SINOVOIP BANANAPI) (see: https://github.com/BPI-SINOVOIP/WiringPi/blob/master/wiringPi/wiringPi_bpi.c#L1318) 066 Bpi_M1, 067 Bpi_M1P, 068 Bpi_M2, 069 Bpi_M2P, 070 Bpi_M2P_H2_Plus, 071 Bpi_M2P_H5, 072 Bpi_M2U, 073 Bpi_M2U_V40, 074 Bpi_M2M, 075 Bpi_M3, 076 Bpi_R1, 077 Bpi_M64, 078 //------------------------ 079 Odroid, 080 //------------------------ 081 OrangePi, 082 //------------------------ 083 NanoPi_M1, 084 NanoPi_M1_Plus, 085 NanoPi_M3, 086 NanoPi_NEO, 087 NanoPi_NEO2, 088 NanoPi_NEO2_Plus, 089 NanoPi_NEO_Air, 090 NanoPi_S2, 091 NanoPi_A64, 092 NanoPi_K2 093 //------------------------ 094 } 095 096 public static String getProcessor() throws IOException, InterruptedException, UnsupportedOperationException { 097 return SystemInfoFactory.getProvider().getProcessor(); 098 } 099 100 public static String getModelName() throws IOException, InterruptedException, UnsupportedOperationException { 101 return SystemInfoFactory.getProvider().getModelName(); 102 } 103 104 public static String getBogoMIPS() throws IOException, InterruptedException, UnsupportedOperationException { 105 return SystemInfoFactory.getProvider().getBogoMIPS(); 106 } 107 108 public static String[] getCpuFeatures() throws IOException, InterruptedException, UnsupportedOperationException { 109 return SystemInfoFactory.getProvider().getCpuFeatures(); 110 } 111 112 public static String getCpuImplementer() throws IOException, InterruptedException, UnsupportedOperationException { 113 return SystemInfoFactory.getProvider().getCpuImplementer(); 114 } 115 116 public static String getCpuArchitecture() throws IOException, InterruptedException, UnsupportedOperationException { 117 return SystemInfoFactory.getProvider().getCpuArchitecture(); 118 } 119 120 public static String getCpuVariant() throws IOException, InterruptedException, UnsupportedOperationException { 121 return SystemInfoFactory.getProvider().getCpuVariant(); 122 } 123 124 public static String getCpuPart() throws IOException, InterruptedException, UnsupportedOperationException { 125 return SystemInfoFactory.getProvider().getCpuPart(); 126 } 127 128 public static String getCpuRevision() throws IOException, InterruptedException, UnsupportedOperationException { 129 return SystemInfoFactory.getProvider().getCpuRevision(); 130 } 131 132 public static String getHardware() throws IOException, InterruptedException, UnsupportedOperationException { 133 return SystemInfoFactory.getProvider().getHardware(); 134 } 135 136 public static String getRevision() throws IOException, InterruptedException, UnsupportedOperationException { 137 return SystemInfoFactory.getProvider().getRevision(); 138 } 139 140 public static String getSerial() throws IOException, InterruptedException, UnsupportedOperationException { 141 return SystemInfoFactory.getProvider().getSerial(); 142 } 143 144 public static String getOsName() throws UnsupportedOperationException { 145 return SystemInfoFactory.getProvider().getOsName(); 146 } 147 148 public static String getOsVersion() throws UnsupportedOperationException { 149 return SystemInfoFactory.getProvider().getOsVersion(); 150 } 151 152 public static String getOsArch() throws UnsupportedOperationException { 153 return SystemInfoFactory.getProvider().getOsArch(); 154 } 155 156 public static String getOsFirmwareBuild() throws IOException, InterruptedException, UnsupportedOperationException { 157 return SystemInfoFactory.getProvider().getOsFirmwareBuild(); 158 } 159 160 public static String getOsFirmwareDate() throws IOException, InterruptedException, ParseException, UnsupportedOperationException { 161 return SystemInfoFactory.getProvider().getOsFirmwareDate(); 162 } 163 164 public static String getJavaVendor() throws UnsupportedOperationException { 165 return SystemInfoFactory.getProvider().getJavaVendor(); 166 } 167 168 public static String getJavaVendorUrl() throws UnsupportedOperationException { 169 return SystemInfoFactory.getProvider().getJavaVendorUrl(); 170 } 171 172 public static String getJavaVersion() throws UnsupportedOperationException { 173 return SystemInfoFactory.getProvider().getJavaVersion(); 174 } 175 176 public static String getJavaVirtualMachine() throws UnsupportedOperationException { 177 return SystemInfoFactory.getProvider().getJavaVirtualMachine(); 178 } 179 180 public static String getJavaRuntime() throws UnsupportedOperationException { 181 return SystemInfoFactory.getProvider().getJavaRuntime(); 182 } 183 184 public static boolean isHardFloatAbi() throws UnsupportedOperationException { 185 return SystemInfoFactory.getProvider().isHardFloatAbi(); 186 } 187 188 public static long getMemoryTotal() throws IOException, InterruptedException, UnsupportedOperationException { 189 return SystemInfoFactory.getProvider().getMemoryTotal(); 190 } 191 192 public static long getMemoryUsed() throws IOException, InterruptedException, UnsupportedOperationException { 193 return SystemInfoFactory.getProvider().getMemoryUsed(); 194 } 195 196 public static long getMemoryFree() throws IOException, InterruptedException, UnsupportedOperationException { 197 return SystemInfoFactory.getProvider().getMemoryFree(); 198 } 199 200 public static long getMemoryShared() throws IOException, InterruptedException, UnsupportedOperationException { 201 return SystemInfoFactory.getProvider().getMemoryShared(); 202 } 203 204 public static long getMemoryBuffers() throws IOException, InterruptedException, UnsupportedOperationException { 205 return SystemInfoFactory.getProvider().getMemoryBuffers(); 206 } 207 208 public static long getMemoryCached() throws IOException, InterruptedException, UnsupportedOperationException { 209 return SystemInfoFactory.getProvider().getMemoryCached(); 210 } 211 212 public static BoardType getBoardType() throws IOException, InterruptedException, UnsupportedOperationException 213 { 214 return SystemInfoFactory.getProvider().getBoardType(); 215 } 216 217 public static float getCpuTemperature() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException { 218 return SystemInfoFactory.getProvider().getCpuTemperature(); 219 } 220 221 public static float getCpuVoltage() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException { 222 return SystemInfoFactory.getProvider().getCpuVoltage(); 223 } 224 225 public static float getMemoryVoltageSDRam_C() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException { 226 return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_C(); 227 } 228 229 public static float getMemoryVoltageSDRam_I() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException { 230 return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_I(); 231 } 232 233 public static float getMemoryVoltageSDRam_P() throws IOException, InterruptedException, NumberFormatException, UnsupportedOperationException { 234 return SystemInfoFactory.getProvider().getMemoryVoltageSDRam_P(); 235 } 236 237 public static boolean getCodecH264Enabled() throws IOException, InterruptedException, UnsupportedOperationException { 238 return SystemInfoFactory.getProvider().getCodecH264Enabled(); 239 } 240 241 public static boolean getCodecMPG2Enabled() throws IOException, InterruptedException, UnsupportedOperationException { 242 return SystemInfoFactory.getProvider().getCodecMPG2Enabled(); 243 } 244 245 public static boolean getCodecWVC1Enabled() throws IOException, InterruptedException, UnsupportedOperationException { 246 return SystemInfoFactory.getProvider().getCodecWVC1Enabled(); 247 } 248 249 public static long getClockFrequencyArm() throws IOException, InterruptedException, UnsupportedOperationException { 250 return SystemInfoFactory.getProvider().getClockFrequencyArm(); 251 } 252 253 public static long getClockFrequencyCore() throws IOException, InterruptedException, UnsupportedOperationException { 254 return SystemInfoFactory.getProvider().getClockFrequencyCore(); 255 } 256 257 public static long getClockFrequencyH264() throws IOException, InterruptedException, UnsupportedOperationException { 258 return SystemInfoFactory.getProvider().getClockFrequencyH264(); 259 } 260 261 public static long getClockFrequencyISP() throws IOException, InterruptedException, UnsupportedOperationException { 262 return SystemInfoFactory.getProvider().getClockFrequencyISP(); 263 } 264 265 public static long getClockFrequencyV3D() throws IOException, InterruptedException, UnsupportedOperationException { 266 return SystemInfoFactory.getProvider().getClockFrequencyV3D(); 267 } 268 269 public static long getClockFrequencyUART() throws IOException, InterruptedException, UnsupportedOperationException { 270 return SystemInfoFactory.getProvider().getClockFrequencyUART(); 271 } 272 273 public static long getClockFrequencyPWM() throws IOException, InterruptedException, UnsupportedOperationException { 274 return SystemInfoFactory.getProvider().getClockFrequencyPWM(); 275 } 276 277 public static long getClockFrequencyEMMC() throws IOException, InterruptedException, UnsupportedOperationException { 278 return SystemInfoFactory.getProvider().getClockFrequencyEMMC(); 279 } 280 281 public static long getClockFrequencyPixel() throws IOException, InterruptedException, UnsupportedOperationException { 282 return SystemInfoFactory.getProvider().getClockFrequencyPixel(); 283 } 284 285 public static long getClockFrequencyVEC() throws IOException, InterruptedException, UnsupportedOperationException { 286 return SystemInfoFactory.getProvider().getClockFrequencyVEC(); 287 } 288 289 public static long getClockFrequencyHDMI() throws IOException, InterruptedException, UnsupportedOperationException { 290 return SystemInfoFactory.getProvider().getClockFrequencyHDMI(); 291 } 292 293 public static long getClockFrequencyDPI() throws IOException, InterruptedException, UnsupportedOperationException { 294 return SystemInfoFactory.getProvider().getClockFrequencyDPI(); 295 } 296}