Commit fe388104 by pye52

现在通过Build.MODEL来判断机型,而非Build.DEVICE

parent bdf84ee9
......@@ -4,15 +4,15 @@ import android.os.Build;
public class QRCodeScanFactory {
private static final String TPS = "TPS";
private static final String T3 = "56iqDS";
private static final String QUAD = "QUAD";
private static final String TPS_PORT = "/dev/ttyS0";
private static final String T3_PORT = "/dev/ttyS6";
private static final String QUAD_PORT = "/dev/ttyS6";
public static IQRCodeScan create() throws Exception {
if (Build.DEVICE.contains(TPS)) {
if (Build.MODEL.contains(TPS)) {
return new TPS(TPS_PORT);
} else if (Build.DEVICE.contains(T3)) {
return new T3(T3_PORT);
} else if (Build.DEVICE.contains(QUAD)) {
return new QUAD(QUAD_PORT);
} else {
throw new RuntimeException("不明设备型号: " + Build.DEVICE);
}
......
......@@ -2,10 +2,10 @@ package com.bgycc.smartcanteen.qrcode;
import android_serialport_api.SerialPort;
public class T3 extends BaseQRCodeScan {
public class QUAD extends BaseQRCodeScan {
private SerialPort serial;
public T3(String filePath) throws Exception {
public QUAD(String filePath) throws Exception {
serial = new SerialPort(filePath, 115200, 0);
setup(serial.getInputStream());
}
......
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 sign in to comment