Compare commits
2 Commits
5769b7670b
...
47715f0fd6
| Author | SHA1 | Date | |
|---|---|---|---|
| 47715f0fd6 | |||
| 59c228f36c |
@ -11,7 +11,7 @@ android {
|
|||||||
minSdk 28
|
minSdk 28
|
||||||
targetSdk 28
|
targetSdk 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.18"
|
versionName "2.1"
|
||||||
|
|
||||||
// 1.0 IDATA广播模式处理
|
// 1.0 IDATA广播模式处理
|
||||||
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
||||||
@ -32,6 +32,8 @@ android {
|
|||||||
// 1.16 idata pda 不设置模式
|
// 1.16 idata pda 不设置模式
|
||||||
// 1.17 霍尼韦尔EDA51、EDA50P,调用扫描枪的方法,在关闭的时候停止调用扫描枪
|
// 1.17 霍尼韦尔EDA51、EDA50P,调用扫描枪的方法,在关闭的时候停止调用扫描枪
|
||||||
// 1.18 瑞兴平板,读取扫描结果,使用同步加锁模式
|
// 1.18 瑞兴平板,读取扫描结果,使用同步加锁模式
|
||||||
|
// 1.19 index页面接入初始化数据
|
||||||
|
// 2.1 注册PDA的信息存储到文件内部,采取mac+固定加密串的MD5加密校验
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
|
|||||||
@ -99,20 +99,6 @@
|
|||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script>
|
|
||||||
function saveSetting(){
|
|
||||||
var data=JSON.stringify({
|
|
||||||
"address":document.getElementById('address').value,
|
|
||||||
"port":document.getElementById('port').value,
|
|
||||||
"path":document.getElementById('path').value,
|
|
||||||
"screen_rotation":document.getElementById('screen_rotation').value,
|
|
||||||
"hide_bar":document.getElementById('hide_bar').value
|
|
||||||
});
|
|
||||||
window.NetworkSettingEngine.saveSetting(data);
|
|
||||||
window.View.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -148,4 +134,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
var dstr = window.NetworkSettingEngine.getStringSetting();
|
||||||
|
if (dstr.length > 0) {
|
||||||
|
var d = JSON.parse(dstr);
|
||||||
|
document.getElementById('address').value = d.address;
|
||||||
|
document.getElementById('port').value = d.port;
|
||||||
|
document.getElementById('path').value = d.path;
|
||||||
|
document.getElementById('screen_rotation').value = d.screen_rotation;
|
||||||
|
document.getElementById('hide_bar').value = d.hide_bar;
|
||||||
|
console.log("d_data_end_=========================");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
function saveSetting(){
|
||||||
|
var data=JSON.stringify({
|
||||||
|
"address":document.getElementById('address').value,
|
||||||
|
"port":document.getElementById('port').value,
|
||||||
|
"path":document.getElementById('path').value,
|
||||||
|
"screen_rotation":document.getElementById('screen_rotation').value,
|
||||||
|
"hide_bar":document.getElementById('hide_bar').value
|
||||||
|
});
|
||||||
|
window.NetworkSettingEngine.saveSetting(data);
|
||||||
|
window.View.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public class NetworkSettingEngine implements SettingEngine {
|
|||||||
networkSetting.setPort(port);
|
networkSetting.setPort(port);
|
||||||
networkSetting.setPath(path);
|
networkSetting.setPath(path);
|
||||||
networkSetting.setScreen_rotation(screen_rotation);
|
networkSetting.setScreen_rotation(screen_rotation);
|
||||||
|
networkSetting.setHide_bar(spf.getInt("hide_bar", 3));
|
||||||
return networkSetting;
|
return networkSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package chaoran.business.utils;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.bluetooth.le.ScanSettings;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -18,13 +18,12 @@ import java.net.NetworkInterface;
|
|||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import chaoran.business.BrandEnum;
|
|
||||||
import chaoran.business.BuildConfig;
|
import chaoran.business.BuildConfig;
|
||||||
import chaoran.business.R;
|
|
||||||
import chaoran.business.activity.MainActivity;
|
|
||||||
|
|
||||||
public class LocalAddressUtil {
|
public class LocalAddressUtil {
|
||||||
|
|
||||||
|
public final static String SSO_KEY = "!~CROP@CRTECH@PDA~!";
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
@ -160,6 +159,32 @@ public class LocalAddressUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("JavascriptInterface")
|
||||||
|
@JavascriptInterface
|
||||||
|
public String registerMac(String applyMac) {
|
||||||
|
try {
|
||||||
|
String mac = this.getMacAddress();
|
||||||
|
String md5Hash = MD5.md5(mac + SSO_KEY);
|
||||||
|
if (md5Hash != null && md5Hash.equals(applyMac)) {
|
||||||
|
// 将允许注册适配的mac写入文件中
|
||||||
|
SharedPreferences.Editor editor = context.getSharedPreferences("CrtechPdaConfig", Context.MODE_PRIVATE).edit();
|
||||||
|
editor.putString("checkMac", "success");
|
||||||
|
editor.commit();
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
}catch (Exception ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("JavascriptInterface")
|
||||||
|
@JavascriptInterface
|
||||||
|
public String checkMacRegister() {
|
||||||
|
SharedPreferences sharedPreferences = context.getSharedPreferences("CrtechPdaConfig", Context.MODE_PRIVATE);
|
||||||
|
return sharedPreferences.getString("checkMac", "error");
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("JavascriptInterface")
|
@SuppressLint("JavascriptInterface")
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public String getApkVersion() {
|
public String getApkVersion() {
|
||||||
|
|||||||
34
app/src/main/java/chaoran/business/utils/MD5.java
Normal file
34
app/src/main/java/chaoran/business/utils/MD5.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package chaoran.business.utils;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
|
// 从框架的MD5加密类拷贝过来的
|
||||||
|
public class MD5 {
|
||||||
|
private static final String key = "aa";
|
||||||
|
private static final char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||||
|
|
||||||
|
public static final String md5(String s) {
|
||||||
|
return s == null ? null : md5(s.getBytes());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String md5(byte[] bytes) {
|
||||||
|
try {
|
||||||
|
MessageDigest mdTemp = MessageDigest.getInstance("MD5");
|
||||||
|
mdTemp.update(bytes);
|
||||||
|
byte[] md = mdTemp.digest();
|
||||||
|
int j = md.length;
|
||||||
|
char[] str = new char[j * 2];
|
||||||
|
int k = 0;
|
||||||
|
|
||||||
|
for(int i = 0; i < j; ++i) {
|
||||||
|
byte byte0 = md[i];
|
||||||
|
str[k++] = hexDigits[byte0 >>> 4 & 15];
|
||||||
|
str[k++] = hexDigits[byte0 & 15];
|
||||||
|
}
|
||||||
|
|
||||||
|
return new String(str);
|
||||||
|
} catch (Exception var8) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user