Compare commits
4 Commits
47715f0fd6
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d43980458 | |||
| 0800e0eaf0 | |||
| ce30c6cf7b | |||
| cdc07256ee |
@ -11,7 +11,7 @@ android {
|
|||||||
minSdk 28
|
minSdk 28
|
||||||
targetSdk 28
|
targetSdk 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "2.1"
|
versionName "2.4"
|
||||||
|
|
||||||
// 1.0 IDATA广播模式处理
|
// 1.0 IDATA广播模式处理
|
||||||
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
// 1.1 霍尼韦尔的监听修改(扫描网站二维码跳出程序,监听失效,调整)、斑马PDA广播模式设置
|
||||||
@ -34,6 +34,9 @@ android {
|
|||||||
// 1.18 瑞兴平板,读取扫描结果,使用同步加锁模式
|
// 1.18 瑞兴平板,读取扫描结果,使用同步加锁模式
|
||||||
// 1.19 index页面接入初始化数据
|
// 1.19 index页面接入初始化数据
|
||||||
// 2.1 注册PDA的信息存储到文件内部,采取mac+固定加密串的MD5加密校验
|
// 2.1 注册PDA的信息存储到文件内部,采取mac+固定加密串的MD5加密校验
|
||||||
|
// 2.2 安卓14以上,无法获取mac地址,修改成获取唯一id作为mac地址
|
||||||
|
// 2.3 适配IOT_Device:sc55g PDA 广播模式
|
||||||
|
// 2.4 适配 qualcomm:mc50 PDA 广播模式
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
|
|||||||
@ -10,6 +10,8 @@ package chaoran.business;
|
|||||||
|
|
||||||
public enum BrandEnum {
|
public enum BrandEnum {
|
||||||
//枚举名即为valueOf()
|
//枚举名即为valueOf()
|
||||||
|
QUALCOMM("qualcomm", "qualcomm"),
|
||||||
|
IOT_DEVICE("新大陆", "iot_device"),
|
||||||
NEW_LAND("新大陆", "newland"),
|
NEW_LAND("新大陆", "newland"),
|
||||||
HISENSE("海信", "hisense"),
|
HISENSE("海信", "hisense"),
|
||||||
UROVO("DT50 Lite", "urovo"),
|
UROVO("DT50 Lite", "urovo"),
|
||||||
@ -44,7 +46,7 @@ public enum BrandEnum {
|
|||||||
code = new String();
|
code = new String();
|
||||||
}
|
}
|
||||||
for (BrandEnum brandEnum : values()) {
|
for (BrandEnum brandEnum : values()) {
|
||||||
if (brandEnum.code.equals(code.toLowerCase())) {
|
if (brandEnum.code.equalsIgnoreCase(code)) {
|
||||||
return brandEnum;
|
return brandEnum;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -164,6 +164,12 @@ public class MainActivity extends AppCompatActivity implements ResultListener{
|
|||||||
case NEW_LAND:
|
case NEW_LAND:
|
||||||
adapter = new NewlandAdapter(this, this);
|
adapter = new NewlandAdapter(this, this);
|
||||||
break;
|
break;
|
||||||
|
case IOT_DEVICE:
|
||||||
|
adapter = new IOT_DeviceAdapter(this, this);
|
||||||
|
break;
|
||||||
|
case QUALCOMM:
|
||||||
|
adapter = new QualcommAdapter(this, this);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (null != adapter) {
|
if (null != adapter) {
|
||||||
adapter.start();
|
adapter.start();
|
||||||
|
|||||||
@ -8,6 +8,10 @@ import android.content.IntentFilter;
|
|||||||
import chaoran.business.activity.ResultListener;
|
import chaoran.business.activity.ResultListener;
|
||||||
import chaoran.business.strategy.Strategy;
|
import chaoran.business.strategy.Strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23-6-13 霍尼韦尔EDA56使用
|
||||||
|
* 25-1-14 兰陵县人民医院 测试可以使用(唐圆圆)
|
||||||
|
*/
|
||||||
public class HoneywellEda56Adapter implements Adapter {
|
public class HoneywellEda56Adapter implements Adapter {
|
||||||
private Context context;
|
private Context context;
|
||||||
private ResultListener resultListener;
|
private ResultListener resultListener;
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
package chaoran.business.adapter;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
|
||||||
|
import chaoran.business.activity.ResultListener;
|
||||||
|
import chaoran.business.strategy.Strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适配 sc55g
|
||||||
|
*/
|
||||||
|
public class IOT_DeviceAdapter implements Adapter {
|
||||||
|
private Context context;
|
||||||
|
private ResultListener resultListener;
|
||||||
|
private Strategy strategy;
|
||||||
|
|
||||||
|
|
||||||
|
public IOT_DeviceAdapter(Context context, ResultListener resultListener) {
|
||||||
|
this.context = context;
|
||||||
|
this.resultListener = resultListener;
|
||||||
|
strategy = new Receiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
strategy.executeStrategy(resultListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
strategy.exclusiveStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Receiver extends BroadcastReceiver implements Strategy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
resultListener.result(intent.getStringExtra("message"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeStrategy(ResultListener resultListener) {
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction("com.speedata.showdecodedata");
|
||||||
|
filter.setPriority(2);
|
||||||
|
context.registerReceiver(this, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exclusiveStrategy() {
|
||||||
|
context.unregisterReceiver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package chaoran.business.adapter;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
|
||||||
|
import chaoran.business.activity.ResultListener;
|
||||||
|
import chaoran.business.strategy.Strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 适配 mc50
|
||||||
|
*/
|
||||||
|
public class QualcommAdapter implements Adapter {
|
||||||
|
private Context context;
|
||||||
|
private ResultListener resultListener;
|
||||||
|
private Strategy strategy;
|
||||||
|
|
||||||
|
|
||||||
|
public QualcommAdapter(Context context, ResultListener resultListener) {
|
||||||
|
this.context = context;
|
||||||
|
this.resultListener = resultListener;
|
||||||
|
strategy = new Receiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
strategy.executeStrategy(resultListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
strategy.exclusiveStrategy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Receiver extends BroadcastReceiver implements Strategy {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
resultListener.result(intent.getStringExtra("data"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void executeStrategy(ResultListener resultListener) {
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction("com.scanner.broadcast");
|
||||||
|
filter.setPriority(2);
|
||||||
|
context.registerReceiver(this, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exclusiveStrategy() {
|
||||||
|
context.unregisterReceiver(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,16 @@
|
|||||||
package chaoran.business.utils;
|
package chaoran.business.utils;
|
||||||
|
|
||||||
|
import static androidx.core.content.ContextCompat.getSystemService;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.net.wifi.WifiInfo;
|
||||||
|
import android.net.wifi.WifiManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -62,6 +67,14 @@ public class LocalAddressUtil {
|
|||||||
@SuppressLint("JavascriptInterface")
|
@SuppressLint("JavascriptInterface")
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public String getMacAddress(){//可以兼容安卓7以下
|
public String getMacAddress(){//可以兼容安卓7以下
|
||||||
|
if (Build.VERSION.SDK_INT >= 34) { // Android 14 is code-named Tiramisu
|
||||||
|
try {
|
||||||
|
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||||
|
}catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "02:00:00:00:00:02";
|
||||||
|
}
|
||||||
|
}
|
||||||
String macAddress = null;
|
String macAddress = null;
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
NetworkInterface networkInterface = null;
|
NetworkInterface networkInterface = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user