Commit baed0766 authored by pengguangpu's avatar pengguangpu

暂存

parent b554710c
......@@ -5,27 +5,31 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="5">
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
package com.miya.print;
/**
* 标准打印接口
*
* @author pupu
* @time 2018/12/17
*/
public interface IPrinter {
}
package com.miya.print.utils;
import com.miya.print.BuildConfig;
public class D {
private static final String Tag = "HHVerify";
public static void log(String text) {
if (BuildConfig.DEBUG) {
android.util.Log.v(Tag, "-----:" + text);
}
}
public static void v(String tag, String msg) {
if (BuildConfig.DEBUG) {
android.util.Log.v(tag, msg);
}
}
public static void v(String tag, String msg, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.v(tag, msg, tr);
}
}
public static void d(String tag, String msg) {
if (BuildConfig.DEBUG) {
android.util.Log.d(tag, msg);
}
}
public static void d(String tag, String msg, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.d(tag, msg, tr);
}
}
public static void i(String tag, String msg) {
if (BuildConfig.DEBUG) {
android.util.Log.i(tag, msg);
}
}
public static void i(String tag, String msg, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.i(tag, msg, tr);
}
}
public static void w(String tag, String msg) {
if (BuildConfig.DEBUG) {
android.util.Log.w(tag, msg);
}
}
public static void w(String tag, String msg, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.w(tag, msg, tr);
}
}
public static void w(String tag, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.w(tag, tr);
}
}
public static void e(String tag, String msg) {
if (BuildConfig.DEBUG) {
android.util.Log.e(tag, msg);
}
}
public static void e(String tag, String msg, Throwable tr) {
if (BuildConfig.DEBUG) {
android.util.Log.e(tag, msg, tr);
}
}
}
......@@ -10,7 +10,7 @@ import android.os.RemoteException;
import com.hisense.optionalservice.aidl.OnDataReceiveListener;
import com.hisense.optionalservice.aidl.OptionalApi;
import com.hisense.optionalservice.aidl.UartScale;
import com.miya.utils.D;
import com.miya.weighing.utils.D;
/**
* 海信称重实现子类
......
......@@ -2,8 +2,8 @@ package com.miya.weighing;
import android.content.Context;
import com.miya.utils.CpuUtils;
import com.miya.utils.D;
import com.miya.weighing.utils.CpuUtils;
import com.miya.weighing.utils.D;
import java.util.Timer;
import java.util.TimerTask;
......
package com.miya.weighing.utils;
import android.os.Build;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/**
* cpu相关工具类
*
* @author pupu
* @time 2018/10/24
*/
public class CpuUtils {
private CpuUtils() {
throw new UnsupportedOperationException("不允许外部创建实例");
}
/**
* 获取cpu支持的架构类型
*
* @return 支持的架构字符串
*/
public static List<String> getCpuSupportAbis() {
String[] abis;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
abis = Build.SUPPORTED_ABIS;
} else {
abis = new String[]{Build.CPU_ABI, Build.CPU_ABI2};
}
List<String> list = new ArrayList<>();
for (String tmp : abis) {
list.add(tmp);
}
return list;
}
/**
* 是否是arm架构
*
* @return
*/
public static boolean isArm() {
boolean isArm = false;
for (String tmp : getCpuSupportAbis()) {
if (tmp.contains("armeabi")) {
//是arm架构
isArm = true;
break;
}
}
return isArm;
}
/**
* 是否是x86架构
*
* @return
*/
public static boolean isX86() {
boolean isX86 = false;
for (String tmp : getCpuSupportAbis()) {
if (tmp.contains("x86")) {
isX86 = true;
break;
}
}
return isX86;
}
/**
* [获取cpu类型和架构]
*
* @return 三个参数类型的数组,第一个参数标识是不是ARM架构,第二个参数标识是V6还是V7架构,第三个参数标识是不是neon指令集
*/
public static Object[] getCpuArchitecture() {
Object[] mArmArchitecture = new Object[3];
// if ((Integer) mArmArchitecture[1] != -1) {
// return mArmArchitecture;
// }
try {
InputStream is = new FileInputStream("/proc/cpuinfo");
InputStreamReader ir = new InputStreamReader(is);
BufferedReader br = new BufferedReader(ir);
try {
String nameProcessor = "Processor";
String nameFeatures = "Features";
String nameModel = "model name";
String nameCpuFamily = "cpu family";
while (true) {
String line = br.readLine();
String[] pair = null;
if (line == null) {
break;
}
pair = line.split(":");
if (pair.length != 2)
continue;
String key = pair[0].trim();
String val = pair[1].trim();
if (key.compareTo(nameProcessor) == 0) {
String n = "";
for (int i = val.indexOf("ARMv") + 4; i < val.length(); i++) {
String temp = val.charAt(i) + "";
if (temp.matches("\\d")) {
n += temp;
} else {
break;
}
}
mArmArchitecture[0] = "ARM";
mArmArchitecture[1] = Integer.parseInt(n);
continue;
}
if (key.compareToIgnoreCase(nameFeatures) == 0) {
if (val.contains("neon")) {
mArmArchitecture[2] = "neon";
}
continue;
}
if (key.compareToIgnoreCase(nameModel) == 0) {
if (val.contains("Intel")) {
mArmArchitecture[0] = "INTEL";
mArmArchitecture[2] = "atom";
}
continue;
}
if (key.compareToIgnoreCase(nameCpuFamily) == 0) {
mArmArchitecture[1] = Integer.parseInt(val);
continue;
}
}
} finally {
br.close();
ir.close();
is.close();
}
} catch (Exception e) {
e.printStackTrace();
}
return mArmArchitecture;
}
}
package com.miya.utils;
package com.miya.weighing.utils;
import com.miya.weighing.BuildConfig;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment