Browse Source

首次提交

mq 4 years ago
commit
e674a40720
100 changed files with 5750 additions and 0 deletions
  1. 16 0
      .gitignore
  2. 29 0
      build.gradle
  3. 34 0
      commonLib/build.gradle
  4. BIN
      commonLib/jniLibs(3).rar
  5. BIN
      commonLib/libs/armeabi/libHSMDecoderAPI.so
  6. BIN
      commonLib/libs/armeabi/libfntech_serial.so
  7. BIN
      commonLib/libs/armeabi/libhello-jni.so
  8. BIN
      commonLib/libs/armeabi/libserial_port.so
  9. BIN
      commonLib/libs/armeabi/libserial_port_u7.so
  10. 3 0
      commonLib/lint.xml
  11. 14 0
      commonLib/src/main/AndroidManifest.xml
  12. 87 0
      commonLib/src/main/java/android_serialport_api/SerialPort.java
  13. 122 0
      commonLib/src/main/java/android_serialport_api/SerialPortFinder.java
  14. 8 0
      commonLib/src/main/java/com/AndroidVersions.java
  15. 118 0
      commonLib/src/main/java/com/fntech/Loger.java
  16. 9 0
      commonLib/src/main/java/com/fntech/RInt.java
  17. 42 0
      commonLib/src/main/java/com/fntech/adb/adbUtils.java
  18. 55 0
      commonLib/src/main/java/com/fntech/base/BaseActivity.java
  19. 6 0
      commonLib/src/main/java/com/fntech/io/serial/ByteData.java
  20. 83 0
      commonLib/src/main/java/com/fntech/io/serial/M10_GPIO.java
  21. 94 0
      commonLib/src/main/java/com/fntech/io/serial/SerialPort.java
  22. 116 0
      commonLib/src/main/java/com/fntech/m10/gpio/M10_GPIO.java
  23. 72 0
      commonLib/src/main/java/com/fntech/m10a/gpio/M10A_GPIO.java
  24. 12 0
      commonLib/src/main/java/com/hsm/barcode/CenteringWindow.java
  25. 15 0
      commonLib/src/main/java/com/hsm/barcode/CenteringWindowLimits.java
  26. 25 0
      commonLib/src/main/java/com/hsm/barcode/DecodeResult.java
  27. 606 0
      commonLib/src/main/java/com/hsm/barcode/Decoder.java
  28. 213 0
      commonLib/src/main/java/com/hsm/barcode/DecoderConfigValues.java
  29. 71 0
      commonLib/src/main/java/com/hsm/barcode/ExposureValues.java
  30. 15 0
      commonLib/src/main/java/com/hsm/barcode/IQImagingProperties.java
  31. 13 0
      commonLib/src/main/java/com/hsm/barcode/ImageAttributes.java
  32. 26 0
      commonLib/src/main/java/com/hsm/barcode/ImagerProperties.java
  33. 15 0
      commonLib/src/main/java/com/hsm/barcode/SymbologyConfig.java
  34. 85 0
      commonLib/src/main/java/com/rodinbell/uhf/serialport/SerialPort.java
  35. 122 0
      commonLib/src/main/java/com/rodinbell/uhf/serialport/SerialPortFinder.java
  36. BIN
      commonLib/src/main/res/drawable-hdpi/ic_launcher.png
  37. BIN
      commonLib/src/main/res/drawable-mdpi/ic_launcher.png
  38. BIN
      commonLib/src/main/res/drawable-xhdpi/ic_launcher.png
  39. BIN
      commonLib/src/main/res/drawable/ico_andriod.png
  40. BIN
      commonLib/src/main/res/drawable/ico_home.png
  41. BIN
      commonLib/src/main/res/drawable/ico_menu.png
  42. 8 0
      commonLib/src/main/res/drawable/selector_ico_android.xml
  43. 8 0
      commonLib/src/main/res/drawable/selector_ico_home.xml
  44. 8 0
      commonLib/src/main/res/drawable/selector_ico_menu.xml
  45. 8 0
      commonLib/src/main/res/drawable/shape_ico_android_normal.xml
  46. 8 0
      commonLib/src/main/res/drawable/shape_ico_android_pressed.xml
  47. 8 0
      commonLib/src/main/res/drawable/shape_ico_home_normal.xml
  48. 8 0
      commonLib/src/main/res/drawable/shape_ico_home_pressed.xml
  49. 8 0
      commonLib/src/main/res/drawable/shape_ico_menu_normal.xml
  50. 8 0
      commonLib/src/main/res/drawable/shape_ico_menu_pressed.xml
  51. 45 0
      commonLib/src/main/res/layout/bottom_nav.xml
  52. 8 0
      commonLib/src/main/res/layout/bottom_nav_right_menu.xml
  53. 13 0
      commonLib/src/main/res/layout/bottom_nav_right_menu_item.xml
  54. 11 0
      commonLib/src/main/res/values-v11/styles.xml
  55. 12 0
      commonLib/src/main/res/values-v14/styles.xml
  56. 7 0
      commonLib/src/main/res/values/colors.xml
  57. 4 0
      commonLib/src/main/res/values/strings.xml
  58. 20 0
      commonLib/src/main/res/values/styles.xml
  59. 15 0
      gradle.properties
  60. BIN
      gradle/wrapper/gradle-wrapper.jar
  61. 6 0
      gradle/wrapper/gradle-wrapper.properties
  62. 172 0
      gradlew
  63. 84 0
      gradlew.bat
  64. 1 0
      mylibrary/.gitignore
  65. 52 0
      mylibrary/build.gradle
  66. BIN
      mylibrary/libs/armeabi/libdevapi.so
  67. BIN
      mylibrary/libs/armeabi/libirdaSerialPort.so
  68. 21 0
      mylibrary/proguard-rules.pro
  69. 12 0
      mylibrary/src/main/AndroidManifest.xml
  70. 189 0
      mylibrary/src/main/assets/createSql.sql
  71. 7 0
      mylibrary/src/main/java/cn/pda/rfid/hf/Error.java
  72. 72 0
      mylibrary/src/main/java/cn/pda/rfid/hf/HfConmmand.java
  73. 15 0
      mylibrary/src/main/java/cn/pda/rfid/hf/HfError.java
  74. 570 0
      mylibrary/src/main/java/cn/pda/rfid/hf/HfReader.java
  75. 70 0
      mylibrary/src/main/java/cn/pda/rfid/hf/Iso15693CardInformation.java
  76. 29 0
      mylibrary/src/main/java/cn/pda/rfid/hf/Iso15693InventoryInfo.java
  77. 67 0
      mylibrary/src/main/java/cn/pda/serialport/Main.java
  78. 141 0
      mylibrary/src/main/java/cn/pda/serialport/SerialPort.java
  79. 25 0
      mylibrary/src/main/java/com/mq/mylibrary/CardData.java
  80. 64 0
      mylibrary/src/main/java/com/mq/mylibrary/ChannelTool.java
  81. 112 0
      mylibrary/src/main/java/com/mq/mylibrary/MyDatabaseHelper.java
  82. 206 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseActivity.java
  83. 66 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseApp.java
  84. 42 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseCard.java
  85. 21 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseConstant.java
  86. 294 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseLoginActivity.java
  87. 139 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseNfcActivity.java
  88. 162 0
      mylibrary/src/main/java/com/mq/mylibrary/base/BaseOpenActivity.java
  89. 12 0
      mylibrary/src/main/java/com/mq/mylibrary/base/MyOnTouchListener.java
  90. 138 0
      mylibrary/src/main/java/com/mq/mylibrary/db/BaseDao.java
  91. 33 0
      mylibrary/src/main/java/com/mq/mylibrary/db/BaseEntity.java
  92. 75 0
      mylibrary/src/main/java/com/mq/mylibrary/db/car/CarDao.java
  93. 49 0
      mylibrary/src/main/java/com/mq/mylibrary/db/car/CarEntity.java
  94. 74 0
      mylibrary/src/main/java/com/mq/mylibrary/db/grain_type/GrainTypeDao.java
  95. 49 0
      mylibrary/src/main/java/com/mq/mylibrary/db/grain_type/GrainTypeEntity.java
  96. 91 0
      mylibrary/src/main/java/com/mq/mylibrary/db/load_info/LoadInfoDao.java
  97. 82 0
      mylibrary/src/main/java/com/mq/mylibrary/db/load_info/LoadInfoEntity.java
  98. 93 0
      mylibrary/src/main/java/com/mq/mylibrary/db/sotre/StoreDao.java
  99. 82 0
      mylibrary/src/main/java/com/mq/mylibrary/db/sotre/StoreEntity.java
  100. 0 0
      mylibrary/src/main/java/com/mq/mylibrary/db/team_group/TeamGroupDao.java

+ 16 - 0
.gitignore

@@ -0,0 +1,16 @@
1
+*.iml
2
+*.apk
3
+.gradle
4
+/local.properties
5
+/.idea/caches
6
+/.idea/libraries
7
+/.idea/modules.xml
8
+/.idea/workspace.xml
9
+/.idea/navEditor.xml
10
+/.idea/assetWizardSettings.xml
11
+.DS_Store
12
+/build
13
+/captures
14
+.externalNativeBuild
15
+build/
16
+local.properties

+ 29 - 0
build.gradle

@@ -0,0 +1,29 @@
1
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+buildscript {
4
+    repositories {
5
+        google()
6
+        jcenter()
7
+        
8
+    }
9
+    dependencies {
10
+        classpath 'com.android.tools.build:gradle:3.5.2'
11
+        classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
12
+
13
+        // NOTE: Do not place your application dependencies here; they belong
14
+        // in the individual module build.gradle files
15
+    }
16
+}
17
+
18
+allprojects {
19
+    repositories {
20
+        google()
21
+        jcenter()
22
+        maven { url "https://jitpack.io" }
23
+        maven { url 'https://maven.google.com' }
24
+    }
25
+}
26
+
27
+task clean(type: Delete) {
28
+    delete rootProject.buildDir
29
+}

+ 34 - 0
commonLib/build.gradle

@@ -0,0 +1,34 @@
1
+apply plugin: 'com.android.library'
2
+
3
+android {
4
+    compileSdkVersion 28
5
+
6
+    defaultConfig {
7
+        minSdkVersion 15
8
+//        targetSdkVersion 22
9
+        targetSdkVersion 28
10
+        versionCode 1
11
+        versionName "1.0"
12
+
13
+        ndk{
14
+            abiFilters "armeabi"
15
+        }
16
+
17
+    }
18
+
19
+    buildTypes {
20
+        release {
21
+            minifyEnabled false
22
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
23
+        }
24
+    }
25
+    sourceSets {
26
+        main {
27
+            jniLibs.srcDirs = ['libs']
28
+        }
29
+    }
30
+}
31
+
32
+dependencies {
33
+    implementation 'com.android.support:support-v4:28.0.0'
34
+}

BIN
commonLib/jniLibs(3).rar


BIN
commonLib/libs/armeabi/libHSMDecoderAPI.so


BIN
commonLib/libs/armeabi/libfntech_serial.so


BIN
commonLib/libs/armeabi/libhello-jni.so


BIN
commonLib/libs/armeabi/libserial_port.so


BIN
commonLib/libs/armeabi/libserial_port_u7.so


+ 3 - 0
commonLib/lint.xml

@@ -0,0 +1,3 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<lint>
3
+</lint>

+ 14 - 0
commonLib/src/main/AndroidManifest.xml

@@ -0,0 +1,14 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    package="com.fntech.commonlib"
3
+    android:versionCode="1"
4
+    android:versionName="1.0" >
5
+
6
+    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
7
+   	 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
8
+    <application
9
+        android:allowBackup="true"
10
+        android:label="@string/app_name"
11
+        android:theme="@style/AppTheme" >
12
+    </application>
13
+
14
+</manifest>

+ 87 - 0
commonLib/src/main/java/android_serialport_api/SerialPort.java

@@ -0,0 +1,87 @@
1
+/*
2
+ * Copyright 2009 Cedric Priscal
3
+ * 
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * 
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * 
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License. 
15
+ */
16
+
17
+package android_serialport_api;
18
+
19
+import java.io.File;
20
+import java.io.FileDescriptor;
21
+import java.io.FileInputStream;
22
+import java.io.FileOutputStream;
23
+import java.io.IOException;
24
+import java.io.InputStream;
25
+import java.io.OutputStream;
26
+
27
+import android.util.Log;
28
+
29
+public class SerialPort {
30
+	
31
+	static {
32
+		System.loadLibrary("serial_port");
33
+	}
34
+	
35
+	private static final String TAG = "SerialPort";
36
+
37
+	/*
38
+	 * Do not remove or rename the field mFd: it is used by native method close();
39
+	 */
40
+	private FileDescriptor mFd;
41
+	private FileInputStream mFileInputStream;
42
+	private FileOutputStream mFileOutputStream;
43
+
44
+	public SerialPort(File device, int baudrate, int flags) throws SecurityException, IOException {
45
+
46
+		/* Check access permission */
47
+		if (!device.canRead() || !device.canWrite()) {
48
+			try {
49
+			// Missing read/write permission, trying to chmod the file 
50
+				Process su;
51
+				su = Runtime.getRuntime().exec("/system/bin/su");
52
+				String cmd = "chmod 666 " + device.getAbsolutePath() + "\n"
53
+						+ "exit\n";
54
+				su.getOutputStream().write(cmd.getBytes());
55
+				if ((su.waitFor() != 0) || !device.canRead()
56
+						|| !device.canWrite()) {
57
+					throw new SecurityException();
58
+				}
59
+			} catch (Exception e) {
60
+				//e.printStackTrace();
61
+				//throw new SecurityException();
62
+			}
63
+		}
64
+
65
+		mFd = open(device.getAbsolutePath(), baudrate, flags);
66
+		if (mFd == null) {
67
+			Log.e(TAG, "native open returns null");
68
+			throw new IOException();
69
+		}
70
+		mFileInputStream = new FileInputStream(mFd);
71
+		mFileOutputStream = new FileOutputStream(mFd);
72
+	}
73
+
74
+	// Getters and setters
75
+	public InputStream getInputStream() {
76
+		return mFileInputStream;
77
+	}
78
+
79
+	public OutputStream getOutputStream() {
80
+		return mFileOutputStream;
81
+	}
82
+
83
+	// JNI
84
+	private native FileDescriptor open(String path, int baudrate, int flags);
85
+	public native void close();
86
+	
87
+}

+ 122 - 0
commonLib/src/main/java/android_serialport_api/SerialPortFinder.java

@@ -0,0 +1,122 @@
1
+/*
2
+ * Copyright 2009 Cedric Priscal
3
+ * 
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * 
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * 
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License. 
15
+ */
16
+
17
+package android_serialport_api;
18
+
19
+import java.io.File;
20
+import java.io.FileReader;
21
+import java.io.IOException;
22
+import java.io.LineNumberReader;
23
+import java.util.Iterator;
24
+import java.util.Vector;
25
+
26
+import android.util.Log;
27
+
28
+public class SerialPortFinder {
29
+
30
+	public class Driver {
31
+		public Driver(String name, String root) {
32
+			mDriverName = name;
33
+			mDeviceRoot = root;
34
+		}
35
+		private String mDriverName;
36
+		private String mDeviceRoot;
37
+		Vector<File> mDevices = null;
38
+		public Vector<File> getDevices() {
39
+			if (mDevices == null) {
40
+				mDevices = new Vector<File>();
41
+				File dev = new File("/dev");
42
+				File[] files = dev.listFiles();
43
+				int i;
44
+				for (i=0; i<files.length; i++) {
45
+					if (files[i].getAbsolutePath().startsWith(mDeviceRoot)) {
46
+						Log.d(TAG, "Found new device: " + files[i]);
47
+						mDevices.add(files[i]);
48
+					}
49
+				}
50
+			}
51
+			return mDevices;
52
+		}
53
+		public String getName() {
54
+			return mDriverName;
55
+		}
56
+	}
57
+
58
+	private static final String TAG = "SerialPort";
59
+
60
+	private Vector<Driver> mDrivers = null;
61
+
62
+	Vector<Driver> getDrivers() throws IOException {
63
+		if (mDrivers == null) {
64
+			mDrivers = new Vector<Driver>();
65
+			LineNumberReader r = new LineNumberReader(new FileReader("/proc/tty/drivers"));
66
+			String l;
67
+			while((l = r.readLine()) != null) {
68
+				// Issue 3:
69
+				// Since driver name may contain spaces, we do not extract driver name with split()
70
+				String drivername = l.substring(0, 0x15).trim();
71
+				String[] w = l.split(" +");
72
+				if ((w.length >= 5) && (w[w.length-1].equals("serial"))) {
73
+					Log.d(TAG, "Found new driver " + drivername + " on " + w[w.length-4]);
74
+					mDrivers.add(new Driver(drivername, w[w.length-4]));
75
+				}
76
+			}
77
+			r.close();
78
+		}
79
+		return mDrivers;
80
+	}
81
+
82
+	public String[] getAllDevices() {
83
+		Vector<String> devices = new Vector<String>();
84
+		// Parse each driver
85
+		Iterator<Driver> itdriv;
86
+		try {
87
+			itdriv = getDrivers().iterator();
88
+			while(itdriv.hasNext()) {
89
+				Driver driver = itdriv.next();
90
+				Iterator<File> itdev = driver.getDevices().iterator();
91
+				while(itdev.hasNext()) {
92
+					String device = itdev.next().getName();
93
+					String value = String.format("%s (%s)", device, driver.getName());
94
+					devices.add(value);
95
+				}
96
+			}
97
+		} catch (IOException e) {
98
+			e.printStackTrace();
99
+		}
100
+		return devices.toArray(new String[devices.size()]);
101
+	}
102
+
103
+	public String[] getAllDevicesPath() {
104
+		Vector<String> devices = new Vector<String>();
105
+		// Parse each driver
106
+		Iterator<Driver> itdriv;
107
+		try {
108
+			itdriv = getDrivers().iterator();
109
+			while(itdriv.hasNext()) {
110
+				Driver driver = itdriv.next();
111
+				Iterator<File> itdev = driver.getDevices().iterator();
112
+				while(itdev.hasNext()) {
113
+					String device = itdev.next().getAbsolutePath();
114
+					devices.add(device);
115
+				}
116
+			}
117
+		} catch (IOException e) {
118
+			e.printStackTrace();
119
+		}
120
+		return devices.toArray(new String[devices.size()]);
121
+	}
122
+}

+ 8 - 0
commonLib/src/main/java/com/AndroidVersions.java

@@ -0,0 +1,8 @@
1
+package com;
2
+
3
+public class AndroidVersions {
4
+
5
+	public static final String V_4_0_3 = "4.0.3";
6
+	
7
+	public static final String V_5_1_1 = "5.1.1";
8
+}

+ 118 - 0
commonLib/src/main/java/com/fntech/Loger.java

@@ -0,0 +1,118 @@
1
+package com.fntech;
2
+
3
+import android.annotation.SuppressLint;
4
+import android.util.Log;
5
+
6
+import java.io.IOException;
7
+
8
+public class Loger {
9
+
10
+	public static void disk_log(String caption, String log,String moduleName) {
11
+		_disk_log(caption, log.getBytes(),moduleName);
12
+	}
13
+
14
+	public static void disk_log(String caption, byte[] buffer,String moduleName) {
15
+		java.lang.StringBuilder sb = new java.lang.StringBuilder();
16
+		int i = 0;
17
+		for (i = 0; i < buffer.length; i++) {
18
+			sb.append(String.format("%02X ", buffer[i]));
19
+			if ((i + 1) % 8 == 0 && (i + 1) % 16 != 0) {
20
+				sb.append("\t\t");
21
+			}
22
+			if ((i + 1) % 16 == 0) {
23
+				sb.append("\r\n");
24
+			}
25
+		}
26
+		sb.append("\r\n");
27
+		disk_log(caption, sb.toString(), moduleName);
28
+	}
29
+	
30
+	
31
+	public static void disk_log(String caption, byte[] buffer,int buffer_len,String moduleName) {
32
+		java.lang.StringBuilder sb = new java.lang.StringBuilder();
33
+		int i = 0;
34
+		for (i = 0; i < buffer_len; i++) {
35
+			sb.append(String.format("%02X ", buffer[i]));
36
+			if ((i + 1) % 8 == 0 && (i + 1) % 16 != 0) {
37
+				sb.append("\t\t");
38
+			}
39
+			if ((i + 1) % 16 == 0) {
40
+				sb.append("\r\n");
41
+			}
42
+		}
43
+		sb.append("\r\n");
44
+		disk_log(caption, sb.toString(), moduleName);
45
+	}
46
+
47
+	@SuppressLint("SdCardPath")
48
+	private static void _disk_log(String caption, byte[] buffer,String moduleName) {
49
+		try {
50
+			String path = "/sdcard/fn_log/"+moduleName;
51
+			java.io.File file = new java.io.File(path);
52
+			if (!file.exists()) {
53
+				if (!file.mkdirs()) {
54
+					return;
55
+				}
56
+			}
57
+			/*
58
+			 * path = path+"/u7"; file = new java.io.File(path); if
59
+			 * (!file.exists()) { if (!file.mkdirs()) { return; } }
60
+			 */
61
+			String filename = path
62
+					+ "/"
63
+					+ (new java.text.SimpleDateFormat("yyyy-MM-dd"))
64
+							.format(new java.util.Date()) + ".txt";
65
+			/*
66
+			 * while(true) { filename = path + "/" + (new
67
+			 * java.text.SimpleDateFormat("yyyy-MM-dd-HH-mm-ss")) .format((new
68
+			 * java.util.Date()) ) + ".txt"; break; }
69
+			 */
70
+			file = new java.io.File(filename);
71
+			if (!file.exists()) {
72
+				if (!file.createNewFile()) {
73
+					return;
74
+				}
75
+			}
76
+			
77
+			if (!file.canWrite()) {
78
+				if (!file.setWritable(true)) {
79
+					return;
80
+				}
81
+			}
82
+			java.io.FileOutputStream fos = new java.io.FileOutputStream(file,true);
83
+			fos.write(((new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))
84
+					.format(new java.util.Date()) + "==>\r\n").getBytes());
85
+			fos.write((caption + "\r\n").getBytes());
86
+			fos.write(buffer);
87
+			fos.write(("\r\n").getBytes());
88
+			fos.flush();
89
+			fos.close();
90
+
91
+		} catch (IOException e) {
92
+			e.printStackTrace();
93
+		}
94
+	}
95
+	
96
+	public static void out_log(String caption, String log) {
97
+		
98
+		Log.d(caption, log);
99
+	}
100
+
101
+	public static void out_log(String caption, byte[] buffer,int buffer_len) {
102
+		java.lang.StringBuilder sb = new java.lang.StringBuilder();
103
+		int i = 0;
104
+		for (i = 0; i < buffer_len; i++) {
105
+			sb.append(String.format("%02X ", buffer[i]));
106
+			/*if ((i + 1) % 8 == 0 && (i + 1) % 16 != 0) {
107
+				sb.append("\t\t");
108
+			}
109
+			if ((i + 1) % 16 == 0) {
110
+				sb.append("\r\n");
111
+			}
112
+			*/
113
+		}
114
+		//sb.append("\r\n");
115
+		Log.d(caption,sb.toString());
116
+	}
117
+	
118
+}

+ 9 - 0
commonLib/src/main/java/com/fntech/RInt.java

@@ -0,0 +1,9 @@
1
+package com.fntech;
2
+
3
+public class RInt{
4
+	public RInt(int v){value=v;}
5
+	public RInt(byte b){len = b;}
6
+	
7
+	public byte len;
8
+	public int value;
9
+}

+ 42 - 0
commonLib/src/main/java/com/fntech/adb/adbUtils.java

@@ -0,0 +1,42 @@
1
+package com.fntech.adb;
2
+import java.io.BufferedReader;
3
+import java.io.IOException;
4
+import java.io.InputStreamReader;
5
+
6
+
7
+public class adbUtils {
8
+	 public static void SendMessageCode(final String key){
9
+//	    	new Thread(new Runnable() {
10
+//				@Override
11
+//				public void run() {
12
+					 try {
13
+						 execCommand("input keyevent "+key);				 
14
+				        } catch (IOException e) {
15
+				            // TODO Auto-generated catch block
16
+				            e.printStackTrace();
17
+				        }
18
+				}
19
+//			}).start();
20
+//	    }
21
+	 
22
+	public static void execCommand(String command) throws IOException {
23
+        Runtime runtime = Runtime.getRuntime();
24
+        runtime.exec(command);
25
+        try {
26
+//            if (proc.waitFor() != 0) {
27
+//                System.err.println("exit value = " + proc.exitValue());
28
+//            }
29
+//            BufferedReader in = new BufferedReader(new InputStreamReader(
30
+//                    proc.getInputStream()));
31
+//            StringBuffer stringBuffer = new StringBuffer();
32
+//            String line = null;
33
+//            while ((line = in.readLine()) != null) {
34
+//                stringBuffer.append(line+"-");
35
+//            }
36
+//            System.out.println(stringBuffer.toString());
37
+//            editText.setText(stringBuffer.toString());
38
+        } catch (Exception e) {
39
+            System.err.println(e);
40
+        }
41
+    }
42
+}

+ 55 - 0
commonLib/src/main/java/com/fntech/base/BaseActivity.java

@@ -0,0 +1,55 @@
1
+package com.fntech.base;
2
+
3
+import android.app.ActionBar;
4
+import android.app.Activity;
5
+import android.os.Bundle;
6
+import android.view.View;
7
+import android.view.View.OnClickListener;
8
+import android.widget.ImageView;
9
+
10
+import com.fntech.commonlib.R;
11
+
12
+public abstract class BaseActivity extends Activity {
13
+
14
+	public ImageView navLeft;
15
+	public ImageView navMiddle;
16
+	public ImageView navRight;
17
+	
18
+	@Override
19
+	protected void onCreate(Bundle savedInstanceState) {
20
+		super.onCreate(savedInstanceState);
21
+		ActionBar actionBar = getActionBar();
22
+		if(actionBar!=null){
23
+			actionBar.hide();
24
+		}
25
+	}
26
+
27
+	public void initView(){
28
+		navLeft = (ImageView) findViewById(R.id.bottom_nav_left);
29
+		navLeft.setOnClickListener(new OnClickListener() {
30
+			@Override
31
+			public void onClick(View v) {
32
+				moveTaskToBack(true);
33
+			}
34
+		});
35
+		
36
+		navMiddle = (ImageView) findViewById(R.id.bottom_nav_middle);
37
+		navMiddle.setOnClickListener(new OnClickListener() {
38
+			@Override
39
+			public void onClick(View v) {
40
+				finish();
41
+			}
42
+		});
43
+		
44
+		navRight = (ImageView) findViewById(R.id.bottom_nav_right);
45
+		navRight.setOnClickListener(new OnClickListener() {
46
+			@Override
47
+			public void onClick(View v) {
48
+				handleRightClick();
49
+			}
50
+		});
51
+	}
52
+	
53
+	public abstract void handleRightClick();
54
+	
55
+}

+ 6 - 0
commonLib/src/main/java/com/fntech/io/serial/ByteData.java

@@ -0,0 +1,6 @@
1
+package com.fntech.io.serial;
2
+
3
+public class ByteData
4
+{
5
+ public byte[] bytedata; 
6
+}

+ 83 - 0
commonLib/src/main/java/com/fntech/io/serial/M10_GPIO.java

@@ -0,0 +1,83 @@
1
+package com.fntech.io.serial;
2
+
3
+import java.io.FileOutputStream;
4
+
5
+public class M10_GPIO {
6
+	
7
+	/**
8
+	 * GPS模块上电
9
+	 */
10
+	public static void GPS_PowerOn(){
11
+		writeFile("/sys/devices/platform/odroid-sysfs/gps_enable", "1");
12
+		writeFile("/sys/devices/platform/odroid-sysfs/gps_enable_switch", "0");
13
+	}
14
+	
15
+	/**
16
+	 * GPS模块下电
17
+	 */
18
+	public static void GPS_PowerOff(){
19
+		writeFile("/sys/devices/platform/odroid-sysfs/gps_enable", "0");
20
+		writeFile("/sys/devices/platform/odroid-sysfs/gps_enable_switch", "1");
21
+	}
22
+	
23
+	public static void _14443A_PowerOn()
24
+	{
25
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "1");
26
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch", "0");
27
+	}
28
+	
29
+	public static void _14443A_PowerOFF()
30
+	{
31
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "0");
32
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch", "0");
33
+	}
34
+	
35
+	public static void Infrared_PowerOn()
36
+	{
37
+		writeFile("/syss/platform/devices/odroid-sysfs/infrared_enable_switch", "0");
38
+	}
39
+	
40
+	public static void Infrared_PowerOFF()
41
+	{
42
+		writeFile("/syss/platform/devices/odroid-sysfs/rfid_serial_switch", "0");
43
+	}
44
+	
45
+	public static void R1000_PowerOn()
46
+	{
47
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "1");
48
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch", "1");
49
+	}
50
+	
51
+	public static void R1000_PowerOFF()
52
+	{
53
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "0");
54
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch", "0");
55
+	}
56
+	
57
+	public static void W433_PowerOn()
58
+	{
59
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/rfid_enable", "1");
60
+		writeFile("/sys/ bus/platform/devices/odroid-sysfs/rfid_serial_switch", "0");
61
+	}
62
+	
63
+	public static void W433_PowerOff()
64
+	{
65
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/rfid_enable", "0");
66
+		writeFile("/sys/ bus/platform/devices/odroid-sysfs/rfid_serial_switch", "0");
67
+	}
68
+	
69
+	//写数据
70
+	private static void writeFile(String fileName,String writestr)
71
+	{
72
+	  try{
73
+	        FileOutputStream fout = new FileOutputStream(fileName);
74
+	        byte [] bytes = writestr.getBytes();
75
+	        fout.write(bytes);
76
+	        fout.close();
77
+	    }
78
+	  	catch(Exception e)
79
+	  	{
80
+	  		e.printStackTrace();
81
+	  	}
82
+	}
83
+}

+ 94 - 0
commonLib/src/main/java/com/fntech/io/serial/SerialPort.java

@@ -0,0 +1,94 @@
1
+package com.fntech.io.serial;
2
+
3
+import java.io.File;
4
+import java.io.FileDescriptor;
5
+import java.io.FileInputStream;
6
+import java.io.FileOutputStream;
7
+import java.io.IOException;
8
+import java.io.InputStream;
9
+import java.io.OutputStream;
10
+
11
+/*class ByteData
12
+{
13
+ public byte[] bytedata; 
14
+}*/
15
+
16
+public class SerialPort {
17
+	private static final String TAG = "SerialPort";
18
+
19
+	/*
20
+	 * Do not remove or rename the field mFd: it is used by native method
21
+	 * close();
22
+	 */
23
+	private FileDescriptor mFd;
24
+	private FileInputStream mFileInputStream;
25
+	private FileOutputStream mFileOutputStream;
26
+
27
+	public SerialPort(File device, int baudrate, int databit,int stopbit,int parity)
28
+			throws SecurityException, IOException {
29
+
30
+		/* Check access permission */
31
+		if (!device.canRead() || !device.canWrite()) {
32
+			try {
33
+				// Missing read/write permission, trying to chmod the file 
34
+				Process su;
35
+				su = Runtime.getRuntime().exec("/system/bin/su");
36
+				String cmd = "chmod 666 " + device.getAbsolutePath() + "\n"
37
+						+ "exit\n";
38
+				su.getOutputStream().write(cmd.getBytes());
39
+				if ((su.waitFor() != 0) || !device.canRead()
40
+						|| !device.canWrite()) {
41
+					throw new SecurityException();
42
+				}
43
+			} catch (Exception e) {
44
+				//e.printStackTrace();
45
+				//throw new SecurityException();
46
+			}
47
+		}
48
+
49
+		mFd = open(device.getAbsolutePath(), baudrate, databit,stopbit,parity);
50
+		if (mFd == null) {
51
+			//Log.e(TAG, "native open returns null");
52
+			throw new IOException();
53
+		}
54
+		mFileInputStream = new FileInputStream(mFd);
55
+		mFileOutputStream = new FileOutputStream(mFd);
56
+	}
57
+
58
+	// Getters and setters
59
+	public InputStream getInputStream() {
60
+		return mFileInputStream;
61
+	}
62
+
63
+	public OutputStream getOutputStream() {
64
+		return mFileOutputStream;
65
+	}
66
+
67
+	// JNI 
68
+	/*
69
+	  path �����豸�ļ�·��
70
+	  baudrate ������ 1200 2400 4800 9600 ... 57600 115200
71
+	  databit ���λ 8
72
+	  stopbit ֹͣλ 0 1 2
73
+	  parity У��λ 0 1
74
+	*/
75
+	private native static FileDescriptor open(String path, int baudrate,int databit,int stopbit,int parity);
76
+
77
+	public native void close();
78
+	
79
+	public native int cleardata();
80
+	
81
+	/*
82
+	 jni ����ָ���������
83
+	*/
84
+	public native int senddata(byte[] sendbyte,int len,int timeout);
85
+	
86
+	/*
87
+	  jni ����ָ���������
88
+	*/
89
+	public native int recvdata(ByteData recvdata,int len,int timeout); 
90
+
91
+	static {
92
+		System.loadLibrary("fntech_serial");
93
+	}
94
+}

+ 116 - 0
commonLib/src/main/java/com/fntech/m10/gpio/M10_GPIO.java

@@ -0,0 +1,116 @@
1
+package com.fntech.m10.gpio;
2
+
3
+import java.io.FileOutputStream;
4
+
5
+import com.fntech.Loger;
6
+
7
+public class M10_GPIO {
8
+	public static void _14443A_PowerOn() {
9
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "1");
10
+		writeFile(
11
+				"/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch",
12
+				"0");
13
+	}
14
+
15
+	public static void _14443A_PowerOFF() {
16
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "0");
17
+		writeFile(
18
+				"/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch",
19
+				"0");
20
+	}
21
+	
22
+	public static void _14443_SwitchSerialPort() {
23
+		writeFile("/sys/class/gpio/gpio908/direction", "out");
24
+		writeFile("/sys/class/gpio/gpio908/value", "1");
25
+	}
26
+	public static void _1D_PowerOn()
27
+	{
28
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/bardecoder_enable_switch", "1");
29
+	}
30
+	
31
+	public static void _1D_PowerOff()
32
+	{
33
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/bardecoder_enable_switch", "0");
34
+	}
35
+	
36
+	public static void gamaPowerOn()
37
+	{
38
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/bardecoder_enable_switch", "1");
39
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch", "1");
40
+	}
41
+	
42
+	public static void gamaPowerOff()
43
+	{
44
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/bardecoder_enable_switch", "0");
45
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch", "0");
46
+	}
47
+	
48
+	public static void H7_PowerOn()
49
+	{
50
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "1");
51
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch", "0");
52
+	}
53
+	
54
+	public static void H7_PowerOFF()
55
+	{
56
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "0");
57
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch", "0");
58
+	}
59
+
60
+	public static void U1_PowerOn() {
61
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "1");
62
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch",
63
+				"1");
64
+	}
65
+
66
+	public static void U1_PowerOff() {
67
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "0");
68
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch",
69
+				"0");
70
+	}
71
+
72
+	public static void U6_PowerOn() {
73
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "1");
74
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch",
75
+				"0");
76
+	}
77
+
78
+	public static void U6_PowerOFF() {
79
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_enable", "0");
80
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/ic14443a_serial_switch",
81
+				"0");
82
+	}
83
+
84
+	public static void W433_PowerOn() {
85
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/rfid_enable", "1");
86
+		writeFile("/sys/ bus/platform/devices/odroid-sysfs/rfid_serial_switch",
87
+				"0");
88
+	}
89
+
90
+	public static void W433_PowerOff() {
91
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/rfid_enable", "0");
92
+		writeFile("/sys/ bus/platform/devices/odroid-sysfs/rfid_serial_switch",
93
+				"1");
94
+	}
95
+	public static void R1000_PowerOn() {
96
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "1");
97
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch",
98
+				"1");
99
+	}
100
+
101
+	public static void R1000_PowerOFF() {
102
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_enable", "0");
103
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/r1000_serial_switch",
104
+				"0");
105
+	}
106
+	private static void writeFile(String fileName, String writestr) {
107
+		try {
108
+			FileOutputStream fout = new FileOutputStream(fileName);
109
+			byte[] bytes = writestr.getBytes();
110
+			fout.write(bytes);
111
+			fout.close();
112
+		} catch (Exception e) {
113
+			e.printStackTrace();
114
+		}
115
+	}
116
+}

+ 72 - 0
commonLib/src/main/java/com/fntech/m10a/gpio/M10A_GPIO.java

@@ -0,0 +1,72 @@
1
+package com.fntech.m10a.gpio;
2
+
3
+import java.io.FileOutputStream;
4
+
5
+import com.fntech.Loger;
6
+
7
+public class M10A_GPIO {
8
+	public static void BdPowerOn() {
9
+		
10
+		//writeFile("/sys/class/gpio/export", "909");
11
+		writeFile("/sys/class/gpio/gpio909/direction", "out");
12
+		writeFile("/sys/class/gpio/gpio909/value", "1");
13
+		writeFile("/sys/class/gpio/gpio908/direction", "out");
14
+		writeFile("/sys/class/gpio/gpio908/value", "0");
15
+		writeFile("/sys/class/gpio/gpio907/direction", "in");
16
+	}
17
+
18
+	public static void BdPowerOff() {
19
+		writeFile("/sys/class/gpio/gpio909/direction", "out");
20
+		writeFile("/sys/class/gpio/gpio909/value", "0");
21
+	}
22
+
23
+	public static void PowerOn() {
24
+		writeFile("/sys/class/gpio/gpio898/direction", "out");
25
+		writeFile("/sys/class/gpio/gpio898/value", "1");
26
+	}
27
+
28
+	public static void PowerOff() {
29
+		writeFile("/sys/class/gpio/gpio898/direction", "out");
30
+		writeFile("/sys/class/gpio/gpio898/value", "0");
31
+	}
32
+	
33
+	public static void _uhf_SwitchSerialPort() {
34
+		writeFile("/sys/class/gpio/gpio910/direction", "out");
35
+		writeFile("/sys/class/gpio/gpio910/value", "0");
36
+	}
37
+	
38
+	public static void _br_SwitchSerialPort() {
39
+		writeFile("/sys/class/gpio/gpio910/direction", "out");
40
+		writeFile("/sys/class/gpio/gpio910/value", "1");
41
+	}
42
+	public static void _fingerprint_SwitchSerialPort() {
43
+		writeFile("/sys/class/gpio/gpio910/direction", "out");
44
+		writeFile("/sys/class/gpio/gpio910/value", "1");
45
+	}
46
+	
47
+	public static void _14443_SwitchSerialPort() {
48
+		writeFile("/sys/class/gpio/gpio908/direction", "out");
49
+		writeFile("/sys/class/gpio/gpio908/value", "1");
50
+	}
51
+
52
+	public static void _gama_SwitchSerialPort() {
53
+		writeFile("/sys/class/gpio/gpio908/direction", "out");
54
+		writeFile("/sys/class/gpio/gpio908/value", "0");
55
+	}
56
+	
57
+	public static void _1D_PowerOn()
58
+	{
59
+		writeFile("/sys/bus/platform/devices/odroid-sysfs/bardecoder_enable_switch", "1");
60
+	}
61
+	
62
+	private static void writeFile(String fileName, String writestr) {
63
+		try {
64
+			FileOutputStream fout = new FileOutputStream(fileName);
65
+			byte[] bytes = writestr.getBytes();
66
+			fout.write(bytes);
67
+			fout.close();
68
+		} catch (Exception e) {
69
+			e.printStackTrace();
70
+		}
71
+	}
72
+}

+ 12 - 0
commonLib/src/main/java/com/hsm/barcode/CenteringWindow.java

@@ -0,0 +1,12 @@
1
+package com.hsm.barcode;
2
+
3
+//import android.graphics.Point;
4
+
5
+public class CenteringWindow{
6
+	public CenteringWindow(){
7
+	}
8
+	public int  UpperLeftX;
9
+	public int  UpperLeftY;
10
+	public int 	LowerRightX;
11
+	public int  LowerRightY;
12
+}

+ 15 - 0
commonLib/src/main/java/com/hsm/barcode/CenteringWindowLimits.java

@@ -0,0 +1,15 @@
1
+package com.hsm.barcode;
2
+
3
+
4
+public class CenteringWindowLimits{
5
+	public CenteringWindowLimits(){
6
+	}
7
+	public int UpperLeft_X_Min;
8
+	public int UpperLeft_X_Max;
9
+	public int UpperLeft_Y_Min;
10
+	public int UpperLeft_Y_Max;
11
+	public int LowerRight_X_Min;
12
+	public int LowerRight_X_Max;
13
+	public int LowerRight_Y_Min;
14
+	public int LowerRight_Y_Max;
15
+}

+ 25 - 0
commonLib/src/main/java/com/hsm/barcode/DecodeResult.java

@@ -0,0 +1,25 @@
1
+package com.hsm.barcode;
2
+
3
+import java.util.Arrays;
4
+
5
+public class DecodeResult {
6
+	public String barcodeData;
7
+	public byte codeId;
8
+	public byte aimId;
9
+	public byte aimModifier;
10
+	public int length;
11
+	public byte[] byteBarcodeData;
12
+	
13
+	public DecodeResult(){
14
+		
15
+	}
16
+
17
+	@Override
18
+	public String toString() {
19
+		return "DecodeResult [barcodeData=" + barcodeData + ", codeId="
20
+				+ codeId + ", aimId=" + aimId + ", aimModifier=" + aimModifier
21
+				+ ", length=" + length + ", byteBarcodeData="
22
+				+ Arrays.toString(byteBarcodeData) + "]";
23
+	}
24
+	
25
+}

+ 606 - 0
commonLib/src/main/java/com/hsm/barcode/Decoder.java

@@ -0,0 +1,606 @@
1
+package com.hsm.barcode;
2
+import android.graphics.Bitmap;
3
+import android.util.Log;
4
+
5
+public class Decoder {
6
+
7
+  	private int mMayContinueDoDecode = 4;
8
+  	public boolean mayContinue = true;
9
+
10
+	private static final String TAG = "Decoder.java";
11
+
12
+	  // load the Decoder.SO
13
+	  static {
14
+		try{
15
+			System.loadLibrary("HSMDecoderAPI");
16
+		    Log.d(TAG, "HSMDecoderAPI.so loaded");
17
+		}catch (Exception e) {
18
+			e.printStackTrace();
19
+		}
20
+	  }
21
+
22
+		/* Native methods from JNI */
23
+	  	private native int Connect();
24
+	  	private native int Disconnect();
25
+	  	private native String GetErrorMessage(int error);
26
+	  	private native int GetMaxMessageLength();
27
+	  	private native int GetEngineID();
28
+	  	private native int GetPSOCMajorRev();
29
+	  	private native int GetPSOCMinorRev();
30
+	  	private native String GetEngineSerialNumber();
31
+	  	private native int GetEngineType();
32
+		private native String GetAPIRevision();
33
+		private native String GetDecoderRevision();
34
+		private native String GetSecondaryDecoderRevision();
35
+		private native String GetControlLogicRevision();
36
+		private native String GetDecThreadsRevision();
37
+		private native String GetScanDriverRevision();
38
+		private native void GetImagerProperties(ImagerProperties imgProp);
39
+		private native byte[] GetLastImage(ImageAttributes imgAtt);
40
+		private native int GetIQImage(IQImagingProperties IQParams, Bitmap bitmap);
41
+		private native int GetCenteringWindowLimits(CenteringWindowLimits limits);
42
+		private native int SetCenteringWindow(boolean Defaults, CenteringWindow window);
43
+		private native int EnableCenteringWindow(boolean enable);
44
+	  	private native int EnableSymbology(int symID);
45
+	  	private native int DisableSymbology(int symID);
46
+	  	private native int SetSymbologyDefaults(int symID);
47
+	  	private native int GetSymbologyConfig(SymbologyConfig symConfig, boolean Defaults);
48
+	  	private native int SetSymbologyConfig(SymbologyConfig symConfig);
49
+	  	private native int GetSymbologyMinRange(int symID);
50
+	  	private native int GetSymbologyMaxRange(int symID);
51
+	  	private native int SetLightsMode(int Mode);
52
+	  	private native int SetScanMode(int Mode);
53
+	  	private native int SetExposureMode(int Mode);
54
+	  	private native int SetDecodeSearchLimit(int limit);
55
+	  	private native int SetDecodeAttemptLimit(int limit);
56
+	  	private native int SetOCRTemplates(int templates);
57
+	  	private native int SetOCRUserTemplate(int mode, byte[] template);
58
+	  	private native int SetOCRMode(int mode);
59
+	  	private native int WaitForDecode( int dwTimeout);
60
+	  	private native byte[] GetBarcodeByteData();
61
+	  	private native byte GetBarcodeCodeID();
62
+	  	private native byte GetBarcodeAimID();
63
+	  	private native byte GetBarcodeAimModifier();
64
+	  	private native int  GetBarcodeLength();
65
+		public native String GetBarcodeData();
66
+		private native int GetLastDecodeTime();
67
+		private native int WaitForDecodeTwo( int dwTimeout, DecodeResult result) throws Exception;
68
+
69
+	    private native int GetSingleFrame(Bitmap bitmap);
70
+	    private native int GetPreviewFrame(Bitmap bitmap);
71
+	    private native int StartScanning();
72
+	    private native int StopScanning();
73
+	    private native int GetImageWidth();
74
+	    private native int GetImageHeight();
75
+	    private native int SetExposureSettings(int[] array);
76
+
77
+		private native int SetProperty(int property, int value);
78
+		private native int GetProperty(int property);
79
+		private native String GetStringProperty(int number);
80
+
81
+
82
+
83
+
84
+		// Eventually we'll have to throw exceptions for failures but for now we won't
85
+	    /**
86
+	     * This method is used to cancel a decode attempt
87
+	     */
88
+	    public void cancelDecode(){
89
+		    Log.d(TAG, "cancelDecode");
90
+	        mMayContinueDoDecode = 0;
91
+	        mayContinue = false;
92
+	    }
93
+
94
+
95
+	    /**
96
+	     * The method is used to establish a connection to the decoder library. This method must be called
97
+	     * before any other method
98
+	     */
99
+		public int connectToDecoder(){
100
+		    Log.d(TAG, "connectToDecoder");
101
+			return Connect();
102
+		}
103
+
104
+
105
+	    /**
106
+	     * The method is used to terminate the connection to the decoder library.
107
+	     */
108
+		public int disconnectFromDecoder (){
109
+		    Log.d(TAG, "disconnectFromDecoder");
110
+			return Disconnect();
111
+		}
112
+
113
+		/**
114
+		 *
115
+		 * @param error
116
+		 */
117
+		public String getErrorMessage(int error){
118
+		    Log.d(TAG, "getErrorMEssage");
119
+			return GetErrorMessage(error);
120
+		}
121
+
122
+		/**
123
+		 * This method is used to retrieve the maximum size of possible barcode data length
124
+		 * @return - maximum possible size of barcode data that can be returned.
125
+		 */
126
+		public int getMaxMessageLength(){
127
+		    Log.d(TAG, "getMaxMessageLength");
128
+			return GetMaxMessageLength();
129
+		}
130
+
131
+		/**
132
+		 * This method returns the PSOC firmware major revision number
133
+		 * @return - the PSOC firmware major revision number
134
+		 */
135
+		public int getPSOCMajorRev(){
136
+		    Log.d(TAG, "getPSOCMajorRev");
137
+			return GetPSOCMajorRev();
138
+		}
139
+
140
+		/**
141
+		 * This method returns the PSOC firmware minor revision number
142
+		 * @return - - the PSOC firmware minor revision number
143
+		 */
144
+		public int getPSOCMinorRev(){
145
+		    Log.d(TAG, "getPSOCMinorRev");
146
+			return GetPSOCMinorRev();
147
+		}
148
+
149
+		/**
150
+		 * This method returns the the scan engine serial number
151
+		 * @return - engine serial number
152
+		 */
153
+		public String getEngineSerialNumber(){
154
+		    Log.d(TAG, "getEngineSerialNumber");
155
+			return GetEngineSerialNumber();
156
+		}
157
+
158
+
159
+		/**
160
+		 * This method returns the scan engine's engine ID
161
+		 * @return - engine ID
162
+		 */
163
+		public int getEngineID(){
164
+		    Log.d(TAG, "getEngineID");
165
+			return GetEngineID();
166
+		}
167
+
168
+		/**
169
+		 * This method returns an int indicating the scan engine type
170
+		 * 0 = no engine detected
171
+		 * 1 = imager
172
+		 * 2 = laser
173
+		 * @return - engine type
174
+		 */
175
+		public int getEngineType(){
176
+		    Log.d(TAG, "getEngineType");
177
+			return GetEngineType();
178
+		}
179
+
180
+
181
+		/**
182
+		 * This method returns the API revision
183
+		 * @return - revision string
184
+		 */
185
+		public String getAPIRevision(){
186
+		    Log.d(TAG, "getAPIRevision");
187
+			return GetAPIRevision();
188
+
189
+		}
190
+
191
+		/**
192
+		 * This method returns the Decoder revision
193
+		 * @return - revision string
194
+		 */
195
+		public String getDecoderRevision(){
196
+		    Log.d(TAG, "getDecoderRevision");
197
+			return GetDecoderRevision();
198
+
199
+		}
200
+
201
+		/**
202
+		 * This method returns the Secondary Decoder revision
203
+		 * @return - revision string
204
+		 */
205
+		public String getSecondaryDecoderRevision(){
206
+		    Log.d(TAG, "getSecondaryDecoderRevision");
207
+			return GetSecondaryDecoderRevision();
208
+
209
+		}
210
+
211
+		/**
212
+		 * This method returns the Control Logic (DCL) revision
213
+		 * @return - revision string
214
+		 */
215
+		public String getControlLogicRevision(){
216
+		    Log.d(TAG, "getControlLogicRevision");
217
+			return GetControlLogicRevision();
218
+
219
+		}
220
+
221
+		/**
222
+		 * This method returns the DecThreads revision
223
+		 * @return - revision string
224
+		 */
225
+		public String getDecThreadsRevision(){
226
+		    Log.d(TAG, "getDecThreadsRevision");
227
+			return GetDecThreadsRevision();
228
+
229
+		}
230
+
231
+		/**
232
+		 * This method returns the Scan Driver revision
233
+		 * @return - revision string
234
+		 */
235
+		public String getScanDriverRevision(){
236
+		    Log.d(TAG, "getScanDriverRevision");
237
+			return GetScanDriverRevision();
238
+
239
+		}
240
+
241
+		/**
242
+		 * This method is used to enable a barcode symbol type
243
+		 */
244
+		public int enableSymbology(int symbologyID){
245
+		    Log.d(TAG, "enableBarcode");
246
+		    return EnableSymbology(symbologyID);
247
+		}
248
+
249
+		/**
250
+		 * This method is used to disable a barcode symbol type
251
+		 */
252
+		public int disableSymbology(int symbologyID){
253
+		    Log.d(TAG, "disableBarcode");
254
+		    return DisableSymbology(symbologyID);
255
+		}
256
+
257
+		/**
258
+		 * This method is used to reset a barcode symbol type to its default condition
259
+		 */
260
+		public int setSymbologyDefaults(int symbologyID){
261
+		    Log.d(TAG, "setSymbologyDefaults");
262
+		    return DisableSymbology(symbologyID);
263
+		}
264
+
265
+		/**
266
+		 * This method is used to acquire current symbology configuration
267
+		 */
268
+		public int getSymbologyConfig(SymbologyConfig symConfig, boolean DefaultValues){
269
+		    Log.d(TAG, "getSymbologyConfig");
270
+		    return GetSymbologyConfig(symConfig, DefaultValues);
271
+		}
272
+
273
+		/**
274
+		 * This method is used to setup current symbology configuration
275
+		 */
276
+		public int setSymbologyConfig(SymbologyConfig symConfig){
277
+		    Log.d(TAG, "setSymbologyConfig");
278
+		    return SetSymbologyConfig(symConfig);
279
+		}
280
+
281
+		/**
282
+		 * This method is used to acquire current symbology minimum possible length
283
+		 * @return range value integer
284
+		 */
285
+		public int getSymbologyMinRange(int symbologyID){
286
+			int min;
287
+		    Log.d(TAG, "GetSymbologyMinRange");
288
+			min = GetSymbologyMinRange(symbologyID);
289
+			return min;
290
+		}
291
+
292
+		/**
293
+		 * This method is used to acquire current symbology maximum possible length
294
+		 * @return range value integer
295
+		 */
296
+		public int getSymbologyMaxRange(int symbologyID){
297
+			int min;
298
+		    Log.d(TAG, "GetSymbologyMinRange");
299
+			min = GetSymbologyMaxRange(symbologyID);
300
+			return min;
301
+		}
302
+
303
+		/**
304
+		 * This method is used to acquire current imager properties
305
+		 */
306
+		public void getImagerProperties(ImagerProperties imgProp)
307
+		{
308
+			Log.d(TAG, "getImagerProperties");
309
+			GetImagerProperties(imgProp);
310
+		}
311
+
312
+		/**
313
+		 * This method is used to setup the illumination/aimer mode
314
+		 * LM_ILLUM_AIMER_OFF=0, // Neither aimers or illumination used during scanning
315
+		 * LM_AIMER_ONLY=1, // Aimer only used during scanning
316
+		 * LM_ILLUM_ONLY=2, // Illumination LEDs only used during scanning
317
+		 * LM_ILLUM_AIMER=3, // Alternating aimer & illumination during scanning (default)
318
+		 */
319
+		public int setLightsMode(int Mode){
320
+			Log.d(TAG, "setLightsMode");
321
+			return SetLightsMode(Mode);
322
+		}
323
+
324
+		/**
325
+		 * This method is used to setup the scan mode
326
+		 */
327
+		public int setScanMode(int Mode){
328
+			Log.d(TAG, "setScanMode");
329
+			return SetScanMode(Mode);
330
+		}
331
+
332
+		/**
333
+		 * This method is used to setup the exposure mode
334
+		 * EXP_MODE_FIXED=0,not recommended
335
+		 * EXP_MODE_AUTO=2
336
+		 */
337
+		public int setExposureMode(int Mode){
338
+			Log.d(TAG, "setExposureMode");
339
+			return SetExposureMode(Mode);
340
+		}
341
+
342
+		/**
343
+		 * This method is used to setup the decoder search time limit
344
+		 */
345
+		public void setDecodeSearchLimit(int limit){
346
+			Log.d(TAG, "setDecodeSearchLimit");
347
+			SetDecodeSearchLimit(limit);
348
+			return;
349
+		}
350
+
351
+		/**
352
+		 * This method is used to setup the decoder decode time limit
353
+		 */
354
+		public int setDecodeAttemptLimit(int limit){
355
+			Log.d(TAG, "setDecodeAttemptLimit");
356
+			return SetDecodeAttemptLimit(limit);
357
+		}
358
+
359
+		/**
360
+		 * This method is used to acquire the centering window coordinates
361
+		 */
362
+		public int getCenteringWindowLimits(CenteringWindowLimits limits){
363
+			Log.d(TAG, "GetCenteringWindowLimits");
364
+			return GetCenteringWindowLimits(limits);
365
+		}
366
+
367
+		/**
368
+		 * This method is used to setup the centering window coordinates
369
+		 */
370
+		public int setDecodeCenteringWindow(CenteringWindow window){
371
+			Log.d(TAG, "setDecodeCenteringWindow");
372
+			return SetCenteringWindow(false, window);
373
+		}
374
+
375
+		/**
376
+		 * This method is used to enable/disable the centering window feature
377
+		 */
378
+		public int enableDecodeCenteringWindow(boolean enable){
379
+			Log.d(TAG, "EnableDecodeCenteringWindow");
380
+			return EnableCenteringWindow(enable);
381
+		}
382
+
383
+
384
+		/**
385
+		 * This method is used to retrieve the last image acquired by the scanner
386
+		 * @return raw image pixels in a byte array
387
+		 */
388
+		public byte[] getLastImage(ImageAttributes imgAtt){
389
+		    Log.d(TAG, "getLastImage");
390
+			return(GetLastImage(imgAtt));
391
+
392
+		}
393
+
394
+		/**
395
+		 * This method is used to retrieve the data from the last successful decode in byte format
396
+		 * @return barcode data in a byte array
397
+		 */
398
+		public byte[] getBarcodeByteData(){
399
+		    Log.d(TAG, "getBarcodeByteData");
400
+			return(GetBarcodeByteData());
401
+
402
+		}
403
+
404
+		/**
405
+		 * This method is used to retrieve all barcode information for each barcode decoded from an image with multiple barcodes
406
+		 * This requires multiple callbacks - 1 for each barcode decoded.
407
+		 * @return boolean - success
408
+		 */
409
+		public boolean MultiReadCallback(byte codeID, byte aimID, byte AimMod, int length, byte[] data){
410
+		    Log.d(TAG, "MultiReadCallback enter");
411
+    		Log.d(TAG, "codeID = " + codeID);
412
+    		Log.d(TAG, "aimID = " + aimID);
413
+    		Log.d(TAG, "AimMod = " + AimMod);
414
+    		Log.d(TAG, "length = " + length);
415
+    		String value = new String(data);
416
+     		Log.d(TAG, value);
417
+		    return true;
418
+		}
419
+
420
+		/**
421
+		 * This method will capture a bitmap image of the specified Intelligent Image
422
+		 * @return int
423
+		 */
424
+		public int getIQImage(IQImagingProperties IQParams, Bitmap bitmap){
425
+		    Log.d(TAG, "getIQImage");
426
+			return(GetIQImage(IQParams, bitmap));
427
+
428
+		}
429
+
430
+
431
+		/**
432
+		 * This method is used to set multiple user template definitions for decoding OCR images
433
+		 */
434
+		public int setOCRTemplates(int templates){
435
+			Log.d(TAG, "setOCRTemplates");
436
+			return SetOCRTemplates(templates);
437
+		}
438
+
439
+		/**
440
+		 * This method is used to set a user template definition for decoding OCR images
441
+		 */
442
+		public int setOCRUserTemplate(int mode, byte[] template){
443
+			Log.d(TAG, "setOCRUserTemplate");
444
+			return SetOCRUserTemplate(mode, template);
445
+		}
446
+
447
+		/**
448
+		 * This method set the desired OCR decode mode.  Refer to the OEM API OCR User�s Guide for more information.
449
+		 */
450
+		public int setOCRMode(int mode){
451
+			Log.d(TAG, "setOCRMode");
452
+			return SetOCRMode(mode);
453
+		}
454
+
455
+		/**
456
+		 * This method is used to start a blocking decode attempt by the scan engine.
457
+		 *  This function does not return to the calling application until either a symbol is decoded, the time out period has elapsed,
458
+		 *  or the optional callback function returns a value of false.
459
+		 */
460
+		public int waitForDecode(int timeOut){
461
+		    Log.d(TAG, "waitForDecode");
462
+		    mMayContinueDoDecode = 4;
463
+		    return WaitForDecode(timeOut);
464
+		}
465
+
466
+		/**
467
+		 * This method is used to retrieve the CodeID of the last barcode decoded.
468
+		 * @return byte value of the codeID
469
+		 */
470
+		public byte getCodeID(){
471
+		    Log.d(TAG, "getCodeID");
472
+		    return GetBarcodeCodeID();
473
+		}
474
+
475
+		/**
476
+		 * This method is used to retrieve the AimID of the last barcode decoded.
477
+		 * @return byte value of the AimID
478
+		 */
479
+		public byte getAimID(){
480
+		    Log.d(TAG, "getAimID");
481
+			return GetBarcodeAimID();
482
+		}
483
+
484
+		/**
485
+		 * This method is used to retrieve the Aim modifier of the last barcode decoded.
486
+		 * @return byte value of the Aim modifier
487
+		 */
488
+		public byte getAimModifier(){
489
+		    Log.d(TAG, "getAimModifier");
490
+			return GetBarcodeAimModifier();
491
+		}
492
+
493
+		/**
494
+		 * This method is used to retrieve the length of the last barcode decoded.
495
+		 * @return integer value of the length
496
+		 */
497
+		public int getLength(){
498
+		    Log.d(TAG, "getLength");
499
+			return GetBarcodeLength();
500
+		}
501
+
502
+		/**
503
+		 * This method is used to retrieve the data contained in the last barcode decoded. Should not be used for barcodes containing NULLs or other non-ASCII characters.
504
+		 * @return string data of barcode
505
+		 */
506
+		public String getDecodeData(){
507
+		    Log.d(TAG, "getDecodeData");
508
+			return GetBarcodeData();
509
+		}
510
+
511
+		/**
512
+		 * This method is used to retrieve the duration to decode the last barcode decoded.
513
+		 * @return integer value of the time
514
+		 */
515
+		public int getLastDecodeTime(){
516
+		    Log.d(TAG, "getLastDecodeTime");
517
+			return GetLastDecodeTime();
518
+		}
519
+
520
+
521
+		public int waitForDecodeTwo(int timeOut, DecodeResult result) throws Exception{
522
+			Log.d(TAG, "waitForDecode2 enter");
523
+			mMayContinueDoDecode = 4;
524
+			int RetVal = WaitForDecodeTwo(timeOut, result);
525
+		    Log.d(TAG, "waitForDecode2 exit");
526
+		    Log.i(TAG, RetVal+":"+result.toString());
527
+			return RetVal;
528
+		}
529
+
530
+		private int KeepGoing(){
531
+		    Log.d(TAG, "KeepGoing");
532
+			return 1;
533
+		}
534
+
535
+		// For imaging
536
+		public int getSingleFrame(Bitmap bitmap){
537
+		    Log.d(TAG, "getSingleFrame");
538
+			return(GetSingleFrame(bitmap));
539
+
540
+		}
541
+
542
+		// 1/4 resolution image
543
+		public int getPreviewFrame(Bitmap bitmap){
544
+		    Log.d(TAG, "getPreviewFrame");
545
+			return(GetPreviewFrame(bitmap));
546
+
547
+		}
548
+
549
+	    /**
550
+	     * The method causes the image engine to start continuous collecting of images.
551
+		 * @return integer - success
552
+	     */
553
+		public int startScanning(){
554
+		    Log.d(TAG, "startScanning");
555
+			return StartScanning();
556
+		}
557
+
558
+	    /**
559
+	     * The method causes the image engine to stop continuous collecting of images.
560
+		 * @return integer - success
561
+	     */
562
+		public int stopScanning(){
563
+		    Log.d(TAG, "stopScanning");
564
+			return StopScanning();
565
+		}
566
+
567
+	    /**
568
+	     * The method is used to retrieve the width (number of pixels) of the last captured image.
569
+	     * This information can be used to calculate the image size.
570
+		 * @return integer value of the width
571
+	     */
572
+		public int getImageWidth(){
573
+		    Log.d(TAG, "getImageWidth");
574
+			return GetImageWidth();
575
+		}
576
+
577
+	    /**
578
+	     * The method is used to retrieve the height (number of pixels) of the last captured image.
579
+	     * This information can be used to calculate the image size.
580
+		 * @return integer value of the height
581
+	     */
582
+		public int getImageHeight(){
583
+		    Log.d(TAG, "getImageHeight");
584
+			return GetImageHeight();
585
+		}
586
+
587
+		public int setExposueSettings(int[] expSettings){
588
+			return SetExposureSettings(expSettings);
589
+		}
590
+
591
+	    /**
592
+	     * The method is used to configure the decoder by configuring specific decoder properties.
593
+	     */
594
+		public int setProperty(int property, int value){
595
+				return SetProperty(property, value);
596
+		}
597
+
598
+	    /**
599
+	     * The method is used to retrieve specific decoder properties in the decoder configuration.
600
+	     */
601
+		public int getProperty(int property){
602
+				return GetProperty(property);
603
+		}
604
+
605
+
606
+}

+ 213 - 0
commonLib/src/main/java/com/hsm/barcode/DecoderConfigValues.java

@@ -0,0 +1,213 @@
1
+package com.hsm.barcode;
2
+/**
3
+ * These are the various classes used for configuring the decoder functionality
4
+ */
5
+public final class DecoderConfigValues {
6
+	private DecoderConfigValues(){
7
+		
8
+	}
9
+	
10
+	public final static class SymbologyID{
11
+		private SymbologyID(){
12
+		}
13
+		public static final int SYM_AZTEC = 0;
14
+	    public static final int SYM_CODABAR = 1;
15
+	    public static final int SYM_CODE11 = 2;
16
+	    public static final int SYM_CODE128 = 3;
17
+	    public static final int SYM_CODE39 = 4;
18
+	    public static final int SYM_CODE49 = 5;         
19
+	    public static final int SYM_CODE93 = 6;
20
+	    public static final int SYM_COMPOSITE = 7;
21
+	    public static final int SYM_DATAMATRIX = 8;
22
+	    public static final int SYM_EAN8 = 9;
23
+	    public static final int SYM_EAN13 = 10;
24
+	    public static final int SYM_INT25 = 11;
25
+	    public static final int SYM_MAXICODE = 12;
26
+	    public static final int SYM_MICROPDF = 13;
27
+	    public static final int SYM_OCR = 14;
28
+	    public static final int SYM_PDF417 = 15;
29
+	    public static final int SYM_POSTNET = 16;
30
+	    public static final int SYM_QR = 17;
31
+	    public static final int SYM_RSS = 18;
32
+	    public static final int SYM_UPCA = 19;
33
+	    public static final int SYM_UPCE0 = 20;
34
+	    public static final int SYM_UPCE1 = 21;
35
+	    public static final int SYM_ISBT = 22;
36
+	    public static final int SYM_BPO = 23;
37
+	    public static final int SYM_CANPOST =24; 
38
+	    public static final int SYM_AUSPOST = 25;
39
+	    public static final int SYM_IATA25 = 26;
40
+	    public static final int SYM_CODABLOCK = 27;
41
+	    public static final int SYM_JAPOST = 28;
42
+	    public static final int SYM_PLANET = 29;
43
+	    public static final int SYM_DUTCHPOST = 30;
44
+	    public static final int SYM_MSI = 31;
45
+	    public static final int SYM_TLCODE39 = 32; 
46
+	    public static final int SYM_TRIOPTIC = 33;
47
+		public static final int SYM_CODE32 = 34;
48
+		public static final int SYM_STRT25 = 35;
49
+		public static final int SYM_MATRIX25 = 36;
50
+	    public static final int SYM_PLESSEY = 37;   
51
+		public static final int SYM_CHINAPOST = 38;
52
+		public static final int SYM_KOREAPOST = 39;
53
+		public static final int SYM_TELEPEN = 40;
54
+	    public static final int SYM_CODE16K = 41;     
55
+	    public static final int SYM_POSICODE = 42;       
56
+		public static final int SYM_COUPONCODE = 43;
57
+	    public static final int SYM_USPS4CB = 44;
58
+		public static final int SYM_IDTAG = 45;
59
+	    public static final int SYM_LABEL = 46;         
60
+		public static final int SYM_GS1_128 = 47;
61
+	    public static final int SYM_HANXIN = 48;
62
+	    public static final int SYM_GRIDMATRIX = 49;    
63
+		public static final int SYM_POSTALS = 50;		
64
+	    public static final int SYM_US_POSTALS1 = 51;   
65
+	    public static final int SYMBOLOGIES = 52;
66
+	    public static final int SYM_ALL = 100;
67
+	}
68
+
69
+	public final class SymbologyFlags {
70
+		private SymbologyFlags(){
71
+			
72
+		}
73
+		
74
+		// Flags for use by SymbologyConfig class
75
+		public static final int SYMBOLOGY_ENABLE                = 0x00000001;  // Enable Symbology bit
76
+		public static final int SYMBOLOGY_CHECK_ENABLE          = 0x00000002;  // Enable usage of check character
77
+		public static final int SYMBOLOGY_CHECK_TRANSMIT        = 0x00000004;  // Send check character
78
+		public static final int SYMBOLOGY_START_STOP_XMIT       = 0x00000008;  // Include the start and stop characters in the decoded result string
79
+		public static final int SYMBOLOGY_ENABLE_APPEND_MODE    = 0x00000010;  // Code39 append mode
80
+		public static final int SYMBOLOGY_ENABLE_FULLASCII      = 0x00000020;  // Enable Code39 Full ASCII
81
+		public static final int SYMBOLOGY_NUM_SYS_TRANSMIT      = 0x00000040;  // UPC-A/UPC-e Send Num Sys
82
+		public static final int SYMBOLOGY_2_DIGIT_ADDENDA       = 0x00000080;  // Enable 2 digit Addenda (UPC & EAN)
83
+		public static final int SYMBOLOGY_5_DIGIT_ADDENDA       = 0x00000100;  // Enable 5 digit Addenda (UPC & EAN)
84
+		public static final int SYMBOLOGY_ADDENDA_REQUIRED      = 0x00000200;  // Only allow codes with addenda (UPC & EAN)
85
+		public static final int SYMBOLOGY_ADDENDA_SEPARATOR     = 0x00000400;  // Include Addenda separator space in returned string.
86
+		public static final int SYMBOLOGY_EXPANDED_UPCE         = 0x00000800;  // Extended UPC-E
87
+		public static final int SYMBOLOGY_UPCE1_ENABLE          = 0x00001000;  // UPC-E1 enable (use SYMBOLOGY_ENABLE for UPC-E0)
88
+		public static final int SYMBOLOGY_COMPOSITE_UPC         = 0x00002000;  // Enable UPC composite codes
89
+		public static final int SYMBOLOGY_AUSTRALIAN_BAR_WIDTH  = 0x00010000;  // Include australian postal bar data in string
90
+		public static final int SYMBOLOGY_128_APPEND			= 0x00080000;  // Enable OR dISBALE Code 128 FNC2 append functionality
91
+		public static final int SYMBOLOGY_RSE_ENABLE            = 0x00800000;  // Enable RSS Expanded bit
92
+		public static final int SYMBOLOGY_RSL_ENABLE            = 0x01000000;  // Enable RSS Limited bit
93
+		public static final int SYMBOLOGY_RSS_ENABLE            = 0x02000000;  // Enable RSS bit
94
+		public static final int SYMBOLOGY_RSX_ENABLE_MASK       = 0x03800000;  // Enable all RSS versions
95
+		public static final int SYMBOLOGY_TELEPEN_OLD_STYLE     = 0x04000000;  // Telepen Old Style mode.
96
+		public static final int SYMBOLOGY_POSICODE_LIMITED_1    = 0x08000000;  // PosiCode Limited of 1
97
+		public static final int SYMBOLOGY_POSICODE_LIMITED_2    = 0x10000000;  // PosiCode Limited of 2
98
+	    public static final int SYMBOLOGY_CODABAR_CONCATENATE   = 0x20000000;  // Codabar concatenate.
99
+ 
100
+		/* SymbologyConfig class masks */
101
+		public static final int SYM_MASK_FLAGS                  = 0x00000001;  // Flags are valid
102
+		public static final int SYM_MASK_MIN_LEN                = 0x00000002;  // Min Length valid
103
+		public static final int SYM_MASK_MAX_LEN                = 0x00000004;  // Max Length valid
104
+		public static final int SYM_MASK_ALL                    = 0x00000007;  // All fields valid
105
+    
106
+	}
107
+	
108
+	
109
+	public final static class EngineID{
110
+		private EngineID(){
111
+		}
112
+		public static final int UNKNOWN	= -1;
113
+		public static final int NONE=0;
114
+		public static final int IMAGER_4200_ENGINE=1;
115
+		public static final int LASER_SE1200_ENGINE=2;
116
+		public static final int LASER_SE1223_ENGINE=3;
117
+		public static final int IMAGER_IT4000_ENGINE=5;
118
+		public static final int IMAGER_IT4100_ENGINE=6;
119
+		public static final int IMAGER_IT4300_ENGINE=7;
120
+		public static final int IMAGER_IT5100_ENGINE=8;
121
+		public static final int IMAGER_IT5300_ENGINE=9;
122
+		public static final int IMAGER_N5603_ENGINE=12;
123
+		public static final int IMAGER_N5600_ENGINE=13;
124
+	}
125
+	
126
+	
127
+	public final static class EngineType{
128
+		private EngineType(){
129
+		}
130
+		
131
+		public static final int UNKNOWN	= -1;
132
+		public static final int NONE = 0;
133
+		public static final int IMAGER = 1;
134
+		public static final int LASER = 2;
135
+	}
136
+
137
+	
138
+	public final static class OCRMode{
139
+		private OCRMode(){
140
+		}
141
+		
142
+		/* Definitions->Properties */
143
+		public static final int OCR_OFF = 0;
144
+		public static final int OCR_NORMAL_VIDEO =1;
145
+		public static final int OCR_INVERSE = 2;
146
+		public static final int OCR_BOTH = 3;
147
+	}		
148
+	
149
+
150
+	public final static class OCRTemplate{
151
+		private OCRTemplate(){
152
+		}
153
+	
154
+		public static final int USER = 0x0001;
155
+		public static final int PASSPORT = 0x0002;
156
+		public static final int ISBN = 0x0004;
157
+		public static final int PRICE_FIELD = 0x0008;
158
+		public static final int MICRE13B = 0x0010;
159
+	}		
160
+	
161
+	
162
+	public final static class LightsMode{
163
+		private LightsMode(){
164
+		}
165
+	
166
+		public static final int ILLUM_AIM_OFF = 0; 	/* Neither aimer or illumination */
167
+		public static final int AIMER_ONLY = 1;		/* Aimer only */
168
+		public static final int ILLUM_ONLY = 2;		/* Illumination only */
169
+		public static final int ILLUM_AIM_ON = 3;	/* Aimer and illumination alternating */
170
+		public static final int CONCURRENT = 4;		/* Both aimer and illumination */
171
+	}		
172
+	
173
+	
174
+	public final static class IQImageFormat{
175
+		private IQImageFormat(){
176
+		}
177
+	
178
+		public static final int RAW_BINARY = 0; 	
179
+		public static final int RAW_GRAY = 1;		
180
+	}		
181
+	
182
+	
183
+	public final static class ScanMode{
184
+		private ScanMode(){
185
+		}
186
+		public static final int BATCH = 0;
187
+		public static final int STREAM = 1;
188
+		public static final int CONCURRENT_IQ = 2;
189
+		public static final int CONCURRENT_FAST = 3;
190
+		public static final int CONCURRENT_FAST_IQ = 4;
191
+		public static final int CONFIG_NUMBER = 5;
192
+	}		
193
+	
194
+	public final static class ExposureMode{
195
+		private ExposureMode(){
196
+		}
197
+		public static final int FIXED = 0;
198
+		public static final int ONCHIP = 1;
199
+		public static final int HHP = 2;
200
+		public static final int AUTO_PRESENTATION = 3;
201
+		public static final int CONTEXT_SENSITIVE = 4;
202
+		public static final int OPENLOOP_GAIN = 5;
203
+		public static final int CELLPHONE = 6;
204
+		public static final int AUTO_DUAL_TRACK = 7;
205
+		public static final int CONTEXT_DUAL_TRACK = 8;
206
+		public static final int TEST_PATTERN = 9;
207
+	}		
208
+	
209
+	
210
+
211
+	
212
+
213
+}

+ 71 - 0
commonLib/src/main/java/com/hsm/barcode/ExposureValues.java

@@ -0,0 +1,71 @@
1
+package com.hsm.barcode;
2
+
3
+public final class ExposureValues {
4
+	private ExposureValues(){
5
+		
6
+	}
7
+
8
+	public class Setting{
9
+		public Setting(){
10
+		}
11
+		public static final int AutoExposureMode = 0;
12
+		public static final int MethodToUse = 1;
13
+		public static final int TargetValue = 2;
14
+		public static final int TargetPercentile = 3;
15
+		public static final int TargetAcceptanceGap = 4;
16
+		public static final int MaximumExposure = 5;
17
+		public static final int MaximumGain = 6;
18
+		public static final int StartingExposure = 7;
19
+		public static final int StartingGain = 8;
20
+		public static final int FrameRate = 9;
21
+		public static final int ImageMustConform = 10;
22
+		public static final int TriesForConforming = 11;
23
+		public static final int SpecularExclusion = 12;
24
+		public static final int SpecialSpecularSaturation = 13;
25
+		public static final int SpecialSpecularLimit = 14;
26
+		public static final int AdjustExpWhenIllumOff = 15;
27
+		public static final int FixedExposure = 16;
28
+		public static final int FixedGain = 17;
29
+		public static final int FixedFrameRate = 18;
30
+		
31
+	}	
32
+	
33
+	
34
+	// Values used to set the auto exposure method that will be used during image capture
35
+	public final static class Method{
36
+		private Method(){
37
+		}
38
+		public static final int UNIFORM = 0;
39
+	    public static final int CENTER_ONLY = 1;
40
+	    public static final int CENTER_WEIGHTED = 2;
41
+	}
42
+
43
+	// Values used to set exposure specular exclusion settings in exposure settings class
44
+	public final class SpecularExclusion {
45
+		private SpecularExclusion(){
46
+		}
47
+		
48
+		public static final int OFF = 0;   
49
+		public static final int MINIMAL = 1;  
50
+		public static final int MODERATE = 2;  
51
+		public static final int AGGRESSIVE = 3;  
52
+		public static final int SPECIAL = 4;  
53
+	}
54
+	
55
+	
56
+	// Values used to set the auto exposure mode that will be used during image capture
57
+	public final static class AutoExposureMode{
58
+		private AutoExposureMode(){
59
+		}
60
+		public static final int FIXED = 0;
61
+		public static final int ON_CHIP = 1;
62
+		public static final int HHP = 2;
63
+		public static final int HHP_PRESENTATION = 3;
64
+		public static final int CONTEXT_SENSITIVE = 4;
65
+		public static final int OPENLOOP_GAIN = 5;
66
+		public static final int CELLPHONE = 6;
67
+		public static final int DUAL_TRACK = 7;
68
+		public static final int CONTEXT_SENSITIVE_DUAL_TRACK = 8;
69
+	}
70
+
71
+}

+ 15 - 0
commonLib/src/main/java/com/hsm/barcode/IQImagingProperties.java

@@ -0,0 +1,15 @@
1
+package com.hsm.barcode;
2
+
3
+
4
+public class IQImagingProperties{
5
+	public IQImagingProperties(){
6
+	}
7
+	public int AspectRatio;
8
+	public int X_Offset;
9
+	public int Y_Offset;
10
+	public int Width;
11
+	public int Height;
12
+	public int Resolution;
13
+	public int Format;
14
+	public int Reserved;
15
+}

+ 13 - 0
commonLib/src/main/java/com/hsm/barcode/ImageAttributes.java

@@ -0,0 +1,13 @@
1
+package com.hsm.barcode;
2
+
3
+public class ImageAttributes {
4
+	public ImageAttributes() {
5
+	}
6
+
7
+	public int ImageSize;
8
+	public int ExposureValue;
9
+	public int GainValue;
10
+	public int IlluminationValue;
11
+	public int IlluminationMaxValue;
12
+	public int IlluminationClipValue;
13
+}

+ 26 - 0
commonLib/src/main/java/com/hsm/barcode/ImagerProperties.java

@@ -0,0 +1,26 @@
1
+package com.hsm.barcode;
2
+
3
+public class ImagerProperties{
4
+	public ImagerProperties(){
5
+	}
6
+	public int Size;
7
+	public int EngineID;
8
+    public int Rows;
9
+    public int Columns;
10
+    public int BitsPerPixel;
11
+	public int Rotation;
12
+	public int AimerXoffset;
13
+	public int AimerYoffset;
14
+	public int YDepth;
15
+	public int ColorFormat;
16
+	public int NumBuffers;
17
+	public int PSOCMajorRev;
18
+	public int PSOCMinorRev;
19
+	public String EngineSerialNum;
20
+	public int FirmwareEngineID;
21
+	public int AimerType;
22
+	public int AimerColor;
23
+	public int IllumColor;
24
+	public int Optics;
25
+	public String EnginePartNum;
26
+}

+ 15 - 0
commonLib/src/main/java/com/hsm/barcode/SymbologyConfig.java

@@ -0,0 +1,15 @@
1
+package com.hsm.barcode;
2
+
3
+public class SymbologyConfig{
4
+	public SymbologyConfig(int symbologyID){
5
+		this.symID = symbologyID;
6
+		
7
+	}
8
+	public int symID;
9
+	public int Mask;
10
+	public int Flags;
11
+	public int MinLength;
12
+	public int MaxLength;
13
+}
14
+
15
+

+ 85 - 0
commonLib/src/main/java/com/rodinbell/uhf/serialport/SerialPort.java

@@ -0,0 +1,85 @@
1
+/*
2
+ * Copyright 2009 Cedric Priscal
3
+ * 
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * 
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * 
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License. 
15
+ */
16
+
17
+package com.rodinbell.uhf.serialport;
18
+
19
+import java.io.File;
20
+import java.io.FileDescriptor;
21
+import java.io.FileInputStream;
22
+import java.io.FileOutputStream;
23
+import java.io.IOException;
24
+import java.io.InputStream;
25
+import java.io.OutputStream;
26
+
27
+import android.util.Log;
28
+
29
+public class SerialPort {
30
+
31
+	private static final String TAG = "SerialPort";
32
+
33
+	/*
34
+	 * Do not remove or rename the field mFd: it is used by native method close();
35
+	 */
36
+	private FileDescriptor mFd;
37
+	private FileInputStream mFileInputStream;
38
+	private FileOutputStream mFileOutputStream;
39
+
40
+	public SerialPort(File device, int baudrate, int flags) throws SecurityException, IOException {
41
+
42
+		/* Check access permission */
43
+		if (!device.canRead() || !device.canWrite()) {
44
+			try {
45
+				/* Missing read/write permission, trying to chmod the file */
46
+				Process su;
47
+				su = Runtime.getRuntime().exec("/system/bin/su");
48
+				String cmd = "chmod 666 " + device.getAbsolutePath() + "\n"
49
+						+ "exit\n";
50
+				su.getOutputStream().write(cmd.getBytes());
51
+				if ((su.waitFor() != 0) || !device.canRead()
52
+						|| !device.canWrite()) {
53
+					throw new SecurityException();
54
+				}
55
+			} catch (Exception e) {
56
+				e.printStackTrace();
57
+				throw new SecurityException();
58
+			}
59
+		}
60
+
61
+		mFd = open(device.getAbsolutePath(), baudrate, flags);
62
+		if (mFd == null) {
63
+			Log.e(TAG, "native open returns null");
64
+			throw new IOException();
65
+		}
66
+		mFileInputStream = new FileInputStream(mFd);
67
+		mFileOutputStream = new FileOutputStream(mFd);
68
+	}
69
+
70
+	// Getters and setters
71
+	public InputStream getInputStream() {
72
+		return mFileInputStream;
73
+	}
74
+
75
+	public OutputStream getOutputStream() {
76
+		return mFileOutputStream;
77
+	}
78
+
79
+	// JNI
80
+	private native static FileDescriptor open(String path, int baudrate, int flags);
81
+	public native void close();
82
+	static {
83
+		System.loadLibrary("serial_port_u7");
84
+	}
85
+}

+ 122 - 0
commonLib/src/main/java/com/rodinbell/uhf/serialport/SerialPortFinder.java

@@ -0,0 +1,122 @@
1
+/*
2
+ * Copyright 2009 Cedric Priscal
3
+ * 
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ * 
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ * 
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License. 
15
+ */
16
+
17
+package com.rodinbell.uhf.serialport;
18
+
19
+import java.io.File;
20
+import java.io.FileReader;
21
+import java.io.IOException;
22
+import java.io.LineNumberReader;
23
+import java.util.Iterator;
24
+import java.util.Vector;
25
+
26
+import android.util.Log;
27
+
28
+public class SerialPortFinder {
29
+
30
+	public class Driver {
31
+		public Driver(String name, String root) {
32
+			mDriverName = name;
33
+			mDeviceRoot = root;
34
+		}
35
+		private String mDriverName;
36
+		private String mDeviceRoot;
37
+		Vector<File> mDevices = null;
38
+		public Vector<File> getDevices() {
39
+			if (mDevices == null) {
40
+				mDevices = new Vector<File>();
41
+				File dev = new File("/dev");
42
+				File[] files = dev.listFiles();
43
+				int i;
44
+				for (i=0; i<files.length; i++) {
45
+					if (files[i].getAbsolutePath().startsWith(mDeviceRoot)) {
46
+						Log.d(TAG, "Found new device: " + files[i]);
47
+						mDevices.add(files[i]);
48
+					}
49
+				}
50
+			}
51
+			return mDevices;
52
+		}
53
+		public String getName() {
54
+			return mDriverName;
55
+		}
56
+	}
57
+
58
+	private static final String TAG = "SerialPort";
59
+
60
+	private Vector<Driver> mDrivers = null;
61
+
62
+	Vector<Driver> getDrivers() throws IOException {
63
+		if (mDrivers == null) {
64
+			mDrivers = new Vector<Driver>();
65
+			LineNumberReader r = new LineNumberReader(new FileReader("/proc/tty/drivers"));
66
+			String l;
67
+			while((l = r.readLine()) != null) {
68
+				// Issue 3:
69
+				// Since driver name may contain spaces, we do not extract driver name with split()
70
+				String drivername = l.substring(0, 0x15).trim();
71
+				String[] w = l.split(" +");
72
+				if ((w.length >= 5) && (w[w.length-1].equals("serial"))) {
73
+					Log.d(TAG, "Found new driver " + drivername + " on " + w[w.length-4]);
74
+					mDrivers.add(new Driver(drivername, w[w.length-4]));
75
+				}
76
+			}
77
+			r.close();
78
+		}
79
+		return mDrivers;
80
+	}
81
+
82
+	public String[] getAllDevices() {
83
+		Vector<String> devices = new Vector<String>();
84
+		// Parse each driver
85
+		Iterator<Driver> itdriv;
86
+		try {
87
+			itdriv = getDrivers().iterator();
88
+			while(itdriv.hasNext()) {
89
+				Driver driver = itdriv.next();
90
+				Iterator<File> itdev = driver.getDevices().iterator();
91
+				while(itdev.hasNext()) {
92
+					String device = itdev.next().getName();
93
+					String value = String.format("%s (%s)", device, driver.getName());
94
+					devices.add(value);
95
+				}
96
+			}
97
+		} catch (IOException e) {
98
+			e.printStackTrace();
99
+		}
100
+		return devices.toArray(new String[devices.size()]);
101
+	}
102
+
103
+	public String[] getAllDevicesPath() {
104
+		Vector<String> devices = new Vector<String>();
105
+		// Parse each driver
106
+		Iterator<Driver> itdriv;
107
+		try {
108
+			itdriv = getDrivers().iterator();
109
+			while(itdriv.hasNext()) {
110
+				Driver driver = itdriv.next();
111
+				Iterator<File> itdev = driver.getDevices().iterator();
112
+				while(itdev.hasNext()) {
113
+					String device = itdev.next().getAbsolutePath();
114
+					devices.add(device);
115
+				}
116
+			}
117
+		} catch (IOException e) {
118
+			e.printStackTrace();
119
+		}
120
+		return devices.toArray(new String[devices.size()]);
121
+	}
122
+}

BIN
commonLib/src/main/res/drawable-hdpi/ic_launcher.png


BIN
commonLib/src/main/res/drawable-mdpi/ic_launcher.png


BIN
commonLib/src/main/res/drawable-xhdpi/ic_launcher.png


BIN
commonLib/src/main/res/drawable/ico_andriod.png


BIN
commonLib/src/main/res/drawable/ico_home.png


BIN
commonLib/src/main/res/drawable/ico_menu.png


+ 8 - 0
commonLib/src/main/res/drawable/selector_ico_android.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3
+    
4
+    <item android:state_pressed="true" android:drawable="@drawable/shape_ico_android_pressed"></item>
5
+    <item android:state_focused="true" android:drawable="@drawable/shape_ico_android_pressed"></item>
6
+    <item android:drawable="@drawable/shape_ico_android_normal"></item>
7
+	
8
+</selector>

+ 8 - 0
commonLib/src/main/res/drawable/selector_ico_home.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+    <item android:drawable="@drawable/shape_ico_home_pressed" android:state_pressed="true"></item>
5
+    <item android:drawable="@drawable/shape_ico_home_pressed" android:state_focused="true"></item>
6
+    <item android:drawable="@drawable/shape_ico_home_normal"></item>
7
+
8
+</selector>

+ 8 - 0
commonLib/src/main/res/drawable/selector_ico_menu.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
3
+    
4
+    <item android:state_pressed="true" android:drawable="@drawable/shape_ico_menu_pressed"></item>
5
+    <item android:state_focused="true" android:drawable="@drawable/shape_ico_menu_pressed"></item>
6
+    <item android:drawable="@drawable/shape_ico_menu_normal"></item>
7
+
8
+</selector>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_android_normal.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+    <solid android:color="@color/bottom_nav_normal" />
7
+
8
+</shape>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_android_pressed.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+	<solid android:color="@color/bottom_nav_pressed"/>
7
+    
8
+</shape>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_home_normal.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+    <solid android:color="@color/bottom_nav_normal" />
7
+	
8
+</shape>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_home_pressed.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+	<solid android:color="@color/bottom_nav_pressed"/>
7
+    
8
+</shape>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_menu_normal.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+	<solid android:color="@color/bottom_nav_normal" />
7
+    
8
+</shape>

+ 8 - 0
commonLib/src/main/res/drawable/shape_ico_menu_pressed.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<shape xmlns:android="http://schemas.android.com/apk/res/android" 
3
+    android:shape="rectangle"
4
+    >
5
+    
6
+	<solid android:color="@color/bottom_nav_pressed"/>
7
+    
8
+</shape>

+ 45 - 0
commonLib/src/main/res/layout/bottom_nav.xml

@@ -0,0 +1,45 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:layout_width="match_parent"
4
+    android:layout_height="wrap_content" 
5
+    android:background="@android:color/black"
6
+    >
7
+    
8
+    <ImageView
9
+        android:id="@+id/bottom_nav_left"
10
+        android:layout_width="wrap_content"
11
+        android:layout_height="wrap_content"
12
+        android:layout_alignParentLeft="true"
13
+        android:src="@drawable/ico_andriod"
14
+        android:background="@drawable/selector_ico_android"
15
+        android:contentDescription="@string/content_description"
16
+        android:visibility="visible"
17
+        android:padding="5dp"
18
+        />
19
+    
20
+    <ImageView 
21
+        android:id="@+id/bottom_nav_middle"
22
+        android:layout_width="wrap_content"
23
+        android:layout_height="wrap_content"
24
+        android:layout_centerInParent="true"
25
+        android:src="@drawable/ico_home"
26
+        android:background="@drawable/selector_ico_home"
27
+        android:contentDescription="@string/content_description"
28
+        android:visibility="visible"
29
+        android:padding="5dp"
30
+        />
31
+    
32
+    <ImageView 
33
+        android:id="@+id/bottom_nav_right"
34
+        android:layout_width="wrap_content"
35
+        android:layout_height="wrap_content"
36
+        android:layout_alignParentRight="true"
37
+        android:src="@drawable/ico_menu"
38
+        android:background="@drawable/selector_ico_menu"
39
+        android:contentDescription="@string/content_description"
40
+        android:visibility="visible"
41
+        android:padding="5dp"
42
+        />
43
+    
44
+
45
+</RelativeLayout>

+ 8 - 0
commonLib/src/main/res/layout/bottom_nav_right_menu.xml

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<ListView xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:id="@+id/bottom_nav_right_menu"
4
+    android:layout_width="wrap_content"
5
+    android:layout_height="wrap_content"
6
+    android:cacheColorHint="@null"
7
+    android:padding="5dp" >
8
+</ListView>

+ 13 - 0
commonLib/src/main/res/layout/bottom_nav_right_menu_item.xml

@@ -0,0 +1,13 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3
+    android:id="@+id/bottom_nav_right_menu_item"
4
+    android:layout_width="wrap_content"
5
+    android:layout_height="wrap_content"
6
+    android:textColor="@android:color/black"
7
+    android:textSize="18sp"
8
+    android:layout_marginTop="5dp"
9
+    android:layout_marginBottom="5dp"
10
+    android:singleLine="true"
11
+    >
12
+
13
+</TextView>

+ 11 - 0
commonLib/src/main/res/values-v11/styles.xml

@@ -0,0 +1,11 @@
1
+<resources>
2
+
3
+    <!--
4
+        Base application theme for API 11+. This theme completely replaces
5
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
6
+    -->
7
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
8
+        <!-- API 11 theme customizations can go here. -->
9
+    </style>
10
+
11
+</resources>

+ 12 - 0
commonLib/src/main/res/values-v14/styles.xml

@@ -0,0 +1,12 @@
1
+<resources>
2
+
3
+    <!--
4
+        Base application theme for API 14+. This theme completely replaces
5
+        AppBaseTheme from BOTH res/values/styles.xml and
6
+        res/values-v11/styles.xml on API 14+ devices.
7
+    -->
8
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9
+        <!-- API 14 theme customizations can go here. -->
10
+    </style>
11
+
12
+</resources>

+ 7 - 0
commonLib/src/main/res/values/colors.xml

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<resources>
3
+    
4
+    <color name="bottom_nav_normal">#00000000</color>
5
+    <color name="bottom_nav_pressed">#88CCEDC7</color>
6
+    
7
+</resources>

+ 4 - 0
commonLib/src/main/res/values/strings.xml

@@ -0,0 +1,4 @@
1
+<resources>
2
+
3
+	<string name="content_description">content_description</string>
4
+</resources>

+ 20 - 0
commonLib/src/main/res/values/styles.xml

@@ -0,0 +1,20 @@
1
+<resources>
2
+
3
+    <!--
4
+        Base application theme, dependent on API level. This theme is replaced
5
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6
+    -->
7
+    <style name="AppBaseTheme" parent="android:Theme.Light">
8
+        <!--
9
+            Theme customizations available in newer API levels can go in
10
+            res/values-vXX/styles.xml, while customizations related to
11
+            backward-compatibility can go here.
12
+        -->
13
+    </style>
14
+
15
+    <!-- Application theme. -->
16
+    <style name="AppTheme" parent="AppBaseTheme">
17
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
18
+    </style>
19
+
20
+</resources>

+ 15 - 0
gradle.properties

@@ -0,0 +1,15 @@
1
+# Project-wide Gradle settings.
2
+# IDE (e.g. Android Studio) users:
3
+# Gradle settings configured through the IDE *will override*
4
+# any settings specified in this file.
5
+# For more details on how to configure your build environment visit
6
+# http://www.gradle.org/docs/current/userguide/build_environment.html
7
+# Specifies the JVM arguments used for the daemon process.
8
+# The setting is particularly useful for tweaking memory settings.
9
+org.gradle.jvmargs=-Xmx1536m
10
+# When configured, Gradle will run in incubating parallel mode.
11
+# This option should only be used with decoupled projects. More details, visit
12
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13
+# org.gradle.parallel=true
14
+android.enableAapt2=false
15
+

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
1
+#Wed Nov 13 17:40:46 CST 2019
2
+distributionBase=GRADLE_USER_HOME
3
+distributionPath=wrapper/dists
4
+zipStoreBase=GRADLE_USER_HOME
5
+zipStorePath=wrapper/dists
6
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

+ 172 - 0
gradlew

@@ -0,0 +1,172 @@
1
+#!/usr/bin/env sh
2
+
3
+##############################################################################
4
+##
5
+##  Gradle start up script for UN*X
6
+##
7
+##############################################################################
8
+
9
+# Attempt to set APP_HOME
10
+# Resolve links: $0 may be a link
11
+PRG="$0"
12
+# Need this for relative symlinks.
13
+while [ -h "$PRG" ] ; do
14
+    ls=`ls -ld "$PRG"`
15
+    link=`expr "$ls" : '.*-> \(.*\)$'`
16
+    if expr "$link" : '/.*' > /dev/null; then
17
+        PRG="$link"
18
+    else
19
+        PRG=`dirname "$PRG"`"/$link"
20
+    fi
21
+done
22
+SAVED="`pwd`"
23
+cd "`dirname \"$PRG\"`/" >/dev/null
24
+APP_HOME="`pwd -P`"
25
+cd "$SAVED" >/dev/null
26
+
27
+APP_NAME="Gradle"
28
+APP_BASE_NAME=`basename "$0"`
29
+
30
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
+DEFAULT_JVM_OPTS=""
32
+
33
+# Use the maximum available, or set MAX_FD != -1 to use that value.
34
+MAX_FD="maximum"
35
+
36
+warn () {
37
+    echo "$*"
38
+}
39
+
40
+die () {
41
+    echo
42
+    echo "$*"
43
+    echo
44
+    exit 1
45
+}
46
+
47
+# OS specific support (must be 'true' or 'false').
48
+cygwin=false
49
+msys=false
50
+darwin=false
51
+nonstop=false
52
+case "`uname`" in
53
+  CYGWIN* )
54
+    cygwin=true
55
+    ;;
56
+  Darwin* )
57
+    darwin=true
58
+    ;;
59
+  MINGW* )
60
+    msys=true
61
+    ;;
62
+  NONSTOP* )
63
+    nonstop=true
64
+    ;;
65
+esac
66
+
67
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68
+
69
+# Determine the Java command to use to start the JVM.
70
+if [ -n "$JAVA_HOME" ] ; then
71
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72
+        # IBM's JDK on AIX uses strange locations for the executables
73
+        JAVACMD="$JAVA_HOME/jre/sh/java"
74
+    else
75
+        JAVACMD="$JAVA_HOME/bin/java"
76
+    fi
77
+    if [ ! -x "$JAVACMD" ] ; then
78
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79
+
80
+Please set the JAVA_HOME variable in your environment to match the
81
+location of your Java installation."
82
+    fi
83
+else
84
+    JAVACMD="java"
85
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86
+
87
+Please set the JAVA_HOME variable in your environment to match the
88
+location of your Java installation."
89
+fi
90
+
91
+# Increase the maximum file descriptors if we can.
92
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93
+    MAX_FD_LIMIT=`ulimit -H -n`
94
+    if [ $? -eq 0 ] ; then
95
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96
+            MAX_FD="$MAX_FD_LIMIT"
97
+        fi
98
+        ulimit -n $MAX_FD
99
+        if [ $? -ne 0 ] ; then
100
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
101
+        fi
102
+    else
103
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104
+    fi
105
+fi
106
+
107
+# For Darwin, add options to specify how the application appears in the dock
108
+if $darwin; then
109
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110
+fi
111
+
112
+# For Cygwin, switch paths to Windows format before running java
113
+if $cygwin ; then
114
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116
+    JAVACMD=`cygpath --unix "$JAVACMD"`
117
+
118
+    # We build the pattern for arguments to be converted via cygpath
119
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
+    SEP=""
121
+    for dir in $ROOTDIRSRAW ; do
122
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
123
+        SEP="|"
124
+    done
125
+    OURCYGPATTERN="(^($ROOTDIRS))"
126
+    # Add a user-defined pattern to the cygpath arguments
127
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
+    fi
130
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
+    i=0
132
+    for arg in "$@" ; do
133
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
135
+
136
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
137
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
+        else
139
+            eval `echo args$i`="\"$arg\""
140
+        fi
141
+        i=$((i+1))
142
+    done
143
+    case $i in
144
+        (0) set -- ;;
145
+        (1) set -- "$args0" ;;
146
+        (2) set -- "$args0" "$args1" ;;
147
+        (3) set -- "$args0" "$args1" "$args2" ;;
148
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
+    esac
155
+fi
156
+
157
+# Escape application args
158
+save () {
159
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+    echo " "
161
+}
162
+APP_ARGS=$(save "$@")
163
+
164
+# Collect all arguments for the java command, following the shell quoting and substitution rules
165
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166
+
167
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169
+  cd "$(dirname "$0")"
170
+fi
171
+
172
+exec "$JAVACMD" "$@"

+ 84 - 0
gradlew.bat

@@ -0,0 +1,84 @@
1
+@if "%DEBUG%" == "" @echo off
2
+@rem ##########################################################################
3
+@rem
4
+@rem  Gradle startup script for Windows
5
+@rem
6
+@rem ##########################################################################
7
+
8
+@rem Set local scope for the variables with windows NT shell
9
+if "%OS%"=="Windows_NT" setlocal
10
+
11
+set DIRNAME=%~dp0
12
+if "%DIRNAME%" == "" set DIRNAME=.
13
+set APP_BASE_NAME=%~n0
14
+set APP_HOME=%DIRNAME%
15
+
16
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+set DEFAULT_JVM_OPTS=
18
+
19
+@rem Find java.exe
20
+if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+set JAVA_EXE=java.exe
23
+%JAVA_EXE% -version >NUL 2>&1
24
+if "%ERRORLEVEL%" == "0" goto init
25
+
26
+echo.
27
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+echo.
29
+echo Please set the JAVA_HOME variable in your environment to match the
30
+echo location of your Java installation.
31
+
32
+goto fail
33
+
34
+:findJavaFromJavaHome
35
+set JAVA_HOME=%JAVA_HOME:"=%
36
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+if exist "%JAVA_EXE%" goto init
39
+
40
+echo.
41
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+echo.
43
+echo Please set the JAVA_HOME variable in your environment to match the
44
+echo location of your Java installation.
45
+
46
+goto fail
47
+
48
+:init
49
+@rem Get command-line arguments, handling Windows variants
50
+
51
+if not "%OS%" == "Windows_NT" goto win9xME_args
52
+
53
+:win9xME_args
54
+@rem Slurp the command line arguments.
55
+set CMD_LINE_ARGS=
56
+set _SKIP=2
57
+
58
+:win9xME_args_slurp
59
+if "x%~1" == "x" goto execute
60
+
61
+set CMD_LINE_ARGS=%*
62
+
63
+:execute
64
+@rem Setup the command line
65
+
66
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
+
68
+@rem Execute Gradle
69
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
+
71
+:end
72
+@rem End local scope for the variables with windows NT shell
73
+if "%ERRORLEVEL%"=="0" goto mainEnd
74
+
75
+:fail
76
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
+rem the _cmd.exe /c_ return code!
78
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
+exit /b 1
80
+
81
+:mainEnd
82
+if "%OS%"=="Windows_NT" endlocal
83
+
84
+:omega

+ 1 - 0
mylibrary/.gitignore

@@ -0,0 +1 @@
1
+/build

+ 52 - 0
mylibrary/build.gradle

@@ -0,0 +1,52 @@
1
+apply plugin: 'com.android.library'
2
+apply plugin: 'com.jakewharton.butterknife'
3
+
4
+android {
5
+    compileSdkVersion 28
6
+
7
+    defaultConfig {
8
+        minSdkVersion 15
9
+//        targetSdkVersion 22
10
+        targetSdkVersion 28
11
+        versionCode 1
12
+        versionName "1.0"
13
+
14
+        ndk{
15
+            abiFilters "armeabi"
16
+        }
17
+
18
+    }
19
+
20
+    buildTypes {
21
+        release {
22
+            minifyEnabled false
23
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24
+        }
25
+    }
26
+
27
+    // Butterknife requires Java 8.
28
+    compileOptions {
29
+        sourceCompatibility 1.8
30
+        targetCompatibility 1.8
31
+    }
32
+
33
+    sourceSets {
34
+        main {
35
+            jniLibs.srcDirs = ['libs']
36
+        }
37
+    }
38
+
39
+}
40
+
41
+dependencies {
42
+    api fileTree(dir: 'libs', include: ['*.jar'])
43
+    api project(':commonLib')
44
+
45
+    api 'com.android.support:appcompat-v7:28.0.0'
46
+    api 'com.android.support:design:28.0.0'
47
+    api 'com.google.android:flexbox:1.0.0'
48
+    api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.44'
49
+    api 'com.google.code.gson:gson:2.8.5'
50
+//    api "org.permissionsdispatcher:permissionsdispatcher:3.3.1"
51
+//    annotationProcessor "org.permissionsdispatcher:permissionsdispatcher-processor:3.3.1"
52
+}

BIN
mylibrary/libs/armeabi/libdevapi.so


BIN
mylibrary/libs/armeabi/libirdaSerialPort.so


+ 21 - 0
mylibrary/proguard-rules.pro

@@ -0,0 +1,21 @@
1
+# Add project specific ProGuard rules here.
2
+# You can control the set of applied configuration files using the
3
+# proguardFiles setting in build.gradle.
4
+#
5
+# For more details, see
6
+#   http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+# If your project uses WebView with JS, uncomment the following
9
+# and specify the fully qualified class name to the JavaScript interface
10
+# class:
11
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+#   public *;
13
+#}
14
+
15
+# Uncomment this to preserve the line number information for
16
+# debugging stack traces.
17
+#-keepattributes SourceFile,LineNumberTable
18
+
19
+# If you keep the line number information, uncomment this to
20
+# hide the original source file name.
21
+#-renamesourcefileattribute SourceFile

+ 12 - 0
mylibrary/src/main/AndroidManifest.xml

@@ -0,0 +1,12 @@
1
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+    package="com.mq.mylibrary">
3
+
4
+    <uses-permission android:name="android.permission.NFC" />
5
+    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
6
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8
+    <uses-feature
9
+        android:name="android.hardware.nfc"
10
+        android:required="true" />
11
+
12
+</manifest>

+ 189 - 0
mylibrary/src/main/assets/createSql.sql

@@ -0,0 +1,189 @@
1
+create database paddb;
2
+
3
+create TABLE `users_info` (
4
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
5
+  `user_code` varchar(1000) DEFAULT NULL COMMENT '用户账号',
6
+  `password` varchar(1000) DEFAULT NULL COMMENT '用户密码',
7
+  `real_name` varchar(100) DEFAULT NULL COMMENT '用户名称'
8
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户表';
9
+create TABLE `store_info` (
10
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
11
+  `store_name` varchar(2000) DEFAULT NULL COMMENT '仓房名称',
12
+  `store_id` varchar(2000) DEFAULT NULL COMMENT '仓房Id',
13
+  `store_code` varchar(2000) DEFAULT NULL COMMENT '仓房代码',
14
+  `position_name` varchar(2000) DEFAULT NULL COMMENT '货位名称',
15
+  `position_id` varchar(2000) DEFAULT NULL COMMENT '货位Id',
16
+  `position_code` varchar(2000) DEFAULT NULL COMMENT '货位代码'
17
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='仓房货位表';
18
+create TABLE `worke_team_group` (
19
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
20
+  `real_id` varchar(2000) DEFAULT NULL COMMENT '队、组id',
21
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
22
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组'
23
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='作业队和作业组表';
24
+create TABLE `car_info` (
25
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
26
+  `car_id` varchar(2000) DEFAULT NULL COMMENT '车辆id',
27
+  `car_number` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
28
+  `work_time` varchar(2000) DEFAULT NULL COMMENT '作业日期'
29
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车辆信息表';
30
+create TABLE `grain_type` (
31
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
32
+  `grain_id` varchar(2000) DEFAULT NULL COMMENT '粮油品种id',
33
+  `grain_name` varchar(2000) DEFAULT NULL COMMENT '品种名称',
34
+  `parent_id` varchar(2000) DEFAULT NULL COMMENT '父级id'
35
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='粮油品种表';
36
+create TABLE `load_info` (
37
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
38
+  `inbound_code` varchar(2000) DEFAULT NULL COMMENT '入站单号',
39
+  `train_code` varchar(2000) DEFAULT NULL COMMENT '火车皮号',
40
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
41
+  `grain_id` varchar(2000) DEFAULT NULL COMMENT '粮油品种id',
42
+  `platform_name` varchar(2000) DEFAULT NULL COMMENT '站台',
43
+  `position_name` varchar(2000) DEFAULT NULL COMMENT '货位'
44
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='装车信息表';
45
+create TABLE `zhicang_info` (
46
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
47
+  `task_code` varchar(2000) DEFAULT NULL COMMENT '任务编码',
48
+  `period_id` varchar(2000) DEFAULT NULL COMMENT '期间ID',
49
+  `unit_id` varchar(2000) DEFAULT NULL COMMENT '单位ID',
50
+  `version_id` varchar(2000) DEFAULT NULL COMMENT '版本ID',
51
+  `report_type` varchar(2000) DEFAULT NULL COMMENT '报表类型',
52
+  `report_id` varchar(2000) DEFAULT NULL COMMENT '报表ID',
53
+  `next_id` varchar(2000) DEFAULT NULL COMMENT '下环节ID',
54
+  `work_index_id` varchar(2000) DEFAULT NULL COMMENT '业务编码指标ID',
55
+  `process_id` varchar(2000) DEFAULT NULL COMMENT '流程ID',
56
+  `work_number` varchar(2000) DEFAULT NULL COMMENT '单据号(入门单号)',
57
+  `status` varchar(2000) DEFAULT NULL COMMENT '状态',
58
+  `car` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
59
+  `grain` varchar(2000) DEFAULT NULL COMMENT '粮油品种',
60
+  `level` varchar(2000) DEFAULT NULL COMMENT '粮食等级',
61
+  `plan_house` varchar(2000) DEFAULT NULL COMMENT '拟入出仓号',
62
+  `plan_position` varchar(2000) DEFAULT NULL COMMENT '拟入出货位号',
63
+  `quality` varchar(2000) DEFAULT NULL COMMENT '粮食质量信息',
64
+  `weight` varchar(2000) DEFAULT NULL COMMENT '毛/皮重(公斤)',
65
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
66
+  `work_flg` varchar(2000) DEFAULT NULL COMMENT '业务标识',
67
+  `real_house` varchar(2000) DEFAULT NULL COMMENT '实际仓房',
68
+  `real_position` varchar(2000) DEFAULT NULL COMMENT '实际货位',
69
+  `deduct_water` varchar(2000) DEFAULT NULL COMMENT '现场扣水',
70
+  `deduct_sundries` varchar(2000) DEFAULT NULL COMMENT '现场扣杂',
71
+  `deduct_other` varchar(2000) DEFAULT NULL COMMENT '现场扣其他',
72
+  `deduct_pack` varchar(2000) DEFAULT NULL COMMENT '包装物扣量',
73
+  `deduct_percent` varchar(2000) DEFAULT NULL COMMENT '现场扣百分比',
74
+  `work_unit` varchar(2000) DEFAULT NULL COMMENT '作业方名称',
75
+  `start_time` varchar(2000) DEFAULT NULL COMMENT '作业开始时间',
76
+  `end_time` varchar(2000) DEFAULT NULL COMMENT '作业结束时间',
77
+  `remark` varchar(2000) DEFAULT NULL COMMENT '备注',
78
+  `keeper` varchar(2000) DEFAULT NULL COMMENT '保管员',
79
+  `pack_type` varchar(2000) DEFAULT NULL COMMENT '包装方式',
80
+  `finish_count` varchar(2000) DEFAULT NULL COMMENT '装卸件数',
81
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
82
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组',
83
+  `real_house_id` varchar(2000) DEFAULT NULL COMMENT '实际仓房ID',
84
+  `real_position_id` varchar(2000) DEFAULT NULL COMMENT '实际货位ID',
85
+  `stop_reasons` varchar(2000) DEFAULT NULL COMMENT '终止原因'
86
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='值仓IC卡表';
87
+create TABLE `zhuang_che_fa_ka` (
88
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
89
+  `inbound_code` varchar(2000) DEFAULT NULL COMMENT '入站单号',
90
+  `train_code` varchar(2000) DEFAULT NULL COMMENT '火车皮号',
91
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
92
+  `grain_id` varchar(2000) DEFAULT NULL COMMENT '粮油品种id',
93
+  `platform_name` varchar(2000) DEFAULT NULL COMMENT '站台',
94
+  `position_name` varchar(2000) DEFAULT NULL COMMENT '货位',
95
+  `car` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
96
+  `finish_count` varchar(2000) DEFAULT NULL COMMENT '装车件数',
97
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
98
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组',
99
+  `entd` varchar(2000) DEFAULT NULL COMMENT '登记人',
100
+  `load_time` varchar(2000) DEFAULT NULL COMMENT '装车时间',
101
+  `work_flg` varchar(2000) DEFAULT NULL COMMENT '业务标识',
102
+  `grain` varchar(2000) DEFAULT NULL COMMENT '粮油品种'
103
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='火车入库-汽车装车(发卡)表';
104
+create TABLE `zhong_zhuan_xie_zai` (
105
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
106
+  `task_code` varchar(2000) DEFAULT NULL COMMENT '任务编码',
107
+  `period_id` varchar(2000) DEFAULT NULL COMMENT '期间ID',
108
+  `unit_id` varchar(2000) DEFAULT NULL COMMENT '单位ID',
109
+  `version_id` varchar(2000) DEFAULT NULL COMMENT '版本ID',
110
+  `report_type` varchar(2000) DEFAULT NULL COMMENT '报表类型',
111
+  `report_id` varchar(2000) DEFAULT NULL COMMENT '报表ID',
112
+  `next_id` varchar(2000) DEFAULT NULL COMMENT '下环节ID',
113
+  `work_index_id` varchar(2000) DEFAULT NULL COMMENT '业务编码指标ID',
114
+  `process_id` varchar(2000) DEFAULT NULL COMMENT '流程ID',
115
+  `work_number` varchar(2000) DEFAULT NULL COMMENT '单据号(入门单号)',
116
+  `status` varchar(2000) DEFAULT NULL COMMENT '状态',
117
+  `check_number` varchar(2000) DEFAULT NULL COMMENT '检斤单号',
118
+  `order_number` varchar(2000) DEFAULT NULL COMMENT '单据号',
119
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
120
+  `grain` varchar(2000) DEFAULT NULL COMMENT '粮油品种',
121
+  `car` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
122
+  `weight` varchar(2000) DEFAULT NULL COMMENT '毛重(公斤)',
123
+  `haulier` varchar(2000) DEFAULT NULL COMMENT '承运人',
124
+  `phone` varchar(2000) DEFAULT NULL COMMENT '承运人电话',
125
+  `work_flg` varchar(2000) DEFAULT NULL COMMENT '业务标识',
126
+  `platform` varchar(2000) DEFAULT NULL COMMENT '站台',
127
+  `position` varchar(2000) DEFAULT NULL COMMENT '货位',
128
+  `finish_count` varchar(2000) DEFAULT NULL COMMENT '卸载件数',
129
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
130
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组',
131
+  `entd` varchar(2000) DEFAULT NULL COMMENT '登记人',
132
+  `start_time` varchar(2000) DEFAULT NULL COMMENT '作业开始时间',
133
+  `end_time` varchar(2000) DEFAULT NULL COMMENT '作业结束时间'
134
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='发运中转-汽车卸载表';
135
+create TABLE `zhong_zhuan_zhuang_che` (
136
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
137
+  `task_code` varchar(2000) DEFAULT NULL COMMENT '任务编码',
138
+  `period_id` varchar(2000) DEFAULT NULL COMMENT '期间ID',
139
+  `unit_id` varchar(2000) DEFAULT NULL COMMENT '单位ID',
140
+  `version_id` varchar(2000) DEFAULT NULL COMMENT '版本ID',
141
+  `report_type` varchar(2000) DEFAULT NULL COMMENT '报表类型',
142
+  `report_id` varchar(2000) DEFAULT NULL COMMENT '报表ID',
143
+  `next_id` varchar(2000) DEFAULT NULL COMMENT '下环节ID',
144
+  `work_index_id` varchar(2000) DEFAULT NULL COMMENT '业务编码指标ID',
145
+  `process_id` varchar(2000) DEFAULT NULL COMMENT '流程ID',
146
+  `work_number` varchar(2000) DEFAULT NULL COMMENT '单据号(入门单号)',
147
+  `status` varchar(2000) DEFAULT NULL COMMENT '状态',
148
+  `order_number` varchar(2000) DEFAULT NULL COMMENT '单据号',
149
+  `pick_up_goods_num` varchar(2000) DEFAULT NULL COMMENT '提货单号',
150
+  `pick_up_goods_count` varchar(2000) DEFAULT NULL COMMENT '提货件数',
151
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
152
+  `car` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
153
+  `train_code` varchar(2000) DEFAULT NULL COMMENT '关联火车皮号',
154
+  `grain` varchar(2000) DEFAULT NULL COMMENT '粮油品种',
155
+  `platform` varchar(2000) DEFAULT NULL COMMENT '站台',
156
+  `position` varchar(2000) DEFAULT NULL COMMENT '货位',
157
+  `weight` varchar(2000) DEFAULT NULL COMMENT '皮重(公斤)',
158
+  `haulier` varchar(2000) DEFAULT NULL COMMENT '承运人',
159
+  `phone` varchar(2000) DEFAULT NULL COMMENT '承运人电话',
160
+  `measure_type` varchar(2000) DEFAULT NULL COMMENT '计量方式',
161
+  `work_flg` varchar(2000) DEFAULT NULL COMMENT '业务标识',
162
+  `finish_count` varchar(2000) DEFAULT NULL COMMENT '装车件数',
163
+  `single_weight` varchar(2000) DEFAULT NULL COMMENT '单件重量(公斤)',
164
+  `finish_weight` varchar(2000) DEFAULT NULL COMMENT '装车重量(公斤)',
165
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
166
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组',
167
+  `entd` varchar(2000) DEFAULT NULL COMMENT '登记人',
168
+  `start_time` varchar(2000) DEFAULT NULL COMMENT '作业开始时间',
169
+  `end_time` varchar(2000) DEFAULT NULL COMMENT '作业结束时间'
170
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='到站中转-汽车装车表';
171
+create TABLE `xie_zai_xiao_ka` (
172
+  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
173
+  `check_number` varchar(2000) DEFAULT NULL COMMENT '检斤单号',
174
+  `work_number` varchar(2000) DEFAULT NULL COMMENT '单据号',
175
+  `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
176
+  `grain` varchar(2000) DEFAULT NULL COMMENT '粮油品种',
177
+  `car` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
178
+  `tare` varchar(2000) DEFAULT NULL COMMENT '皮重(公斤)',
179
+  `gross_weight` varchar(2000) DEFAULT NULL COMMENT '毛重(公斤)',
180
+  `work_flg` varchar(2000) DEFAULT NULL COMMENT '业务标识',
181
+  `platform` varchar(2000) DEFAULT NULL COMMENT '站台',
182
+  `position` varchar(2000) DEFAULT NULL COMMENT '货位',
183
+  `finish_count` varchar(2000) DEFAULT NULL COMMENT '卸载件数',
184
+  `work_team` varchar(2000) DEFAULT NULL COMMENT '作业队',
185
+  `work_group` varchar(2000) DEFAULT NULL COMMENT '作业组',
186
+  `entd` varchar(2000) DEFAULT NULL COMMENT '登记人',
187
+  `start_time` varchar(2000) DEFAULT NULL COMMENT '作业开始时间',
188
+  `end_time` varchar(2000) DEFAULT NULL COMMENT '作业结束时间'
189
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='火车出库-汽车卸载(销卡)表';

+ 7 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/Error.java

@@ -0,0 +1,7 @@
1
+package cn.pda.rfid.hf;
2
+
3
+public interface Error {
4
+	public int getErrorCode();
5
+
6
+	public void setErrorCode(int errorCode);
7
+}

+ 72 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/HfConmmand.java

@@ -0,0 +1,72 @@
1
+package cn.pda.rfid.hf;
2
+
3
+import java.util.List;
4
+
5
+
6
+public interface HfConmmand {
7
+	/**
8
+	 * 14443A 寻卡
9
+	 * @return
10
+	 */
11
+	public byte[] findCard14443A(Error error);
12
+
13
+	/**
14
+	 * 14443A 认证
15
+	 * @param authType 认证类型 01--A 02--B
16
+	 @param access 密码
17
+	  * @param uid 14443A uid
18
+	 * @param sector 卡扇区
19
+	 * @return
20
+	 */
21
+	public int auth14443A(int authType, byte[] access, byte[] uid, int sector, Error error);
22
+
23
+	/**
24
+	 * 14443A 读块数据
25
+	 * @param block 块号
26
+	 * @return
27
+	 */
28
+	public byte[] read14443A(int block, Error error);
29
+
30
+	/**
31
+	 * 14443A 写数据
32
+	 * @param writeData
33
+	 * @param block
34
+	 * @return
35
+	 */
36
+	public int write14443A(byte[] writeData, int block, Error error);
37
+
38
+	/***
39
+	 * 暂停卡片操作
40
+	 * @return
41
+	 */
42
+	int halt() ;
43
+
44
+	/**
45
+	 * 15693 寻卡
46
+	 * @return
47
+	 */
48
+	public List<Iso15693InventoryInfo> findCard15693(Error error);
49
+
50
+	/**
51
+	 * 15693 获取PICC 系统信息
52
+	 * @param uid
53
+	 * @return
54
+	 */
55
+	public Iso15693CardInformation getInformation15693(byte[] uid, int flags, Error error);
56
+
57
+	/**
58
+	 * 15693 读单块数据
59
+	 * @param uid
60
+	 * @return
61
+	 */
62
+	public byte[] readSingleBlock15693(byte[] uid, int flag, int block, Error error);
63
+
64
+	/**
65
+	 * 15693写数据
66
+	 * @param uid
67
+	 * @param block
68
+	 * @param writeData
69
+	 * @return
70
+	 */
71
+	public int writeSingleBlock(byte[] uid, int flag, int block, byte[] writeData, Error error);
72
+}

+ 15 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/HfError.java

@@ -0,0 +1,15 @@
1
+package cn.pda.rfid.hf;
2
+
3
+public class HfError implements Error{
4
+	
5
+	private int errorCode = -1;
6
+
7
+	public int getErrorCode() {
8
+		return errorCode;
9
+	}
10
+
11
+	public void setErrorCode(int errorCode) {
12
+		this.errorCode = errorCode;
13
+	}
14
+	
15
+}

+ 570 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/HfReader.java

@@ -0,0 +1,570 @@
1
+package cn.pda.rfid.hf;
2
+
3
+import android.util.Log;
4
+
5
+import com.mq.mylibrary.tool.Tools;
6
+
7
+import java.io.IOException;
8
+import java.io.InputStream;
9
+import java.io.OutputStream;
10
+import java.util.ArrayList;
11
+import java.util.Arrays;
12
+import java.util.List;
13
+import java.util.Timer;
14
+import java.util.TimerTask;
15
+
16
+/**
17
+ * Created by zrl on 2017/2/8.
18
+ */
19
+
20
+public class HfReader implements HfConmmand{
21
+    private InputStream is;
22
+    private OutputStream os;
23
+
24
+    private static final byte HEAD_H = (byte) 0x55;
25
+    private static final byte HEAD_L = (byte) 0xAA;
26
+    private static final byte END_L = (byte) 0x55;
27
+    private static final byte END_H = (byte) 0xAA;
28
+
29
+    private static final byte CMD_TYTE_APPL = (byte) 0x44; 				// 应用命令
30
+    private static final byte CMD_TYTE_RESET = (byte) 0x65; 			// 模组复位
31
+    private static final byte CMD_TYTE_GET_SYSINFO = (byte) 0x66; 		// 固件信息
32
+    private static final byte CMD_TYTE_GET_VERSION = (byte) 0x67; 		// 固件版本
33
+
34
+    /** command code **/
35
+    private static final byte ISO_14443A_INIT = (byte) 0xA0; 			// 初始化14443a
36
+    private static final byte ISO_14443A_DEINIT = (byte) 0xAF; 			// 取消初始化
37
+    private static final byte ISO_14443A_FIND_CARD = (byte) 0xA1; 		// 寻卡
38
+    private static final byte ISO_14443A_HLTA = (byte) 0xA3; 			//暂停卡片操作
39
+    private static final byte MIFARE_INIT = (byte) 0xE0; 				// Mifare初始化
40
+    private static final byte MIFARE_DEINIT = (byte) 0xEF; 				// Mifare取消初始化
41
+    private static final byte MIFARE_AUTH_A = (byte) 0xE1; 				// Mifare认证A
42
+    private static final byte MIFARE_AUTH_B = (byte) 0xE2; 				// Mifare认证B
43
+    private static final byte MIFARE_READ_SINGLE = (byte) 0xE5; 		// Mifare读单独块
44
+    private static final byte MIFARE_WRITE_SINGLE = (byte) 0xE6; 		// Mifare写单独块
45
+
46
+    private static final byte ISO_15693_INIT = (byte) 0xD0 ; 			//初始化
47
+    private static final byte ISO_15693_DEINIT = (byte) 0xDF ; 			//取消初始化
48
+    private static final byte ISO_15693_INVENTORY = (byte) 0xD2 ; 		//寻卡
49
+    private static final byte ISO_15693_GET_PICC = (byte) 0xD6 ; 		//获取PICC系统信息
50
+    private static final byte ISO_15693_READ_SINGLE = (byte) 0xD7 ; 	//读单独块
51
+    private static final byte ISO_15693_WRITE_SINGLE = (byte) 0xD8 ; 	//写单独快
52
+
53
+    public static final int AUTH_A = 0;
54
+    public static final int AUTH_B = 1;
55
+
56
+
57
+    /** Error Code **/
58
+    private static final int ERROR_INPUT_OUTPUT_STREAM = -2 ; 	//串口输入输出流出错
59
+
60
+
61
+    public HfReader(InputStream input, OutputStream output) {
62
+        is = input;
63
+        os = output;
64
+        try {
65
+            Thread.sleep(200);
66
+        } catch (InterruptedException e1) {
67
+            e1.printStackTrace();
68
+        }
69
+        try {
70
+            is.read(new byte[16]);
71
+        } catch (IOException e) {
72
+            // TODO Auto-generated catch block
73
+//			e.printStackTrace();
74
+        }
75
+    }
76
+
77
+    /**
78
+     * 填充指令
79
+     * @return
80
+     *   dataLenH   |   dataLenL     |  rspH   |   rspL   |    data   |
81
+     *     1byte		  1byte          1byte    1byte      dataLen
82
+     *
83
+     */
84
+    private byte[] fillContent(byte rspH, byte rspL, byte[] data, int dataLen){
85
+        byte dataLenH = (byte)(dataLen / 256);
86
+        byte dataLenL = (byte) (dataLen % 256);
87
+        byte[] content = new byte[4 + dataLen];
88
+        content[0] = dataLenH;
89
+        content[1] = dataLenL ;
90
+        content[2] = rspH;
91
+        content[3] = rspL;
92
+        if(dataLen > 0){
93
+            System.arraycopy(data, 0, content, 4, dataLen);
94
+        }
95
+        return content;
96
+    }
97
+
98
+    /**
99
+     * 填充指令包
100
+     * @param content
101
+     * @return
102
+     * | headH  | headL |  cmd type  |  content       |  endH   |   endL   |
103
+     *   1byte    1byte     1byte        contentLen      1byte      1byte
104
+     */
105
+    private byte[] genPackage(byte cmdType, byte[] content, int contentLen){
106
+        byte[] cmdPackage = new byte[5 + contentLen];
107
+        cmdPackage[0] = HEAD_H;
108
+        cmdPackage[1] = HEAD_L;
109
+        cmdPackage[2] = cmdType;
110
+        System.arraycopy(content, 0, cmdPackage, 3, contentLen);
111
+        cmdPackage[3 + contentLen] = END_H;
112
+        cmdPackage[4 + contentLen] = END_L ;
113
+        return cmdPackage;
114
+    }
115
+
116
+    private boolean sendCMD(byte[] cmd){
117
+        boolean flag = false ;
118
+        if(os != null){
119
+            try {
120
+                os.write(cmd);
121
+                flag = true ;
122
+            } catch (IOException e) {
123
+            }
124
+        }
125
+        return flag ;
126
+    }
127
+
128
+
129
+    boolean reading = true ;
130
+    //取得返回包
131
+    private byte[] getResponse(byte cmdType){
132
+        int size = 0;
133
+        byte[] buffer = new byte[512];
134
+        byte[] temp = new byte[1024];
135
+        byte[] dataPackage ;
136
+        int index = 0;  //temp有效数据指向
137
+        int count = 0;  //temp有效数据长度
138
+        reading = true;
139
+        //超时保护
140
+        Timer mTimer = new Timer();
141
+        mTimer.schedule(new TimerTask() {
142
+            @Override
143
+            public void run() {
144
+                reading = false ;
145
+            }
146
+        }, 500);
147
+        while(reading){
148
+            try {
149
+                size = is.read(buffer);
150
+                if(size > 0){
151
+                    count+=size ;
152
+                    count += size ;
153
+                    //超出temp长度清空
154
+                    if(count > 512){
155
+                        count = 0;
156
+                        Arrays.fill(temp, (byte)0x00);
157
+                    }
158
+                    //先将接收到的数据拷到temp中
159
+                    System.arraycopy(buffer, 0, temp, index, size);
160
+                    index = index + size ;
161
+                    if(count > 8){
162
+//						Log.e("getResponse", "temp : " + Tools.Bytes2HexString(temp, index));
163
+                        //判断包头和指令类型
164
+                        if(temp[0] == HEAD_H && temp[1] == HEAD_L && temp[2] == cmdType){
165
+                            int dataLen = (temp[5]&0xff)*256 + temp[6]&0xff;
166
+                            if(count < 9 + dataLen){//未收到完整的数据包
167
+                                continue;
168
+                            }
169
+                            if(temp[dataLen + 7] == END_H && temp[dataLen + 8] == END_L){
170
+//								Log.e("getResponse", "getpackage" );
171
+                                dataPackage = new byte[dataLen + 9];
172
+                                System.arraycopy(temp, 0, dataPackage, 0, dataLen + 9);
173
+                                mTimer.cancel();
174
+                                return dataPackage;
175
+                            }
176
+
177
+                        }else{
178
+                            //包错误清空
179
+                            count = 0;
180
+                            index = 0;
181
+                            Arrays.fill(temp, (byte)0x00);
182
+                        }
183
+                    }
184
+                }
185
+            } catch (IOException e) {
186
+
187
+                return null;
188
+            }
189
+        }
190
+        return null;
191
+    }
192
+
193
+    //解析返回数据包,状态信息存入error
194
+    private byte[] handleResp(byte[] resp, Error error){
195
+        int stute = (resp[3]&0xff)*256 + (resp[4]&0xff);
196
+        int dataLen = (resp[5]&0xff)*256 + (resp[6]&0xff);
197
+        byte[] data = null;
198
+        error.setErrorCode(stute);
199
+        if(stute == 0){//状态正确
200
+            if(dataLen > 0){
201
+                data = new byte[dataLen];
202
+                System.arraycopy(resp, 7, data, 0, dataLen);
203
+            }
204
+        }
205
+        return data;
206
+    }
207
+
208
+    //14443A初始化
209
+    private int init14443A(Error error){
210
+        byte[] content = fillContent((byte)0x00, (byte)0x00, new byte[]{ISO_14443A_INIT}, 1);
211
+        byte[] cmd = genPackage(CMD_TYTE_APPL, content, content.length);
212
+        byte[] dataPackage ;
213
+        if(sendCMD(cmd)){
214
+            dataPackage = getResponse(CMD_TYTE_APPL);
215
+            if(dataPackage != null){
216
+                handleResp(dataPackage, error);
217
+            }
218
+        }else{
219
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
220
+        }
221
+        return 0;
222
+    }
223
+
224
+    //14443A取消初始化
225
+    private int deInit14443A(){
226
+        HfError error = new HfError();
227
+        byte[] content = fillContent((byte)0x00, (byte)0x00, new byte[]{ISO_14443A_DEINIT, (byte)0x01}, 2);
228
+        byte[] cmd = genPackage(CMD_TYTE_APPL, content, content.length);
229
+        byte[] dataPackage ;
230
+//		Log.e("deInit14443A", Tools.Bytes2HexString(cmd, cmd.length));
231
+        if(sendCMD(cmd)){
232
+            dataPackage = getResponse(CMD_TYTE_APPL);
233
+            if(dataPackage != null){
234
+                handleResp(dataPackage, error);
235
+            }
236
+        }else{
237
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
238
+        }
239
+        return 0;
240
+    }
241
+
242
+    //Mifare初始化
243
+    private int initMifare(){
244
+        Error error = new HfError();
245
+        byte[] content = fillContent((byte)0x00, (byte)0x00, new byte[]{MIFARE_INIT}, 1);
246
+        byte[] cmd = genPackage(CMD_TYTE_APPL, content, content.length);
247
+        byte[] dataPackage ;
248
+//		Log.e("initMifare", Tools.Bytes2HexString(cmd, cmd.length));
249
+        if(sendCMD(cmd)){
250
+            dataPackage = getResponse(CMD_TYTE_APPL);
251
+            if(dataPackage != null){
252
+                handleResp(dataPackage, error);
253
+            }
254
+        }else{
255
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
256
+        }
257
+        return 0;
258
+    }
259
+
260
+    //Mifare取消初始化
261
+
262
+    //
263
+
264
+    @Override
265
+    public byte[] findCard14443A(Error error) {
266
+        init14443A(error);
267
+        byte[] content = fillContent((byte)0x00, (byte)0x12,
268
+                new byte[]{ISO_14443A_FIND_CARD, (byte)0x26}, 2);//0x26--REQA; 0x52--wupa
269
+        byte[] cmd = genPackage(CMD_TYTE_APPL, content, content.length);
270
+        byte[] uid = null;
271
+        byte[] dataPackage = null;
272
+        Tools.logE("findCard14443A--cmd", Tools.Bytes2HexString(cmd, cmd.length)) ;
273
+        if(sendCMD(cmd)){
274
+            dataPackage = getResponse(CMD_TYTE_APPL);
275
+            if(dataPackage != null){
276
+                byte[] temp = handleResp(dataPackage, error);
277
+                if(temp != null){
278
+//					Log.e("find card 14443A temp", Tools.Bytes2HexString(temp, temp.length));
279
+                    if(temp[3] == (byte)0x01){  //s50
280
+                        uid = new byte[4];
281
+                        System.arraycopy(temp, 7, uid, 0, uid.length);
282
+                    }else if(temp[3] == (byte)0x02){
283
+                        uid = new byte[7];
284
+                        System.arraycopy(temp, 7, uid, 0, uid.length);
285
+                    }
286
+                }
287
+            }
288
+        }else{
289
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
290
+        }
291
+        //取消14443A初始化
292
+        deInit14443A();
293
+        //Mifare初始化
294
+        initMifare();
295
+        return uid;
296
+    }
297
+
298
+    @Override
299
+    public int auth14443A(int authType, byte[] access, byte[] uid, int sector, Error error) {
300
+        byte[] contentData = new byte[3 + access.length + uid.length];
301
+        byte[] content ;
302
+        byte[] cmd ;
303
+        byte[] resp = null;
304
+        if(authType == AUTH_A){
305
+            contentData[0] = MIFARE_AUTH_A;
306
+        }else if(authType == AUTH_B){
307
+            contentData[0] = MIFARE_AUTH_B;
308
+        }
309
+        contentData[1] = (byte) sector;
310
+        System.arraycopy(access, 0, contentData, 2, access.length);
311
+        contentData[2 + access.length] = (byte) uid.length;
312
+        System.arraycopy(uid, 0, contentData, 3 + access.length, uid.length);
313
+        content = fillContent((byte)0x00, (byte)0x01, contentData, contentData.length);
314
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
315
+		Log.e("auth14443A cmd", Tools.Bytes2HexString(cmd, cmd.length));
316
+        if(sendCMD(cmd)){
317
+            resp = getResponse(CMD_TYTE_APPL);
318
+            if(resp != null){
319
+				Log.e("auth14443A resp", Tools.Bytes2HexString(resp, resp.length));
320
+                handleResp(resp, error);
321
+//				if(data != null){
322
+//					Log.e("auth14443A data", Tools.Bytes2HexString(data, data.length));
323
+//				}
324
+            }
325
+        }else{
326
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
327
+        }
328
+        return error.getErrorCode();
329
+    }
330
+
331
+    @Override
332
+    public byte[] read14443A(int block, Error error) {
333
+        byte[] content ;
334
+        byte[] cmd ;
335
+        byte[] resp ;
336
+        byte[] data = null;
337
+        content = fillContent((byte)0x00, (byte)0x12, new byte[]{MIFARE_READ_SINGLE, (byte)block}, 2);
338
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
339
+        if(sendCMD(cmd)){
340
+            resp = getResponse(CMD_TYTE_APPL);
341
+            if(resp != null){
342
+//				Log.e("read14443A resp", Tools.Bytes2HexString(resp, resp.length));
343
+                data = handleResp(resp, error);
344
+            }
345
+        }else{
346
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
347
+        }
348
+        return data;
349
+    }
350
+
351
+    @Override
352
+    public int write14443A(byte[] writeData, int block, Error error) {
353
+        byte[] contentData ;
354
+        byte[] content ;
355
+        byte[] cmd ;
356
+        byte[] resp ;
357
+        contentData = new byte[2 + writeData.length];
358
+        contentData[0] = MIFARE_WRITE_SINGLE;
359
+        contentData[1] = (byte) block;
360
+        System.arraycopy(writeData, 0, contentData, 2, writeData.length);
361
+        content = fillContent((byte)0x00, (byte)0x00, contentData, contentData.length);
362
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
363
+        if(sendCMD(cmd)){
364
+            resp = getResponse(CMD_TYTE_APPL);
365
+            if(resp != null){
366
+//				Log.e("write14443A resp", Tools.Bytes2HexString(resp, resp.length));
367
+                handleResp(resp, error);
368
+            }
369
+        }else{
370
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
371
+        }
372
+
373
+        return error.getErrorCode();
374
+    }
375
+
376
+
377
+    ////////////////////////////////  ISO 15693  /////////////////////////////////////
378
+    private void init15693(Error error){
379
+        byte[] content ;
380
+        byte[] cmd ;
381
+        byte[] resp ;
382
+        content  = fillContent((byte)0x00, (byte)0x04,
383
+                new byte[]{ISO_15693_INIT, (byte)0x00, (byte)0x80}, 3);
384
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
385
+//		Log.e("init15693 cmd", Tools.Bytes2HexString(cmd, cmd.length));
386
+        if(sendCMD(cmd)){
387
+            resp = getResponse(CMD_TYTE_APPL);
388
+            if(resp != null){
389
+                handleResp(resp, error);
390
+//				Log.e("init15693 resp", Tools.Bytes2HexString(resp, resp.length));
391
+            }
392
+        }else{
393
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
394
+        }
395
+    }
396
+
397
+    private void deinit15693(Error error){
398
+        byte[] content ;
399
+        byte[] cmd ;
400
+        byte[] resp ;
401
+        content  = fillContent((byte)0x00, (byte)0x00,
402
+                new byte[]{ISO_15693_DEINIT, (byte)0x00, }, 2);
403
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
404
+//		Log.e("deinit15693 cmd", Tools.Bytes2HexString(cmd, cmd.length));
405
+        if(sendCMD(cmd)){
406
+            resp = getResponse(CMD_TYTE_APPL);
407
+            if(resp != null){
408
+                handleResp(resp, error);
409
+//				Log.e("deinit15693 resp", Tools.Bytes2HexString(resp, resp.length));
410
+            }
411
+        }else{
412
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
413
+        }
414
+    }
415
+
416
+    @Override
417
+    public List<Iso15693InventoryInfo> findCard15693(Error error) {
418
+        deinit15693(error);
419
+        init15693(error);
420
+        byte[] content ;
421
+        byte[] cmd ;
422
+        byte[] resp ;
423
+        List<Iso15693InventoryInfo> listInfo = new ArrayList<Iso15693InventoryInfo>();
424
+        content = fillContent((byte)0x00, (byte)0xFF, new byte[]{ISO_15693_INVENTORY}, 1);
425
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
426
+//		Log.e("findCard15693 cmd", Tools.Bytes2HexString(cmd, cmd.length));
427
+        if(sendCMD(cmd)){
428
+            resp = getResponse(CMD_TYTE_APPL);
429
+            if(resp != null){
430
+                byte[] data = handleResp(resp, error);
431
+
432
+//				Log.e("findCard15693 resp", Tools.Bytes2HexString(resp, resp.length));
433
+                if(data != null){
434
+//					Log.e("findCard15693 data", Tools.Bytes2HexString(data, data.length));
435
+                    int cardCount = data[0]&0xff ;
436
+                    while(cardCount > 0){
437
+                        Iso15693InventoryInfo info = new Iso15693InventoryInfo();
438
+                        info.setFlag(data[10*(cardCount - 1) + 1]);
439
+                        info.setDsfid(data[10*(cardCount - 1) + 2]);
440
+                        byte[] uid = new byte[8];
441
+                        System.arraycopy(data, 10*(cardCount - 1) + 3, uid, 0, 8);
442
+                        cardCount--;
443
+                        info.setUid(uid);
444
+                        listInfo.add(info);
445
+                    }
446
+
447
+                }
448
+            }
449
+        }else{
450
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
451
+        }
452
+        return listInfo;
453
+    }
454
+
455
+    @Override
456
+    public Iso15693CardInformation getInformation15693(byte[] uid, int flag ,Error error) {
457
+        byte[] contentData ;
458
+        byte[] content ;
459
+        byte[] cmd ;
460
+        byte[] resp ;
461
+        Iso15693CardInformation info = null;
462
+        contentData = new byte[2 + uid.length];
463
+        contentData[0] = ISO_15693_GET_PICC;
464
+        contentData[1] = (byte) flag ;
465
+        System.arraycopy(uid, 0, contentData, 2, uid.length);
466
+        content = fillContent((byte)0x00, (byte)0x0f, contentData, contentData.length);
467
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
468
+        if(sendCMD(cmd)){
469
+            resp = getResponse(CMD_TYTE_APPL);
470
+            if(resp != null){
471
+//				Log.e("getInformation15693 resp", Tools.Bytes2HexString(resp, resp.length));
472
+                byte[] data = handleResp(resp, error);
473
+                if(data != null ){
474
+//					Log.e("getInformation15693 data", Tools.Bytes2HexString(data, data.length));
475
+                    info = new Iso15693CardInformation();
476
+                    info.setFlag(data[0]);
477
+                    info.setInformationFlag(data[1]);
478
+                    byte[] mUid = new byte[8];
479
+                    System.arraycopy(data, 2, mUid, 0, 8);
480
+                    info.setUid(mUid);
481
+                    info.setDsfid(data[10]);
482
+                    info.setAfi(data[11]);
483
+                    info.setBlocksCount(data[12]);
484
+                    info.setBlockLen(data[13]);
485
+                    info.setIC_reference(data[14]);
486
+                }
487
+            }
488
+        }else{
489
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
490
+        }
491
+        return info;
492
+    }
493
+
494
+    @Override
495
+    public byte[] readSingleBlock15693(byte[] uid, int flag,int block, Error error) {
496
+        byte[] contentData ;
497
+        byte[] content ;
498
+        byte[] cmd ;
499
+        byte[] resp ;
500
+        byte[] readData = null;
501
+        contentData = new byte[3 + uid.length];
502
+        contentData[0] = ISO_15693_READ_SINGLE;
503
+        contentData[1] = (byte) flag;
504
+        System.arraycopy(uid, 0, contentData, 2, uid.length);
505
+        contentData[2 + uid.length] = (byte) block;
506
+        content = fillContent((byte)0x00, (byte)0x28, contentData, contentData.length);
507
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
508
+        if(sendCMD(cmd)){
509
+            resp = getResponse(CMD_TYTE_APPL);
510
+            if(resp != null){
511
+//				Log.e("readSingleBlock15693 resp", Tools.Bytes2HexString(resp, resp.length));
512
+                byte[] data = handleResp(resp, error);
513
+                if(data != null){
514
+//					Log.e("readSingleBlock15693 data", Tools.Bytes2HexString(data, data.length));
515
+                    readData = new byte[4];
516
+                    System.arraycopy(data, 1, readData, 0, 4);
517
+                }
518
+            }
519
+        }else{
520
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
521
+        }
522
+        return readData;
523
+    }
524
+
525
+    @Override
526
+    public int writeSingleBlock(byte[] uid,int flag, int block, byte[] writeData,
527
+                                Error error) {
528
+        byte[] contentData ;
529
+        byte[] content ;
530
+        byte[] cmd ;
531
+        byte[] resp ;
532
+        contentData = new byte[3 + uid.length + writeData.length];
533
+        contentData[0] = ISO_15693_WRITE_SINGLE;
534
+        contentData[1] = (byte) flag;
535
+        System.arraycopy(uid, 0, contentData, 2, uid.length);
536
+        contentData[2 + uid.length] = (byte) block;
537
+        System.arraycopy(writeData, 0, contentData, 3 + uid.length, writeData.length);
538
+        content = fillContent((byte)0x00, (byte)0x02, contentData, contentData.length);
539
+        cmd = genPackage(CMD_TYTE_APPL, content, content.length);
540
+        if(sendCMD(cmd)){
541
+            resp = getResponse(CMD_TYTE_APPL);
542
+            if(resp != null){
543
+//				Log.e("writeSingleBlock resp", Tools.Bytes2HexString(resp, resp.length));
544
+                byte[] data = handleResp(resp, error);
545
+                if(data != null){
546
+//					Log.e("writeSingleBlock data", Tools.Bytes2HexString(data, data.length));
547
+                }
548
+            }
549
+        }else{
550
+            error.setErrorCode(ERROR_INPUT_OUTPUT_STREAM);
551
+        }
552
+        return error.getErrorCode();
553
+    }
554
+
555
+    @Override
556
+    public int halt() {
557
+        byte[] resp = null;
558
+        byte[] contentData = new byte[]{ISO_14443A_HLTA,(byte)0xAA, (byte)0x2A, (byte)0x05 , (byte)0xF1} ;
559
+        byte[] content = fillContent((byte)0x00,(byte)0x01, contentData, contentData.length) ;
560
+        byte[] cmd = genPackage(CMD_TYTE_APPL, content, content.length) ;
561
+        Tools.logE("hlta--cmd", Tools.Bytes2HexString(cmd, cmd.length)) ;
562
+        if(sendCMD(cmd)){
563
+            resp = getResponse(CMD_TYTE_APPL);
564
+            if(resp != null){
565
+                Tools.logE("hlta--resp", Tools.Bytes2HexString(resp, resp.length)) ;
566
+            }
567
+        }
568
+        return 0;
569
+    }
570
+}

+ 70 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/Iso15693CardInformation.java

@@ -0,0 +1,70 @@
1
+package cn.pda.rfid.hf;
2
+
3
+/**
4
+ * ISO15693 PICCϵͳ��Ϣ
5
+ * @author Administrator
6
+ *
7
+ */
8
+public class Iso15693CardInformation {
9
+	
10
+	private byte flag ;
11
+	private byte informationFlag ;
12
+	private byte[] uid ;
13
+	private byte dsfid;
14
+	private byte afi;
15
+	private int blocksCount;
16
+	private int blockLen ;
17
+	private byte IC_reference;
18
+	
19
+	public byte getFlag() {
20
+		return flag;
21
+	}
22
+	public void setFlag(byte flag) {
23
+		this.flag = flag;
24
+	}
25
+	public byte getInformationFlag() {
26
+		return informationFlag;
27
+	}
28
+	public void setInformationFlag(byte informationFlag) {
29
+		this.informationFlag = informationFlag;
30
+	}
31
+	public byte[] getUid() {
32
+		return uid;
33
+	}
34
+	public void setUid(byte[] uid) {
35
+		this.uid = uid;
36
+	}
37
+	public byte getDsfid() {
38
+		return dsfid;
39
+	}
40
+	public void setDsfid(byte dsfid) {
41
+		this.dsfid = dsfid;
42
+	}
43
+	public byte getAfi() {
44
+		return afi;
45
+	}
46
+	public void setAfi(byte afi) {
47
+		this.afi = afi;
48
+	}
49
+	public int getBlocksCount() {
50
+		return blocksCount;
51
+	}
52
+	public void setBlocksCount(int blocksCount) {
53
+		this.blocksCount = blocksCount;
54
+	}
55
+	public int getBlockLen() {
56
+		return blockLen;
57
+	}
58
+	public void setBlockLen(int blockLen) {
59
+		this.blockLen = blockLen;
60
+	}
61
+	public byte getIC_reference() {
62
+		return IC_reference;
63
+	}
64
+	public void setIC_reference(byte iC_reference) {
65
+		IC_reference = iC_reference;
66
+	}
67
+	
68
+	
69
+
70
+}

+ 29 - 0
mylibrary/src/main/java/cn/pda/rfid/hf/Iso15693InventoryInfo.java

@@ -0,0 +1,29 @@
1
+package cn.pda.rfid.hf;
2
+
3
+public class Iso15693InventoryInfo {
4
+	private byte flag ;
5
+	private byte dsfid ;
6
+	private byte[] uid ;
7
+	
8
+	public byte getFlag() {
9
+		return flag;
10
+	}
11
+	public void setFlag(byte flag) {
12
+		this.flag = flag;
13
+	}
14
+	public byte getDsfid() {
15
+		return dsfid;
16
+	}
17
+	public void setDsfid(byte dsfid) {
18
+		this.dsfid = dsfid;
19
+	}
20
+	public byte[] getUid() {
21
+		return uid;
22
+	}
23
+	public void setUid(byte[] uid) {
24
+		this.uid = uid;
25
+	}
26
+	
27
+	
28
+
29
+}

+ 67 - 0
mylibrary/src/main/java/cn/pda/serialport/Main.java

@@ -0,0 +1,67 @@
1
+package cn.pda.serialport;
2
+
3
+import java.io.IOException;
4
+import java.io.InputStream;
5
+import java.io.OutputStream;
6
+
7
+import cn.pda.rfid.hf.HfConmmand;
8
+import cn.pda.rfid.hf.HfReader;
9
+
10
+/**
11
+ * Created by zrl on 2017/2/9.
12
+ */
13
+
14
+public class Main {
15
+    private static SerialPort serialPort;
16
+    private static HfConmmand hf;
17
+    private static InputStream is;
18
+    private static OutputStream os;
19
+
20
+    public static SerialPort getSerialPort() {
21
+        return serialPort;
22
+    }
23
+
24
+    public static void setSerialPort(SerialPort serialPort) {
25
+        Main.serialPort = serialPort;
26
+    }
27
+
28
+    public static HfConmmand getHf() {
29
+        return hf;
30
+    }
31
+
32
+    public static void setHf(HfConmmand hf) {
33
+        Main.hf = hf;
34
+    }
35
+
36
+    public static InputStream getIs() {
37
+        return is;
38
+    }
39
+
40
+    public static void setIs(InputStream is) {
41
+        Main.is = is;
42
+    }
43
+
44
+    public static OutputStream getOs() {
45
+        return os;
46
+    }
47
+
48
+    public static void setOs(OutputStream os) {
49
+        Main.os = os;
50
+    }
51
+
52
+    public static void initSerialPort(){
53
+        try {
54
+            serialPort = new SerialPort(13,115200,0);
55
+            is = serialPort.getInputStream();
56
+            os = serialPort.getOutputStream();
57
+            serialPort.rfid_poweron();
58
+            hf = new HfReader(is,os);
59
+        } catch (IOException e) {
60
+            e.printStackTrace();
61
+        }
62
+    }
63
+    public static void destroy(){
64
+        serialPort.close(13);
65
+        serialPort.rfid_poweroff();
66
+    }
67
+}

+ 141 - 0
mylibrary/src/main/java/cn/pda/serialport/SerialPort.java

@@ -0,0 +1,141 @@
1
+package cn.pda.serialport;
2
+import java.io.File;
3
+import java.io.FileDescriptor;
4
+import java.io.FileInputStream;
5
+import java.io.FileOutputStream;
6
+import java.io.IOException;
7
+import java.io.InputStream;
8
+import java.io.OutputStream;
9
+import java.util.Arrays;
10
+
11
+import android.util.Log;
12
+/*
13
+ * SerialPort类是JNI类,负责程序与硬件的通信
14
+ * Created by zrl on 2017/2/8.
15
+ */
16
+public class SerialPort {
17
+    private static final String TAG = "SerialPort";
18
+
19
+
20
+    public static int TNCOM_EVENPARITY = 0;//偶校验
21
+    public static int TNCOM_ODDPARITY = 1 ;//奇校验
22
+
23
+    /*
24
+     * Do not remove or rename the field mFd: it is used by native method close();
25
+     */
26
+    private FileDescriptor mFd;
27
+    private FileInputStream mFileInputStream;
28
+    private FileOutputStream mFileOutputStream;
29
+    private boolean trig_on=false;
30
+    byte[] test;
31
+    //用于调用GPIO
32
+    public SerialPort(){}
33
+
34
+    public SerialPort(int port, int baudrate, int flags) throws SecurityException, IOException {
35
+//		System.load("/data/data/com.example.uartdemo/lib/libdevapi.so");
36
+//		System.load("/data/data/com.example.uartdemo/lib/libSerialPort.so");
37
+        mFd = open(port, baudrate);
38
+
39
+        if (mFd == null) {
40
+            Log.e(TAG, "native open returns null");
41
+            throw new IOException();
42
+        }
43
+
44
+
45
+        mFileInputStream = new FileInputStream(mFd);
46
+        mFileOutputStream = new FileOutputStream(mFd);
47
+
48
+
49
+
50
+    }
51
+    // Getters and setters
52
+    public InputStream getInputStream() {
53
+        return mFileInputStream;
54
+    }
55
+
56
+    public OutputStream getOutputStream() {
57
+        return mFileOutputStream;
58
+    }
59
+    public void power_5Von() {
60
+        zigbeepoweron();
61
+    }
62
+    public void power_5Voff(){
63
+        zigbeepoweroff();
64
+    }
65
+    public void power_3v3on(){
66
+        power3v3on();
67
+    }
68
+    public void power_3v3off(){
69
+        power3v3off();
70
+    }
71
+    public void rfid_poweron(){
72
+        rfidPoweron();
73
+    }
74
+    public void rfid_poweroff(){
75
+        rfidPoweroff();
76
+    }
77
+    public void psam_poweron() {
78
+        psampoweron();
79
+    }
80
+    public void psam_poweroff() {
81
+        psampoweroff();
82
+        //scaner_trigoff();
83
+    }
84
+    public void scaner_poweron() {
85
+        scanerpoweron();
86
+        scaner_trigoff();
87
+    }
88
+    public void scaner_poweroff() {
89
+        scanerpoweroff();
90
+        //scaner_trigoff();
91
+    }
92
+    public void scaner_trigon() {
93
+        scanertrigeron();
94
+        trig_on=true;
95
+    }
96
+    public void scaner_trigoff() {
97
+        scanertrigeroff();
98
+        trig_on=false;
99
+    }
100
+    public boolean scaner_trig_stat(){
101
+        return trig_on;
102
+    }
103
+    // JNI
104
+
105
+    private native static FileDescriptor open(int port, int baudrate);
106
+    private native static FileDescriptor open(int port, int baudrate, int portparity);
107
+    public native void close(int port);
108
+    public native void zigbeepoweron();
109
+    public native void zigbeepoweroff();
110
+
111
+    public native void scanerpoweron();
112
+    public native void scanerpoweroff();
113
+    public native void psampoweron();
114
+    public native void psampoweroff();
115
+    public native void scanertrigeron();
116
+    public native void scanertrigeroff();
117
+    public native void power3v3on();
118
+    public native void power3v3off();
119
+
120
+    public native void rfidPoweron();
121
+    public native void rfidPoweroff();
122
+
123
+    public native void usbOTGpowerOn();
124
+    public native void usbOTGpowerOff();
125
+
126
+    public native void irdapoweron();
127
+    public native void irdapoweroff();
128
+
129
+    public native void setGPIOhigh(int gpio);
130
+    public native void setGPIOlow(int gpio);
131
+
132
+
133
+//	public native void setPortParity(int mode); //设置校验位
134
+
135
+    public native void test(byte[] bytes);
136
+
137
+    static {
138
+        System.loadLibrary("devapi");
139
+        System.loadLibrary("irdaSerialPort");
140
+    }
141
+}

+ 25 - 0
mylibrary/src/main/java/com/mq/mylibrary/CardData.java

@@ -0,0 +1,25 @@
1
+package com.mq.mylibrary;
2
+
3
+/**
4
+ * 创建人 mQ
5
+ * 创建时间 2019/8/7 0007 9:48
6
+ * 文件名称 CardData
7
+ * 说明:  读卡信息
8
+ **/
9
+public class CardData {
10
+
11
+    //状态 0读卡成功,1不支持NFC,2未启用NFC,3卡片连接失效 4.写卡失败
12
+    public String state;//状态
13
+    public String msg;//信息
14
+    public String resultData;//解析结果
15
+    public String originalData;//原数据
16
+    public String debugData;//调试数据
17
+
18
+
19
+    public CardData() {
20
+    }
21
+
22
+    public CardData(String resultData) {
23
+        this.resultData = resultData;
24
+    }
25
+}

+ 64 - 0
mylibrary/src/main/java/com/mq/mylibrary/ChannelTool.java

@@ -0,0 +1,64 @@
1
+package com.mq.mylibrary;
2
+
3
+
4
+/**
5
+ * 包名: com.fkxt.app
6
+ * 类名: ChannelTool
7
+ * 作用描述: 渠道 帮助类
8
+ * 创建人: mQ
9
+ * 创建时间: 2020/3/12 21:13
10
+ * 更新人:
11
+ * 更新时间: 2020/3/12 21:13
12
+ * 更新说明:
13
+ * 版本号: 1.0
14
+ */
15
+public class ChannelTool {
16
+
17
+    public static final String C_YUN_NAN = "yunnan";//云南
18
+    public static final String C_SHAN_XI = "shanxi";//山西
19
+    public static final String C_TIAN_JIN = "tianjin";//天津
20
+//    public static final String C_PU_ER = "puer";//普洱
21
+
22
+//    private ChannelTool() {
23
+//    }
24
+//
25
+//    private static class SingleHelper {
26
+//        private static final ChannelTool INSTANCE = new ChannelTool();
27
+//    }
28
+//
29
+//    public static ChannelTool get() {
30
+//        return SingleHelper.INSTANCE;
31
+//    }
32
+//
33
+//    //获取渠道
34
+//    public String getChannel() {
35
+//        return BuildConfig.FLAVOR;
36
+//    }
37
+//
38
+//    //获取bugly appId
39
+//    public String buglyAppId() {
40
+//        String buglyAppId = "";
41
+//        switch (getChannel()) {
42
+//            case ChannelTool.C_BIAO_ZHUN:
43
+//                buglyAppId = "645a61d720";
44
+//                break;
45
+//            case ChannelTool.C_YANG_ZHOU:
46
+//                buglyAppId = "5095b2495f";
47
+//                break;
48
+//            case ChannelTool.C_HBZCL:
49
+//                buglyAppId = "e646ac3391";
50
+//                break;
51
+//        }
52
+//        LogTool.i("渠道名称:" + getChannel() +
53
+//                "---是否是Debug:" + getIsDebug() +
54
+//                "---buglyId:" + buglyAppId);
55
+//        return buglyAppId;
56
+//    }
57
+
58
+    //获取是否是debug
59
+    public boolean getIsDebug() {
60
+        return BuildConfig.DEBUG;
61
+    }
62
+
63
+
64
+}

+ 112 - 0
mylibrary/src/main/java/com/mq/mylibrary/MyDatabaseHelper.java

@@ -0,0 +1,112 @@
1
+package com.mq.mylibrary;
2
+
3
+import android.content.Context;
4
+import android.content.res.AssetManager;
5
+import android.database.sqlite.SQLiteDatabase;
6
+import android.database.sqlite.SQLiteOpenHelper;
7
+import android.os.Environment;
8
+
9
+
10
+import com.mq.mylibrary.tool.LogTool;
11
+
12
+import java.io.BufferedReader;
13
+import java.io.IOException;
14
+import java.io.InputStreamReader;
15
+import java.util.ArrayList;
16
+import java.util.List;
17
+
18
+/**
19
+ * 创建人 mQ
20
+ * 创建时间 2019/1/7 0007 14:05
21
+ * 文件名称 MyDatabaseHelper
22
+ * 说明:  数据库类
23
+ **/
24
+public class MyDatabaseHelper extends SQLiteOpenHelper {
25
+
26
+    public static final String FILE_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/sjlsxxgl/";
27
+    public static final int DATABASE_VERSION = 1;
28
+
29
+    private static final String CREATE_SQL_FILE_NAME = "createSql.sql";
30
+
31
+    private Context mContext;
32
+
33
+    public MyDatabaseHelper(Context context, String name) {
34
+        super(context, name, null, DATABASE_VERSION);
35
+        mContext = context;
36
+    }
37
+
38
+
39
+    @Override
40
+    public void onCreate(SQLiteDatabase db) {
41
+//        File dir = new File(FILE_DIR);
42
+//        if (!dir.exists()) {
43
+//            dir.mkdir();
44
+//        }
45
+
46
+        List<String> createSqls = getCreateSqlInfo(CREATE_SQL_FILE_NAME);
47
+        if (createSqls != null) {
48
+            for (String sql : createSqls) {
49
+                db.execSQL(sql);
50
+                LogTool.i("onCreate创建数据表: " + sql);
51
+            }
52
+        }
53
+    }
54
+
55
+    @Override
56
+    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
57
+
58
+    }
59
+
60
+    /**
61
+     * 读取assets文件夹中的建表语句
62
+     */
63
+    private List<String> getCreateSqlInfo(String fileName) {
64
+        AssetManager assetManager = mContext.getAssets();
65
+        try {
66
+            InputStreamReader isr = new InputStreamReader(assetManager.open(fileName));
67
+            BufferedReader br = new BufferedReader(isr);
68
+            String line;
69
+            StringBuilder stringBuilder = new StringBuilder();
70
+            while ((line = br.readLine()) != null) {
71
+                stringBuilder.append(line);
72
+            }
73
+            br.close();
74
+            isr.close();
75
+            LogTool.i("getCreateSqlInfo 读取建表语句: " + stringBuilder.toString());
76
+            return parseSql(stringBuilder.toString());
77
+        } catch (IOException e) {
78
+            e.printStackTrace();
79
+        }
80
+        return null;
81
+    }
82
+
83
+    private List<String> parseSql(String sql) {
84
+        List<String> list = new ArrayList<>();
85
+        String[] split = sql.split(";");
86
+        for (String s : split) {
87
+            if (s.contains("(")) {
88
+                String tableS;
89
+
90
+                if (s.contains("ENGINE")) {
91
+                    tableS = s.split("ENGINE")[0];
92
+                } else
93
+                    tableS = s;
94
+                if (tableS.contains("COMMENT")) {
95
+                    String[] items = tableS.split(",");
96
+                    StringBuilder sb = new StringBuilder();
97
+                    for (int i = 0; i < items.length; i++) {
98
+                        String item = items[i].trim();
99
+                        String comment = item.split("COMMENT")[0];
100
+                        if (i == items.length - 1)
101
+                            sb.append(comment + ")");
102
+                        else
103
+                            sb.append(comment + ",");
104
+                    }
105
+                    tableS = sb.toString();
106
+                }
107
+                list.add(tableS);
108
+            }
109
+        }
110
+        return list;
111
+    }
112
+}

+ 206 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseActivity.java

@@ -0,0 +1,206 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.content.Context;
4
+import android.os.Bundle;
5
+import android.support.annotation.Nullable;
6
+import android.support.v7.app.AppCompatActivity;
7
+import android.view.MotionEvent;
8
+import android.view.View;
9
+import android.view.inputmethod.InputMethodManager;
10
+import android.widget.ArrayAdapter;
11
+import android.widget.AutoCompleteTextView;
12
+import android.widget.EditText;
13
+import android.widget.TextView;
14
+
15
+import com.mq.mylibrary.R;
16
+import com.mq.mylibrary.dialog.DateTimeDialog;
17
+import com.mq.mylibrary.dialog.MyProgressDialog;
18
+import com.mq.mylibrary.dialog.StartEndDateDialog;
19
+import com.mq.mylibrary.popupwindow.ListPopupwindow;
20
+import com.mq.mylibrary.popupwindow.SpinnerOption;
21
+import com.mq.mylibrary.popupwindow.adapter.SelAdapter;
22
+import com.mq.mylibrary.tool.ETTool;
23
+import com.mq.mylibrary.tool.LogTool;
24
+
25
+import java.util.ArrayList;
26
+import java.util.List;
27
+import java.util.Set;
28
+
29
+/**
30
+ * 创建人 mQ
31
+ * 创建时间 2019/8/6 0006 19:56
32
+ * 文件名称 BaseActivity
33
+ * 说明:  Activity基类
34
+ **/
35
+public class BaseActivity extends AppCompatActivity {
36
+
37
+    private MyProgressDialog mProgressDialog;
38
+    private DateTimeDialog mDateTimeDialog;
39
+    private ListPopupwindow mListPopupwindow;
40
+    private SelAdapter mListAdapter;
41
+    private StartEndDateDialog mStartEndDateDialog;
42
+
43
+    private ArrayList<MyOnTouchListener> onTouchListeners = new ArrayList<>();
44
+
45
+    @Override
46
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
47
+        super.onCreate(savedInstanceState);
48
+        LogTool.i("onCreate");
49
+    }
50
+
51
+    @Override
52
+    protected void onResume() {
53
+        super.onResume();
54
+        LogTool.i("onResume");
55
+    }
56
+
57
+    @Override
58
+    protected void onPause() {
59
+        super.onPause();
60
+        LogTool.i("onPause");
61
+    }
62
+
63
+    public void showPd(String msg) {
64
+        if (mProgressDialog == null)
65
+            mProgressDialog = new MyProgressDialog(this);
66
+        mProgressDialog.setMessage("请稍后...");
67
+        if (msg != null)
68
+            mProgressDialog.setMessage(msg);
69
+        mProgressDialog.show();
70
+    }
71
+
72
+    public void showPd() {
73
+        showPd(null);
74
+    }
75
+
76
+    public void cancelPd() {
77
+        if (mProgressDialog != null)
78
+            mProgressDialog.dismiss();
79
+    }
80
+
81
+
82
+    public void showDateTimeDialog(View view, String dateTime) {
83
+        if (mDateTimeDialog == null) {
84
+            mDateTimeDialog = new DateTimeDialog(this);
85
+        }
86
+        mDateTimeDialog.setTime(view,dateTime);
87
+        mDateTimeDialog.setCallBack(new DateTimeDialog.DateTimeCallBack() {
88
+            @Override
89
+            public void onDateTimeResultListener(View view, String date, String time) {
90
+                ETTool.setData(view, date + " " + time);
91
+            }
92
+        });
93
+        mDateTimeDialog.show();
94
+    }
95
+
96
+
97
+    public void showListPopupwindow(View view, List<SpinnerOption> list, SelAdapter.SelectListener mSelectListener) {
98
+        if (mListPopupwindow == null) {
99
+            mListAdapter = new SelAdapter(null);
100
+            mListAdapter.setHideSelView();
101
+            mListAdapter.setSelectListener(mSelectListener);
102
+            mListPopupwindow = new ListPopupwindow(this, 1, mListAdapter);
103
+//            mListPopupwindow.setWidthMatch();
104
+        }
105
+        mListAdapter.replaceData(list);
106
+        mListAdapter.setView(view);
107
+        mListPopupwindow.show(view);
108
+    }
109
+
110
+    public void getSelPopupwindow(View view, Set<SpinnerOption> selectList) {
111
+        mListPopupwindow.dismiss();
112
+        SpinnerOption option = selectList.iterator().next();
113
+        if (view instanceof TextView) {
114
+            TextView textView = (TextView) view;
115
+            textView.setText(option.name);
116
+            textView.setError(null);
117
+        }
118
+    }
119
+
120
+    public Context getContext() {
121
+        return this;
122
+    }
123
+
124
+    public void showStartEndDateDialog(StartEndDateDialog.DateCallBack callBack) {
125
+        if (mStartEndDateDialog == null) {
126
+            mStartEndDateDialog = new StartEndDateDialog(getContext());
127
+            mStartEndDateDialog.setCallBack(callBack);
128
+        }
129
+        mStartEndDateDialog.show();
130
+    }
131
+
132
+    public void dismissStartEndDateDialog() {
133
+        if (mStartEndDateDialog != null) {
134
+            mStartEndDateDialog.dismiss();
135
+        }
136
+    }
137
+
138
+    /*点击屏幕非文本框的区域,关闭键盘*/
139
+    @Override
140
+    public boolean dispatchTouchEvent(MotionEvent ev) {
141
+        for (MyOnTouchListener l : onTouchListeners) {
142
+            if (l != null)
143
+                l.onTouch(ev);
144
+        }
145
+        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
146
+            View v = getCurrentFocus();
147
+            if (isShouldHideInput(v, ev)) {
148
+
149
+                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
150
+                if (imm != null) {
151
+                    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
152
+                }
153
+            }
154
+            return super.dispatchTouchEvent(ev);
155
+        }
156
+        // 必不可少,否则所有的组件都不会有TouchEvent了
157
+        if (getWindow().superDispatchTouchEvent(ev)) {
158
+            return true;
159
+        }
160
+        return onTouchEvent(ev);
161
+    }
162
+
163
+    /*** 注册触摸事件 ***/
164
+    public void registOnTouchListener(MyOnTouchListener listener) {
165
+        onTouchListeners.add(listener);
166
+    }
167
+
168
+    /*** 解除触摸事件 ***/
169
+    public void unregistOnTouchListener(MyOnTouchListener listener) {
170
+        onTouchListeners.remove(listener);
171
+    }
172
+
173
+    public boolean isShouldHideInput(View v, MotionEvent event) {
174
+        if (v != null && (v instanceof EditText)) {
175
+            int[] leftTop = {0, 0};
176
+            //获取输入框当前的location位置
177
+            v.getLocationInWindow(leftTop);
178
+            int left = leftTop[0];
179
+            int top = leftTop[1];
180
+            int bottom = top + v.getHeight();
181
+            int right = left + v.getWidth();
182
+            return !(event.getRawX() > left && event.getRawX() < right
183
+                    && event.getRawY() > top && event.getRawY() < bottom);
184
+        }
185
+        return false;
186
+    }
187
+
188
+
189
+    /**
190
+     * 设置下拉选择输入框
191
+     */
192
+    public void setAutoTextView(AutoCompleteTextView textView, List<String> list) {
193
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item, list);
194
+        textView.setAdapter(adapter);
195
+        textView.setThreshold(0);
196
+        textView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
197
+            @Override
198
+            public void onFocusChange(View v, boolean hasFocus) {
199
+                if (hasFocus) {//获取焦点时
200
+                    textView.showDropDown();
201
+                }
202
+            }
203
+        });
204
+    }
205
+
206
+}

+ 66 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseApp.java

@@ -0,0 +1,66 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.app.Application;
4
+import android.content.Context;
5
+import android.database.sqlite.SQLiteDatabase;
6
+
7
+import com.mq.mylibrary.MyDatabaseHelper;
8
+import com.mq.mylibrary.tool.LogTool;
9
+import com.mq.mylibrary.tool.SPTool;
10
+import com.mq.mylibrary.tool.ToastTool;
11
+
12
+/**
13
+ * 创建人 mQ
14
+ * 创建时间 2019/8/7 0007 11:09
15
+ * 文件名称 BaseApp
16
+ * 说明:  application基类
17
+ **/
18
+public abstract class BaseApp extends Application {
19
+
20
+    protected abstract String getChannelName();
21
+
22
+    private static MyDatabaseHelper mDatabaseHelper;
23
+    private static Context mContext;
24
+
25
+    //跳过读卡,直接走流程。生产环境请关闭!!
26
+    public static boolean isSkipCard = false;
27
+
28
+    public static String mChannelName = "";
29
+
30
+    @Override
31
+    public void onCreate() {
32
+        super.onCreate();
33
+        ToastTool.init(this);
34
+        LogTool.isDebug(true);
35
+        mContext = this;
36
+        getDBHelper();
37
+        SPTool.init(this, "handheld_device");
38
+        mChannelName = getChannelName();
39
+        LogTool.i("渠道名称:" + mChannelName);
40
+    }
41
+
42
+    public static SQLiteDatabase getDBHelper() {
43
+        if (mDatabaseHelper == null)
44
+            mDatabaseHelper = new MyDatabaseHelper(mContext, "handheld_device.db");
45
+        return mDatabaseHelper.getWritableDatabase();
46
+    }
47
+
48
+    public static Context getAppContext() {
49
+        return mContext;
50
+    }
51
+
52
+    /**
53
+     * 读写卡数据是否加密
54
+     */
55
+    public static void saveIsEncryption(boolean isEncryption) {
56
+        SPTool.save("isEncryption", isEncryption);
57
+    }
58
+
59
+    /**
60
+     * 读写卡数据是否加密
61
+     */
62
+    public static boolean getIsEncryption() {
63
+        return (boolean) SPTool.get("isEncryption", true);
64
+    }
65
+
66
+}

+ 42 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseCard.java

@@ -0,0 +1,42 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import com.mq.mylibrary.CardData;
4
+
5
+/**
6
+ * 包名: com.mq.mylibrary.base
7
+ * 类名: BaseCard
8
+ * 作用描述:
9
+ * 创建人: mQ
10
+ * 创建时间: 2020/3/27 15:30
11
+ * 更新人:
12
+ * 更新时间: 2020/3/27 15:30
13
+ * 更新说明:
14
+ * 版本号: 1.0
15
+ */
16
+public interface BaseCard {
17
+
18
+    /**
19
+     * 开启
20
+     */
21
+    void open();
22
+
23
+    /**
24
+     * 关闭
25
+     */
26
+    void close();
27
+
28
+    /**
29
+     * 读卡
30
+     */
31
+    CardData readCard();
32
+
33
+    /**
34
+     * 写卡
35
+     */
36
+    String writeCard(String newCardInfo);
37
+
38
+    /**
39
+     * 清卡
40
+     */
41
+    String clearCard();
42
+}

+ 21 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseConstant.java

@@ -0,0 +1,21 @@
1
+package com.mq.mylibrary.base;
2
+
3
+/**
4
+ * 创建人 mQ
5
+ * 创建时间 2019/8/8 0008 16:00
6
+ * 文件名称 BaseConstant
7
+ * 说明:  常量基类
8
+ **/
9
+public class BaseConstant {
10
+
11
+
12
+    public static final String LOGIN_NAME = "login_name";
13
+    public static final String REAL_NAME = "real_name";
14
+
15
+    public static final String READ_WRITE_TYPE = "read_write_type";//读写类型
16
+
17
+    public static final String R_W_NFC = "nfc";//nfc读写
18
+    public static final String R_W_M10A = "M10A";//M10A读写(上海孚恩手持仪)
19
+
20
+
21
+}

+ 294 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseLoginActivity.java

@@ -0,0 +1,294 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.annotation.SuppressLint;
4
+import android.os.AsyncTask;
5
+import android.os.Bundle;
6
+import android.os.Environment;
7
+import android.support.annotation.Nullable;
8
+import android.view.KeyEvent;
9
+import android.view.View;
10
+import android.view.inputmethod.EditorInfo;
11
+import android.widget.Button;
12
+import android.widget.EditText;
13
+import android.widget.ImageView;
14
+import android.widget.RadioButton;
15
+import android.widget.TextView;
16
+
17
+import com.mq.mylibrary.ChannelTool;
18
+import com.mq.mylibrary.R;
19
+import com.mq.mylibrary.db.car.CarDao;
20
+import com.mq.mylibrary.db.grain_type.GrainTypeDao;
21
+import com.mq.mylibrary.db.load_info.LoadInfoDao;
22
+import com.mq.mylibrary.db.sotre.StoreDao;
23
+import com.mq.mylibrary.db.team_group.TeamGroupDao;
24
+import com.mq.mylibrary.db.user.UserDao;
25
+import com.mq.mylibrary.db.user.UserEntity;
26
+import com.mq.mylibrary.tool.ETTool;
27
+import com.mq.mylibrary.tool.FileTool;
28
+import com.mq.mylibrary.tool.LogTool;
29
+import com.mq.mylibrary.tool.SPTool;
30
+import com.mq.mylibrary.tool.StringTool;
31
+import com.mq.mylibrary.tool.ToastTool;
32
+
33
+import org.json.JSONException;
34
+import org.json.JSONObject;
35
+
36
+import java.io.FileNotFoundException;
37
+import java.io.FileOutputStream;
38
+
39
+/**
40
+ * 创建人 mQ
41
+ * 创建时间 2019/8/7 0007 11:12
42
+ * 文件名称 BaseLoginActivity
43
+ * 说明:
44
+ **/
45
+public abstract class BaseLoginActivity extends BaseActivity {
46
+
47
+
48
+    /**
49
+     * 设置功能标题
50
+     */
51
+    public abstract String setTitle();
52
+
53
+    /**
54
+     * 登录成功 进行下一步操作
55
+     */
56
+    public abstract void loginSuccess(UserEntity userEntity);
57
+
58
+    public ImageView mIvLogo;
59
+    public EditText mEtUsername;
60
+    public EditText mEtPassword;
61
+    public TextView mTvTitle;
62
+    public Button mBtLogin;
63
+    public Button mBtInit;
64
+    public Button mBtReset;
65
+    public RadioButton mRBNfc;
66
+    public RadioButton mRBM10a;
67
+
68
+    @Override
69
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
70
+        super.onCreate(savedInstanceState);
71
+        setContentView(R.layout.activity_login);
72
+        initView();
73
+        setLogoForChannel();
74
+        mTvTitle.setText(setTitle());
75
+
76
+        initData();
77
+
78
+    }
79
+
80
+    private void initView() {
81
+        mIvLogo = (ImageView) findViewById(R.id.iv_logo);
82
+        mEtUsername = (EditText) findViewById(R.id.et_username);
83
+        mEtPassword = (EditText) findViewById(R.id.et_password);
84
+        mTvTitle = (TextView) findViewById(R.id.tv_title);
85
+        mEtPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
86
+            @Override
87
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
88
+                if (actionId == EditorInfo.IME_ACTION_GO ||
89
+                        (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
90
+                    mBtLogin.callOnClick();
91
+                }
92
+                return false;
93
+            }
94
+        });
95
+        mBtLogin = (Button) findViewById(R.id.bt_login);
96
+        mBtLogin.setOnClickListener(mOnClickListener);
97
+
98
+        mBtInit = (Button) findViewById(R.id.bt_init);
99
+        mBtInit.setOnClickListener(mOnClickListener);
100
+
101
+        mBtReset = (Button) findViewById(R.id.bt_reset);
102
+        mBtReset.setOnClickListener(mOnClickListener);
103
+
104
+        String name = (String) SPTool.get(BaseConstant.LOGIN_NAME, "");
105
+        mEtUsername.setText(name);
106
+
107
+        mRBNfc = (RadioButton) findViewById(R.id.rb_nfc);
108
+        mRBM10a = (RadioButton) findViewById(R.id.rb_m10a);
109
+        String rwType = (String) SPTool.get(BaseConstant.READ_WRITE_TYPE, "");
110
+        if (rwType.equals(BaseConstant.R_W_NFC)) {
111
+            mRBNfc.setChecked(true);
112
+        } else if (rwType.equals(BaseConstant.R_W_M10A)) {
113
+            mRBM10a.setChecked(true);
114
+        }
115
+    }
116
+
117
+    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
118
+        @Override
119
+        public void onClick(View v) {
120
+            int id = v.getId();
121
+            if (id == R.id.bt_login) {
122
+                login();
123
+            } else if (id == R.id.bt_init) {
124
+                initData();
125
+            } else if (id == R.id.bt_reset) {
126
+                mEtUsername.setText("");
127
+                mEtPassword.setText("");
128
+            }
129
+        }
130
+    };
131
+
132
+    private void login() {
133
+        String username = ETTool.getData(mEtUsername);
134
+        if (StringTool.isEmpty(username)) {
135
+            ToastTool.showLong("用户名不能为空");
136
+            return;
137
+        }
138
+        String password = ETTool.getData(mEtPassword);
139
+        if (StringTool.isEmpty(password)) {
140
+            ToastTool.showLong("密码不能为空");
141
+            return;
142
+        }
143
+
144
+        UserEntity user = UserDao.get().checkUser(BaseApp.getDBHelper(), username, password);
145
+        if (user == null) {
146
+            ToastTool.showLong("用户名或密码错误,请重试!");
147
+            return;
148
+        }
149
+
150
+        String rbType = null;
151
+        if (mRBNfc.isChecked()) rbType = BaseConstant.R_W_NFC;
152
+        if (mRBM10a.isChecked()) {
153
+            rbType = BaseConstant.R_W_M10A;
154
+            try {
155
+                FileOutputStream fout = new FileOutputStream("/sys/class/gpio/gpio898/direction");
156
+            } catch (FileNotFoundException e) {
157
+                e.printStackTrace();
158
+                ToastTool.showLong("当前设备不支持M10A读写,请选择其他读写卡方式");
159
+                return;
160
+            }
161
+        }
162
+        if (rbType == null) {
163
+            ToastTool.showLong("请选择读写卡方式");
164
+            return;
165
+        }
166
+
167
+
168
+        SPTool.save(BaseConstant.LOGIN_NAME, username);
169
+        SPTool.save(BaseConstant.REAL_NAME, user.getReal_name());
170
+        SPTool.save(BaseConstant.READ_WRITE_TYPE, rbType);
171
+        ToastTool.showLong("登录成功");
172
+        loginSuccess(user);
173
+    }
174
+
175
+
176
+    @SuppressLint("StaticFieldLeak")
177
+    public void initData() {
178
+        showPd();
179
+        new AsyncTask<Void, Void, String>() {
180
+
181
+            @Override
182
+            protected String doInBackground(Void... voids) {
183
+                // 判断SD卡是否存在
184
+                if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
185
+                    LogTool.d("SD卡不存在,无法读取数据: " + Environment.getExternalStorageState());
186
+                    return "SD卡不存在,无法读取数据";
187
+                }
188
+                String result = FileTool.getFileContent("JSON.txt");
189
+                if (StringTool.isEmpty(result)) {
190
+                    LogTool.d("没有初始化文件,请检查!");
191
+                    return "没有初始化文件,请检查!";
192
+                }
193
+                StringBuilder log = new StringBuilder();
194
+
195
+                try {
196
+                    JSONObject object = new JSONObject(result);
197
+                    //清空并插入
198
+                    UserDao.get().deleltAll(BaseApp.getDBHelper());
199
+                    boolean userFlg = UserDao.get()
200
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("user"));
201
+                    if (!userFlg) {
202
+                        log.append("初始化用户信息失败!").append("\n");
203
+                    }
204
+
205
+                    //清空并插入
206
+                    StoreDao.get().deleltAll(BaseApp.getDBHelper());
207
+                    boolean storeFlg = StoreDao.get()
208
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("cfhw"));
209
+                    if (!storeFlg) {
210
+                        log.append("初始化仓房信息失败!").append("\n");
211
+                    }
212
+
213
+                    //清空并插入
214
+                    TeamGroupDao.get().deleltAll(BaseApp.getDBHelper());
215
+                    boolean teamGroupFlg = TeamGroupDao.get()
216
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("zyz"));
217
+                    if (!teamGroupFlg) {
218
+                        log.append("初始化作业队组信息失败!").append("\n");
219
+                    }
220
+
221
+                    //清空并插入
222
+                    CarDao.get().deleltAll(BaseApp.getDBHelper());
223
+                    boolean carFlg = CarDao.get()
224
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("wlcl"));
225
+                    if (!carFlg) {
226
+                        log.append("初始化车辆信息失败!").append("\n");
227
+                    }
228
+
229
+                    //清空并插入
230
+                    GrainTypeDao.get().deleltAll(BaseApp.getDBHelper());
231
+                    boolean grainTypeFlg = GrainTypeDao.get()
232
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("lypz"));
233
+                    if (!grainTypeFlg) {
234
+                        log.append("初始化粮油品种信息失败!").append("\n");
235
+                    }
236
+
237
+                    //清空并插入
238
+                    LoadInfoDao.get().deleltAll(BaseApp.getDBHelper());
239
+                    boolean loadInfoFlg = LoadInfoDao.get()
240
+                            .insertByJSONArray(BaseApp.getDBHelper(), object.optJSONArray("qczc"));
241
+                    if (!loadInfoFlg) {
242
+                        log.append("初始化火车卸车信息失败!").append("\n");
243
+                    }
244
+                } catch (JSONException e) {
245
+                    e.printStackTrace();
246
+                    log.append("初始化失败!").append("\n");
247
+                }
248
+                log.append("初始化成功!");
249
+                return log.toString();
250
+            }
251
+
252
+            @Override
253
+            protected void onPostExecute(String s) {
254
+                super.onPostExecute(s);
255
+                cancelPd();
256
+                if (StringTool.notEmpty(s))
257
+                    ToastTool.showLong(s);
258
+            }
259
+        }.execute();
260
+
261
+    }
262
+
263
+    /**
264
+     * 设置logo
265
+     */
266
+    public void setLogo(int resId) {
267
+        mIvLogo.setImageResource(resId);
268
+    }
269
+
270
+    /**
271
+     * 通过渠道更改LOGO
272
+     */
273
+    private void setLogoForChannel() {
274
+        String channel = BaseApp.mChannelName;
275
+        switch (channel) {
276
+            case ChannelTool.C_YUN_NAN:
277
+                setLogo(R.drawable.ic_logo_yunnan);
278
+                break;
279
+//            case ChannelTool.C_PU_ER:
280
+//                setLogo(R.drawable.ic_logo_yunnan);
281
+//                break;
282
+            case ChannelTool.C_SHAN_XI:
283
+                setLogo(R.drawable.ic_logo_shanxi);
284
+                break;
285
+            case ChannelTool.C_TIAN_JIN:
286
+                setLogo(R.drawable.ic_logo_tianjin);
287
+                break;
288
+            default:
289
+                setLogo(R.drawable.ic_logo);
290
+                break;
291
+        }
292
+    }
293
+
294
+}

+ 139 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseNfcActivity.java

@@ -0,0 +1,139 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.app.PendingIntent;
4
+import android.content.Intent;
5
+import android.content.pm.PackageManager;
6
+import android.nfc.NfcAdapter;
7
+import android.os.Bundle;
8
+import android.support.annotation.Nullable;
9
+
10
+import com.mq.mylibrary.CardData;
11
+import com.mq.mylibrary.tool.LogTool;
12
+import com.mq.mylibrary.tool.M10aRFIDTool;
13
+import com.mq.mylibrary.tool.NFCTool;
14
+import com.mq.mylibrary.tool.SPTool;
15
+import com.mq.mylibrary.tool.ToastTool;
16
+
17
+/**
18
+ * 创建人 mQ
19
+ * 创建时间 2019/8/6 0006 19:56
20
+ * 文件名称 BaseNfcActivity
21
+ * 说明:  NFC界面基类
22
+ **/
23
+public abstract class BaseNfcActivity extends BaseActivity {
24
+
25
+    // NFC适配器
26
+    public NfcAdapter nfcAdapter = null;
27
+    // 传达意图
28
+    public PendingIntent pi = null;
29
+    // 是否支持NFC功能的标签
30
+    public boolean isNFC_support = false;
31
+
32
+    public BaseCard mBaseCard;
33
+    private String mRwType;
34
+
35
+    @Override
36
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
37
+        super.onCreate(savedInstanceState);
38
+        mRwType = (String) SPTool.get(BaseConstant.READ_WRITE_TYPE, "");
39
+
40
+        PackageManager pm = getPackageManager();
41
+        // 初始化设备支持NFC功能
42
+        isNFC_support = pm.hasSystemFeature(PackageManager.FEATURE_NFC);
43
+        LogTool.d("是否有NFC: " + isNFC_support);
44
+
45
+        init();
46
+    }
47
+
48
+    public void init() {
49
+        if (mRwType.equals(BaseConstant.R_W_NFC)) {
50
+            // 得到默认nfc适配器
51
+            nfcAdapter = NfcAdapter.getDefaultAdapter(getApplicationContext());
52
+            if (nfcAdapter == null) {
53
+                ToastTool.showLong("请在系统设置中先启用NFC功能!");
54
+                isNFC_support = false;
55
+            }
56
+            if (!nfcAdapter.isEnabled()) {
57
+                ToastTool.showLong("请在系统设置中先启用NFC功能!");
58
+                isNFC_support = false;
59
+            }
60
+            if (isNFC_support) {
61
+                // 初始化PendingIntent,当有NFC设备连接上的时候,就交给当前Activity处理
62
+                pi = PendingIntent.getActivity(this, 0, new Intent(this, getClass())
63
+                        .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
64
+            }
65
+            mBaseCard = NFCTool.get(nfcAdapter, newIntent);
66
+        } else if (mRwType.equals(BaseConstant.R_W_M10A)) {
67
+            isNFC_support = false;
68
+            mBaseCard = M10aRFIDTool.get();
69
+        }
70
+
71
+    }
72
+
73
+
74
+    @Override
75
+    protected void onResume() {
76
+        super.onResume();
77
+        if (!isNFC_support) {
78
+            // 非nfc
79
+            mBaseCard.open();
80
+        } else {
81
+            // 开始监听NFC设备是否连接,如果连接就发pi意图
82
+            nfcAdapter.enableForegroundDispatch(this, pi,
83
+                    null, null);
84
+            mBaseCard = NFCTool.get(nfcAdapter, newIntent);
85
+        }
86
+    }
87
+
88
+    @Override
89
+    protected void onPause() {
90
+        super.onPause();
91
+        if (isNFC_support) {
92
+            // 当前Activity如果不在手机的最前端,就停止NFC设备连接的监听
93
+            nfcAdapter.disableForegroundDispatch(this);
94
+        }
95
+    }
96
+
97
+    @Override
98
+    protected void onDestroy() {
99
+        super.onDestroy();
100
+        mBaseCard.close();
101
+    }
102
+
103
+    @Override
104
+    protected void onNewIntent(Intent intent) {
105
+        super.onNewIntent(intent);
106
+        if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) {
107
+            if (!isNFC_support)
108
+                return;
109
+            // 取出封装在intent中的TAG
110
+            newIntent = intent;
111
+            mBaseCard = NFCTool.get(nfcAdapter, newIntent);
112
+        }
113
+        newIntent = intent;
114
+    }
115
+
116
+    public Intent newIntent;
117
+
118
+    /**
119
+     * 读卡
120
+     */
121
+    public CardData readTag() {
122
+        return mBaseCard.readCard();
123
+    }
124
+
125
+    /**
126
+     * 写卡
127
+     */
128
+    public String writeTag(String newCardInfo) {
129
+        return mBaseCard.writeCard(newCardInfo);
130
+    }
131
+
132
+    /**
133
+     * 清空IC卡
134
+     */
135
+    public String clearCard() {
136
+        return mBaseCard.clearCard();
137
+    }
138
+
139
+}

+ 162 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/BaseOpenActivity.java

@@ -0,0 +1,162 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.Manifest;
4
+import android.content.DialogInterface;
5
+import android.content.Intent;
6
+import android.content.pm.PackageManager;
7
+import android.net.Uri;
8
+import android.os.Build;
9
+import android.os.Bundle;
10
+import android.os.Environment;
11
+import android.support.annotation.NonNull;
12
+import android.support.annotation.Nullable;
13
+import android.support.v7.app.AlertDialog;
14
+import android.support.v7.app.AppCompatActivity;
15
+
16
+import com.mq.mylibrary.R;
17
+import com.mq.mylibrary.tool.LogTool;
18
+import com.mq.mylibrary.tool.PermissionTool;
19
+
20
+import java.util.Arrays;
21
+
22
+
23
+/**
24
+ * 创建人 mQ
25
+ * 创建时间 2019/8/16 0016 17:03
26
+ * 文件名称 BaseOpenActivity
27
+ * 说明:
28
+ **/
29
+public abstract class BaseOpenActivity extends AppCompatActivity {
30
+
31
+    private PermissionTool mPermissionTool;
32
+
33
+    public abstract Class<?> startLogin();
34
+
35
+    private int flg;
36
+
37
+    @Override
38
+    protected void onCreate(@Nullable Bundle savedInstanceState) {
39
+        super.onCreate(savedInstanceState);
40
+        setContentView(R.layout.activity_open);
41
+        PackageManager pm = getPackageManager();
42
+        boolean b = pm.hasSystemFeature(PackageManager.FEATURE_NFC);
43
+        LogTool.d("是否有NFC: " + b);
44
+    }
45
+
46
+    @Override
47
+    protected void onStart() {
48
+        super.onStart();
49
+        if (flg == 1) {
50
+//            Intent intent = new Intent(this, BaseOpenActivity.class);
51
+//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
52
+//            startActivity(intent);
53
+            Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
54
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
55
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
56
+            startActivity(intent);
57
+            android.os.Process.killProcess(android.os.Process.myPid());
58
+        }
59
+    }
60
+
61
+    @Override
62
+    protected void onResume() {
63
+        super.onResume();
64
+        //判断读写权限
65
+        if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
66
+            showSettingDialog();
67
+        } else {
68
+            checkPermission();
69
+        }
70
+    }
71
+
72
+    private void checkPermission() {
73
+        mPermissionTool = PermissionTool.get().init(
74
+                new String[]{
75
+                        Manifest.permission.WRITE_EXTERNAL_STORAGE,
76
+                        Manifest.permission.READ_EXTERNAL_STORAGE,
77
+//                        Manifest.permission.READ_PHONE_STATE
78
+//                        Manifest.permission.ACCESS_COARSE_LOCATION,
79
+//                        Manifest.permission.CAMERA
80
+                });
81
+
82
+        //系统权限是否同意
83
+        if (!mPermissionTool.checkPermissionAll(this)) {
84
+            mPermissionTool.requestPermission(this);
85
+        } else {
86
+            startActivity(new Intent(BaseOpenActivity.this, startLogin()));
87
+            finish();
88
+        }
89
+    }
90
+
91
+    /**
92
+     * 权限申请结果回调
93
+     */
94
+    @Override
95
+    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
96
+        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
97
+        mPermissionTool.onRequestPermissionsResult(requestCode, permissions, grantResults, new PermissionTool.PermissionCallBack() {
98
+            @Override
99
+            public void onGrantedPermissionAll() {
100
+                //权限全部通过
101
+                startActivity(new Intent(BaseOpenActivity.this, startLogin()));
102
+                finish();
103
+            }
104
+
105
+            @Override
106
+            public void onDeniedPermission(String[] deniedPermissions) {
107
+                LogTool.i("onDeniedPermission: 权限拒绝 " + Arrays.toString(deniedPermissions));
108
+                //权限拒绝 重新申请
109
+                if (mPermissionTool.getIsRequestUI(BaseOpenActivity.this, deniedPermissions)) {
110
+                    mPermissionTool.requestPermission(BaseOpenActivity.this);
111
+                } else {
112
+                    mPermissionTool.showSettingDialog(BaseOpenActivity.this, true);
113
+                }
114
+
115
+            }
116
+        });
117
+    }
118
+
119
+
120
+    /**
121
+     * 弹出对话框提示去设置权限通过
122
+     * 是否强制
123
+     */
124
+    public void showSettingDialog() {
125
+        flg = 1;
126
+        AlertDialog.Builder builder = new AlertDialog.Builder(this)
127
+                .setCancelable(false)
128
+                .setTitle("权限申请")
129
+                .setMessage("请您前往设置,\n【读写手机存储】权限设为允许!\n否则程序无法正常运行。")
130
+                .setPositiveButton("设置", new DialogInterface.OnClickListener() {
131
+                    @Override
132
+                    public void onClick(DialogInterface dialog, int which) {
133
+                        startActivity(getAppDetailSettingIntent());
134
+                    }
135
+                });
136
+
137
+        builder.setNegativeButton("退出程序", new DialogInterface.OnClickListener() {
138
+            @Override
139
+            public void onClick(DialogInterface dialog, int which) {
140
+                finish();
141
+            }
142
+        });
143
+        builder.create().show();
144
+    }
145
+
146
+    /**
147
+     * 获取应用详情页面intent(把用户引导到系统设置页面)
148
+     */
149
+    private Intent getAppDetailSettingIntent() {
150
+        Intent localIntent = new Intent();
151
+        localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
152
+        if (Build.VERSION.SDK_INT >= 9) {
153
+            localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
154
+            localIntent.setData(Uri.fromParts("package", getPackageName(), null));
155
+        } else if (Build.VERSION.SDK_INT <= 8) {
156
+            localIntent.setAction(Intent.ACTION_VIEW);
157
+            localIntent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
158
+            localIntent.putExtra("com.android.settings.ApplicationPkgName", getPackageName());
159
+        }
160
+        return localIntent;
161
+    }
162
+}

+ 12 - 0
mylibrary/src/main/java/com/mq/mylibrary/base/MyOnTouchListener.java

@@ -0,0 +1,12 @@
1
+package com.mq.mylibrary.base;
2
+
3
+import android.view.MotionEvent;
4
+
5
+/**
6
+ * Created by mq on 2017/10/20 0020.
7
+ * 触摸事件接口
8
+ */
9
+
10
+public interface MyOnTouchListener {
11
+    boolean onTouch(MotionEvent ev);
12
+}

+ 138 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/BaseDao.java

@@ -0,0 +1,138 @@
1
+package com.mq.mylibrary.db;
2
+
3
+import android.content.ContentValues;
4
+import android.database.Cursor;
5
+import android.database.sqlite.SQLiteDatabase;
6
+
7
+import com.mq.mylibrary.tool.LogTool;
8
+
9
+import java.lang.reflect.Field;
10
+import java.lang.reflect.Method;
11
+import java.util.HashMap;
12
+import java.util.Map;
13
+
14
+
15
+/**
16
+ * 创建人 mQ
17
+ * 创建时间 2019/1/7 0007 18:27
18
+ * 文件名称 BaseDao
19
+ * 说明:
20
+ **/
21
+public abstract class BaseDao<T extends BaseEntity> {
22
+
23
+
24
+    public abstract String getTableName();
25
+
26
+    /**
27
+     * 插入数据
28
+     */
29
+    public long insert(SQLiteDatabase db, ContentValues values) {
30
+        long l = db.insert(getTableName(), null, values);
31
+        LogTool.i(getTableName() + "中插入一条数据, 状态:" + l);
32
+        return l;
33
+    }
34
+
35
+    public long insert(SQLiteDatabase db, T entity) {
36
+        ContentValues values = new ContentValues();
37
+
38
+        Map<String, Object> map = getKeyAndValue(entity);
39
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
40
+            String name = entry.getKey();
41
+            String value = (String) entry.getValue();
42
+            values.put(name, value);
43
+            LogTool.i("key=" + name + "  value=" + value);
44
+        }
45
+        return insert(db, values);
46
+    }
47
+
48
+    /**
49
+     * 查出表内所有数据
50
+     */
51
+    public Cursor getAll(SQLiteDatabase db) {
52
+        return db.rawQuery("SELECT * FROM " + getTableName(), null);
53
+    }
54
+
55
+    /**
56
+     * 获取数据条数
57
+     */
58
+    public int getSize(SQLiteDatabase db) {
59
+        int count;
60
+        Cursor cursor = db.rawQuery("SELECT * FROM " + getTableName(), null);
61
+        count = cursor.getCount();
62
+        cursor.close();
63
+        LogTool.i("getSize: " + count);
64
+        return count;
65
+    }
66
+
67
+    /**
68
+     * 清空表内所有数据
69
+     */
70
+    public void deleltAll(SQLiteDatabase db) {
71
+        db.execSQL("delete from " + getTableName());
72
+    }
73
+
74
+    /**
75
+     * 获取属性名数组
76
+     */
77
+    public String[] getFiledName(Object o) {
78
+        Field[] fields = o.getClass().getDeclaredFields();
79
+        String[] fieldNames = new String[fields.length];
80
+        for (int i = 0; i < fields.length; i++) {
81
+            System.out.println(fields[i].getType());
82
+            fieldNames[i] = fields[i].getName();
83
+        }
84
+        return fieldNames;
85
+    }
86
+
87
+    /**
88
+     * 根据属性名获取属性值
89
+     */
90
+    public Object getFieldValueByName(String fieldName, Object o) {
91
+        try {
92
+            String firstLetter = fieldName.substring(0, 1).toUpperCase();
93
+            String getter = "get" + firstLetter + fieldName.substring(1);
94
+            Method method = o.getClass().getMethod(getter, new Class[]{});
95
+            Object value = method.invoke(o, new Object[]{});
96
+            return value;
97
+        } catch (Exception e) {
98
+            LogTool.i("获取属性值 " + fieldName + ":" + e.getMessage());
99
+            return null;
100
+        }
101
+    }
102
+
103
+    public static Map<String, Object> getKeyAndValue(Object obj) {
104
+        Map<String, Object> map = new HashMap<String, Object>();
105
+        // 得到类对象
106
+        Class userCla = (Class) obj.getClass();
107
+        /* 得到类中的所有属性集合 */
108
+        Field[] fs = userCla.getDeclaredFields();
109
+        for (int i = 0; i < fs.length; i++) {
110
+            Field f = fs[i];
111
+            f.setAccessible(true); // 设置些属性是可以访问的
112
+            Object val = new Object();
113
+            try {
114
+                val = f.get(obj);
115
+                // 得到此属性的值
116
+                map.put(f.getName(), val);// 设置键值
117
+            } catch (IllegalArgumentException e) {
118
+                e.printStackTrace();
119
+            } catch (IllegalAccessException e) {
120
+                e.printStackTrace();
121
+            }
122
+
123
+            /*
124
+             * String type = f.getType().toString();//得到此属性的类型 if
125
+             * (type.endsWith("String")) {
126
+             * System.out.println(f.getType()+"\t是String"); f.set(obj,"12") ;
127
+             * //给属性设值 }else if(type.endsWith("int") ||
128
+             * type.endsWith("Integer")){
129
+             * System.out.println(f.getType()+"\t是int"); f.set(obj,12) ; //给属性设值
130
+             * }else{ System.out.println(f.getType()+"\t"); }
131
+             */
132
+
133
+        }
134
+//        System.out.println("单个对象的所有键值==反射==" + map.toString());
135
+        return map;
136
+    }
137
+
138
+}

+ 33 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/BaseEntity.java

@@ -0,0 +1,33 @@
1
+package com.mq.mylibrary.db;
2
+
3
+
4
+import com.mq.mylibrary.tool.StringTool;
5
+
6
+/**
7
+ * 创建人 mQ
8
+ * 创建时间 2019/2/27 0027 10:34
9
+ * 文件名称 BaseEntity
10
+ * 说明:
11
+ **/
12
+public abstract class BaseEntity {
13
+
14
+
15
+    /**
16
+     * 将写入信息分段
17
+     */
18
+    public  String handleDatas(String... strings) {
19
+        StringBuilder sb = new StringBuilder();
20
+        for (int i = 0; i < strings.length; i++) {
21
+            String string = strings[i];
22
+            if (StringTool.isEmpty(string))
23
+                string = "";
24
+
25
+            sb.append(string);
26
+
27
+            if (i < strings.length - 1) {
28
+                sb.append("|");
29
+            }
30
+        }
31
+        return sb.toString();
32
+    }
33
+}

+ 75 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/car/CarDao.java

@@ -0,0 +1,75 @@
1
+package com.mq.mylibrary.db.car;
2
+
3
+import android.database.Cursor;
4
+import android.database.sqlite.SQLiteDatabase;
5
+
6
+import com.mq.mylibrary.db.BaseDao;
7
+import com.mq.mylibrary.tool.HappySQL;
8
+import com.mq.mylibrary.tool.LogTool;
9
+
10
+import org.json.JSONArray;
11
+import org.json.JSONException;
12
+import org.json.JSONObject;
13
+
14
+import java.util.List;
15
+
16
+
17
+/**
18
+ * 创建人 mQ
19
+ * 创建时间 2019/8/16 0016 10:30
20
+ * 文件名称 CarDao
21
+ * 说明:
22
+ **/
23
+public class CarDao extends BaseDao<CarEntity> {
24
+
25
+    private CarDao() {
26
+    }
27
+
28
+    private static class SingleHelper {
29
+        private static final CarDao INSTANCE = new CarDao();
30
+    }
31
+
32
+    public static CarDao get() {
33
+        return SingleHelper.INSTANCE;
34
+    }
35
+
36
+
37
+    @Override
38
+    public String getTableName() {
39
+        return "car_info";
40
+    }
41
+
42
+
43
+    public boolean insertByJSONArray(SQLiteDatabase db, JSONArray array) {
44
+        if (array == null || array.length() == 0) {
45
+            LogTool.i("初始化: 没有车辆信息");
46
+            return true;
47
+        }
48
+        try {
49
+            for (int i = 0; i < array.length(); i++) {
50
+                long flg = insertByJSONObject(db, array.getJSONObject(i));
51
+                if (flg == -1)
52
+                    return false;
53
+            }
54
+            return true;
55
+        } catch (JSONException e) {
56
+            e.printStackTrace();
57
+            return false;
58
+        }
59
+    }
60
+
61
+    public long insertByJSONObject(SQLiteDatabase db, JSONObject object) {
62
+        CarEntity entity = new CarEntity();
63
+        entity.setCar_id(object.optString("carId"));
64
+        entity.setCar_number(object.optString("clbh"));
65
+        entity.setWork_time(object.optString("zyrq"));
66
+        return insert(db, entity);
67
+    }
68
+
69
+    public List<CarEntity> getList(SQLiteDatabase db) {
70
+        Cursor cursor = getAll(db);
71
+
72
+        return HappySQL.cursor2VOList(cursor, CarEntity.class);
73
+    }
74
+
75
+}

+ 49 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/car/CarEntity.java

@@ -0,0 +1,49 @@
1
+package com.mq.mylibrary.db.car;
2
+
3
+import com.mq.mylibrary.db.BaseEntity;
4
+
5
+/**
6
+ * 创建人 mQ
7
+ * 创建时间 2019/8/16 0016 10:29
8
+ * 文件名称 CarEntity
9
+ * 说明:
10
+ * create TABLE `car_info` (
11
+ * `id` INTEGER PRIMARY KEY AUTOINCREMENT,
12
+ * `car_id` varchar(2000) DEFAULT NULL COMMENT '车辆id',
13
+ * `car_number` varchar(2000) DEFAULT NULL COMMENT '车辆编号',
14
+ * `work_time` varchar(2000) DEFAULT NULL COMMENT '作业日期'
15
+ * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='车辆信息表';
16
+ **/
17
+public class CarEntity extends BaseEntity {
18
+
19
+    //车辆id
20
+    public String car_id;
21
+    //车辆编号
22
+    public String car_number;
23
+    //作业日期
24
+    public String work_time;
25
+
26
+    public String getCar_id() {
27
+        return car_id;
28
+    }
29
+
30
+    public void setCar_id(String car_id) {
31
+        this.car_id = car_id;
32
+    }
33
+
34
+    public String getCar_number() {
35
+        return car_number;
36
+    }
37
+
38
+    public void setCar_number(String car_number) {
39
+        this.car_number = car_number;
40
+    }
41
+
42
+    public String getWork_time() {
43
+        return work_time;
44
+    }
45
+
46
+    public void setWork_time(String work_time) {
47
+        this.work_time = work_time;
48
+    }
49
+}

+ 74 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/grain_type/GrainTypeDao.java

@@ -0,0 +1,74 @@
1
+package com.mq.mylibrary.db.grain_type;
2
+
3
+import android.database.Cursor;
4
+import android.database.sqlite.SQLiteDatabase;
5
+
6
+import com.mq.mylibrary.db.BaseDao;
7
+import com.mq.mylibrary.tool.HappySQL;
8
+import com.mq.mylibrary.tool.LogTool;
9
+
10
+import org.json.JSONArray;
11
+import org.json.JSONException;
12
+import org.json.JSONObject;
13
+
14
+
15
+/**
16
+ * 创建人 mQ
17
+ * 创建时间 2019/8/16 0016 10:30
18
+ * 文件名称 CarDao
19
+ * 说明:
20
+ **/
21
+public class GrainTypeDao extends BaseDao<GrainTypeEntity> {
22
+
23
+    private GrainTypeDao() {
24
+    }
25
+
26
+    private static class SingleHelper {
27
+        private static final GrainTypeDao INSTANCE = new GrainTypeDao();
28
+    }
29
+
30
+    public static GrainTypeDao get() {
31
+        return SingleHelper.INSTANCE;
32
+    }
33
+
34
+
35
+    @Override
36
+    public String getTableName() {
37
+        return "grain_type";
38
+    }
39
+
40
+
41
+    public boolean insertByJSONArray(SQLiteDatabase db, JSONArray array) {
42
+        if (array == null || array.length() == 0) {
43
+            LogTool.i("初始化: 没有粮油品种信息");
44
+            return true;
45
+        }
46
+        try {
47
+            for (int i = 0; i < array.length(); i++) {
48
+                long flg = insertByJSONObject(db, array.getJSONObject(i));
49
+                if (flg == -1)
50
+                    return false;
51
+            }
52
+            return true;
53
+        } catch (JSONException e) {
54
+            e.printStackTrace();
55
+            return false;
56
+        }
57
+    }
58
+
59
+    public long insertByJSONObject(SQLiteDatabase db, JSONObject object) {
60
+        GrainTypeEntity entity = new GrainTypeEntity();
61
+        entity.setGrain_id(object.optString("EnumItemId"));
62
+        entity.setGrain_name(object.optString("EnumItemName"));
63
+        entity.setParent_id(object.optString("EnumId"));
64
+        return insert(db, entity);
65
+    }
66
+
67
+    public GrainTypeEntity getGrain(SQLiteDatabase db, String grain_id) {
68
+        Cursor cursor = db.rawQuery("select * from " + getTableName() +
69
+                " where grain_id = '" + grain_id + "'", null);
70
+        return (GrainTypeEntity) HappySQL.cursor2VO(cursor, GrainTypeEntity.class);
71
+    }
72
+
73
+
74
+}

+ 49 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/grain_type/GrainTypeEntity.java

@@ -0,0 +1,49 @@
1
+package com.mq.mylibrary.db.grain_type;
2
+
3
+import com.mq.mylibrary.db.BaseEntity;
4
+
5
+/**
6
+ * 创建人 mQ
7
+ * 创建时间 2019/8/16 0016 15:24
8
+ * 文件名称 GrainTypeEntity
9
+ * 说明:
10
+ * create TABLE `grain_type` (
11
+ * `id` INTEGER PRIMARY KEY AUTOINCREMENT,
12
+ * `grain_id` varchar(2000) DEFAULT NULL COMMENT '粮油品种id',
13
+ * `grain_name` varchar(2000) DEFAULT NULL COMMENT '品种名称',
14
+ * `parent_id` varchar(2000) DEFAULT NULL COMMENT '父级id'
15
+ * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='粮油品种表';
16
+ **/
17
+public class GrainTypeEntity extends BaseEntity {
18
+
19
+    //粮油品种id
20
+    public String grain_id;
21
+    //品种名称
22
+    public String grain_name;
23
+    //父级id
24
+    public String parent_id;
25
+
26
+    public String getGrain_id() {
27
+        return grain_id;
28
+    }
29
+
30
+    public void setGrain_id(String grain_id) {
31
+        this.grain_id = grain_id;
32
+    }
33
+
34
+    public String getGrain_name() {
35
+        return grain_name;
36
+    }
37
+
38
+    public void setGrain_name(String grain_name) {
39
+        this.grain_name = grain_name;
40
+    }
41
+
42
+    public String getParent_id() {
43
+        return parent_id;
44
+    }
45
+
46
+    public void setParent_id(String parent_id) {
47
+        this.parent_id = parent_id;
48
+    }
49
+}

+ 91 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/load_info/LoadInfoDao.java

@@ -0,0 +1,91 @@
1
+package com.mq.mylibrary.db.load_info;
2
+
3
+import android.database.Cursor;
4
+import android.database.sqlite.SQLiteDatabase;
5
+
6
+import com.mq.mylibrary.db.BaseDao;
7
+import com.mq.mylibrary.tool.HappySQL;
8
+import com.mq.mylibrary.tool.LogTool;
9
+
10
+import org.json.JSONArray;
11
+import org.json.JSONException;
12
+import org.json.JSONObject;
13
+
14
+import java.util.List;
15
+
16
+
17
+/**
18
+ * 创建人 mQ
19
+ * 创建时间 2019/8/16 0016 10:30
20
+ * 文件名称 LoadInfoDao
21
+ * 说明:  火车卸车信息操作类
22
+ **/
23
+public class LoadInfoDao extends BaseDao<LoadInfoEntity> {
24
+
25
+    private LoadInfoDao() {
26
+    }
27
+
28
+    private static class SingleHelper {
29
+        private static final LoadInfoDao INSTANCE = new LoadInfoDao();
30
+    }
31
+
32
+    public static LoadInfoDao get() {
33
+        return SingleHelper.INSTANCE;
34
+    }
35
+
36
+
37
+    @Override
38
+    public String getTableName() {
39
+        return "load_info";
40
+    }
41
+
42
+
43
+    public boolean insertByJSONArray(SQLiteDatabase db, JSONArray array) {
44
+        if (array == null || array.length() == 0) {
45
+            LogTool.i("初始化: 没有装车信息");
46
+            return true;
47
+        }
48
+        try {
49
+            for (int i = 0; i < array.length(); i++) {
50
+                long flg = insertByJSONObject(db, array.getJSONObject(i));
51
+                if (flg == -1)
52
+                    return false;
53
+            }
54
+            return true;
55
+        } catch (JSONException e) {
56
+            e.printStackTrace();
57
+            return false;
58
+        }
59
+    }
60
+
61
+    public long insertByJSONObject(SQLiteDatabase db, JSONObject object) {
62
+        LoadInfoEntity entity = new LoadInfoEntity();
63
+        entity.setInbound_code(object.optString("rzdh"));
64
+        entity.setTrain_code(object.optString("hcph"));
65
+        entity.setCustomer(object.optString("khmc"));
66
+        entity.setGrain_id(object.optString("lypz"));
67
+        entity.setPlatform_name(object.optString("zt"));
68
+        entity.setPosition_name(object.optString("hw"));
69
+        return insert(db, entity);
70
+    }
71
+
72
+    /**
73
+     * 获取入站单号 列表
74
+     */
75
+    public List<LoadInfoEntity> getInboundCodeList(SQLiteDatabase db) {
76
+        Cursor cursor = db.rawQuery("SELECT * FROM " + getTableName() +
77
+                " group by inbound_code order by inbound_code", null);
78
+        return HappySQL.cursor2VOList(cursor, LoadInfoEntity.class);
79
+    }
80
+
81
+    /**
82
+     * 根据入站单号 获取火车皮号 列表
83
+     */
84
+    public List<LoadInfoEntity> getTrainCodeList(SQLiteDatabase db, String inboundCode) {
85
+        Cursor cursor = db.rawQuery("SELECT * FROM " + getTableName() +
86
+                " where inbound_code = '" + inboundCode + "'" +
87
+                " order by train_code", null);
88
+        return HappySQL.cursor2VOList(cursor, LoadInfoEntity.class);
89
+    }
90
+
91
+}

+ 82 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/load_info/LoadInfoEntity.java

@@ -0,0 +1,82 @@
1
+package com.mq.mylibrary.db.load_info;
2
+
3
+import com.mq.mylibrary.db.BaseEntity;
4
+
5
+/**
6
+ * 创建人 mQ
7
+ * 创建时间 2019/8/16 0016 15:29
8
+ * 文件名称 LoadInfoEntity
9
+ * 说明:
10
+ * create TABLE `load_info` (
11
+ * `id` INTEGER PRIMARY KEY AUTOINCREMENT,
12
+ * `inbound_code` varchar(2000) DEFAULT NULL COMMENT '入站单号',
13
+ * `train_code` varchar(2000) DEFAULT NULL COMMENT '火车皮号',
14
+ * `customer` varchar(2000) DEFAULT NULL COMMENT '客户名称',
15
+ * `grain_id` varchar(2000) DEFAULT NULL COMMENT '粮油品种id',
16
+ * `platform_name` varchar(2000) DEFAULT NULL COMMENT '站台',
17
+ * `position_name` varchar(2000) DEFAULT NULL COMMENT '货位'
18
+ * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='火车卸车信息';
19
+ **/
20
+public class LoadInfoEntity extends BaseEntity {
21
+
22
+    //入站单号
23
+    public String inbound_code;
24
+    //火车皮号
25
+    public String train_code;
26
+    //客户名称
27
+    public String customer;
28
+    //粮油品种id
29
+    public String grain_id;
30
+    //站台
31
+    public String platform_name;
32
+    //货位
33
+    public String position_name;
34
+
35
+    public String getInbound_code() {
36
+        return inbound_code;
37
+    }
38
+
39
+    public void setInbound_code(String inbound_code) {
40
+        this.inbound_code = inbound_code;
41
+    }
42
+
43
+    public String getTrain_code() {
44
+        return train_code;
45
+    }
46
+
47
+    public void setTrain_code(String train_code) {
48
+        this.train_code = train_code;
49
+    }
50
+
51
+    public String getCustomer() {
52
+        return customer;
53
+    }
54
+
55
+    public void setCustomer(String customer) {
56
+        this.customer = customer;
57
+    }
58
+
59
+    public String getGrain_id() {
60
+        return grain_id;
61
+    }
62
+
63
+    public void setGrain_id(String grain_id) {
64
+        this.grain_id = grain_id;
65
+    }
66
+
67
+    public String getPlatform_name() {
68
+        return platform_name;
69
+    }
70
+
71
+    public void setPlatform_name(String platform_name) {
72
+        this.platform_name = platform_name;
73
+    }
74
+
75
+    public String getPosition_name() {
76
+        return position_name;
77
+    }
78
+
79
+    public void setPosition_name(String position_name) {
80
+        this.position_name = position_name;
81
+    }
82
+}

+ 93 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/sotre/StoreDao.java

@@ -0,0 +1,93 @@
1
+package com.mq.mylibrary.db.sotre;
2
+
3
+import android.database.Cursor;
4
+import android.database.sqlite.SQLiteDatabase;
5
+
6
+import com.mq.mylibrary.db.BaseDao;
7
+import com.mq.mylibrary.tool.HappySQL;
8
+import com.mq.mylibrary.tool.LogTool;
9
+
10
+import org.json.JSONArray;
11
+import org.json.JSONException;
12
+import org.json.JSONObject;
13
+
14
+import java.util.List;
15
+
16
+/**
17
+ * 创建人 mQ
18
+ * 创建时间 2019/8/8 0008 11:28
19
+ * 文件名称 StoreDao
20
+ * 说明:  仓房货位操作类
21
+ **/
22
+public class StoreDao extends BaseDao<StoreEntity> {
23
+
24
+    private StoreDao() {
25
+    }
26
+
27
+    private static class SingleHelper {
28
+        private static final StoreDao INSTANCE = new StoreDao();
29
+    }
30
+
31
+    public static StoreDao get() {
32
+        return SingleHelper.INSTANCE;
33
+    }
34
+
35
+    @Override
36
+    public String getTableName() {
37
+        return "store_info";
38
+    }
39
+
40
+    public boolean insertByJSONArray(SQLiteDatabase db, JSONArray array) {
41
+        if (array == null || array.length() == 0) {
42
+            LogTool.i("初始化: 没有仓房信息");
43
+            return true;
44
+        }
45
+        try {
46
+            for (int i = 0; i < array.length(); i++) {
47
+
48
+                JSONObject jsonObject = array.getJSONObject(i);
49
+                long flg = insertByJSONObject(db, jsonObject);
50
+                if (flg == -1)
51
+                    return false;
52
+            }
53
+            return true;
54
+        } catch (JSONException e) {
55
+            e.printStackTrace();
56
+            return false;
57
+        }
58
+    }
59
+
60
+    public long insertByJSONObject(SQLiteDatabase db, JSONObject object) {
61
+        StoreEntity entity = new StoreEntity();
62
+        entity.setStore_name(object.optString("cf_name"));
63
+        entity.setStore_id(object.optString("cf_id"));
64
+        entity.setStore_code(object.optString("cf_code"));
65
+        entity.setPosition_name(object.optString("hw_name"));
66
+        entity.setPosition_id(object.optString("hw_id"));
67
+        entity.setPosition_code(object.optString("hw_code"));
68
+        return insert(db, entity);
69
+    }
70
+
71
+    /**
72
+     * 获取仓房选项
73
+     */
74
+    public List<StoreEntity> getStoreList(SQLiteDatabase db) {
75
+        String sql = "SELECT  * FROM " + getTableName() + " group by store_name order by store_id";
76
+        LogTool.i("获取仓房列表:" + sql);
77
+        Cursor cursor = db.rawQuery(sql, null);
78
+        return HappySQL.cursor2VOList(cursor, StoreEntity.class);
79
+    }
80
+
81
+    /**
82
+     * 获取货位
83
+     */
84
+    public List<StoreEntity> getPositionList(SQLiteDatabase db, String houseName) {
85
+        String sql = "SELECT * FROM " + getTableName() +
86
+                " WHERE store_name = '" + houseName + "'" +
87
+                " group by position_name order by position_id";
88
+        LogTool.i("获取货位列表:" + sql);
89
+        Cursor cursor = db.rawQuery(sql, null);
90
+        return HappySQL.cursor2VOList(cursor, StoreEntity.class);
91
+    }
92
+
93
+}

+ 82 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/sotre/StoreEntity.java

@@ -0,0 +1,82 @@
1
+package com.mq.mylibrary.db.sotre;
2
+
3
+import com.mq.mylibrary.db.BaseEntity;
4
+
5
+/**
6
+ * 创建人 mQ
7
+ * 创建时间 2019/8/9 0009 15:43
8
+ * 文件名称 StoreEntity
9
+ * 说明:
10
+ * create TABLE `storeinfo` (
11
+ * `id` INTEGER PRIMARY KEY AUTOINCREMENT,
12
+ * `store_name` varchar(2000) DEFAULT NULL COMMENT '仓房名称',
13
+ * `store_id` varchar(2000) DEFAULT NULL COMMENT '仓房Id',
14
+ * `store_code` varchar(2000) DEFAULT NULL COMMENT '仓房代码',
15
+ * `position_name` varchar(2000) DEFAULT NULL COMMENT '货位名称',
16
+ * `position_id` varchar(2000) DEFAULT NULL COMMENT '货位Id',
17
+ * `position_code` varchar(2000) DEFAULT NULL COMMENT '货位代码'
18
+ * ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='仓房货位表';
19
+ **/
20
+public class StoreEntity extends BaseEntity {
21
+
22
+    //仓房名称
23
+    public String store_name;
24
+    //仓房Id
25
+    public String store_id;
26
+    //仓房代码
27
+    public String store_code;
28
+    //货位名称
29
+    public String position_name;
30
+    //货位Id
31
+    public String position_id;
32
+    //货位代码
33
+    public String position_code;
34
+
35
+    public String getStore_name() {
36
+        return store_name;
37
+    }
38
+
39
+    public void setStore_name(String store_name) {
40
+        this.store_name = store_name;
41
+    }
42
+
43
+    public String getStore_id() {
44
+        return store_id;
45
+    }
46
+
47
+    public void setStore_id(String store_id) {
48
+        this.store_id = store_id;
49
+    }
50
+
51
+    public String getStore_code() {
52
+        return store_code;
53
+    }
54
+
55
+    public void setStore_code(String store_code) {
56
+        this.store_code = store_code;
57
+    }
58
+
59
+    public String getPosition_name() {
60
+        return position_name;
61
+    }
62
+
63
+    public void setPosition_name(String position_name) {
64
+        this.position_name = position_name;
65
+    }
66
+
67
+    public String getPosition_id() {
68
+        return position_id;
69
+    }
70
+
71
+    public void setPosition_id(String position_id) {
72
+        this.position_id = position_id;
73
+    }
74
+
75
+    public String getPosition_code() {
76
+        return position_code;
77
+    }
78
+
79
+    public void setPosition_code(String position_code) {
80
+        this.position_code = position_code;
81
+    }
82
+}

+ 0 - 0
mylibrary/src/main/java/com/mq/mylibrary/db/team_group/TeamGroupDao.java


Some files were not shown because too many files changed in this diff