完成 idata

idata
wanghao 6 months ago
parent 6d2031f1a4
commit 5f2f58dbb0

@ -16,6 +16,7 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// SO
//noinspection ChromeOsAbiSupport,ChromeOsAbiSupport
abiFilters 'arm64-v8a' , 'armeabi' , 'armeabi-v7a'
}
}
@ -42,12 +43,12 @@ dependencies {
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation files('libs\\6109\\App_Demo_API.jar')
implementation files('libs\\6109\\DeviceAPIver20150204.jar')
implementation files('libs\\6109\\logutil-1.5.1.1.jar')
implementation files('libs\\6109\\ModuleAPI_J.jar')
implementation files('libs\\6109\\reader(1).jar')
implementation files('libs\\6109\\UHF67_v3.6.jar')
implementation files('libs\\App_Demo_API.jar')
implementation files('libs\\DeviceAPIver20150204.jar')
implementation files('libs\\logutil-1.5.1.1.jar')
implementation files('libs\\ModuleAPI_J.jar')
implementation files('libs\\reader(1).jar')
implementation files('libs\\UHF67_v3.6.jar')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

@ -49,7 +49,7 @@ public class BFActivity extends BaseActivity implements TakePictureDialog.dialog
}
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
var epc = epcs.get(0);
byte[] epcId = epc.EpcId;
String epc1 = HexAscii.hex2Str(Tools.Bytes2HexString(epcId, epcId.length));

@ -115,7 +115,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
// 扫描到返回数据
@SuppressLint("NotifyDataSetChanged")
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
if (tagList.contains(t)) {

@ -67,10 +67,7 @@ public class CheckListActivity extends BaseActivity implements AdapterClickCall
});
}
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
}
public void check_start(View view) {
OkGo.<MyResult>post(url + "/xj/createTask")

@ -37,7 +37,7 @@ public class FpInActivity extends BaseActivity {
}
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
Reader.TAGINFO taginfo = epcs.get(0);
var epc = HexAscii.hex2Str(Tools.Bytes2HexString(taginfo.EpcId,taginfo.EpcId.length));
vm.setEpc(epc);

@ -50,7 +50,7 @@ public class FpOutActivity extends BaseActivity {
private List<String> tagList;
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
if (tagList==null) return;
epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);

@ -15,25 +15,28 @@ import android.widget.Toast;
import com.example.beijing_daxing.adapter.CheckListAdapter;
import com.example.beijing_daxing.adapter.HomePageAdapter;
import com.example.beijing_daxing.base.BaseActivity;
import com.example.beijing_daxing.base.MyApplication;
import com.example.beijing_daxing.broadcast.MyNetWorkReceiver;
import com.example.beijing_daxing.databinding.ActivityHomePageBinding;
import com.example.beijing_daxing.been.HomeIcon;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.uhf.api.cls.Reader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class HomePageActivity extends AppCompatActivity {
private MyNetWorkReceiver myNetWorkReceiver;
public class HomePageActivity extends BaseActivity {
// private MyNetWorkReceiver myNetWorkReceiver;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityHomePageBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_home_page);
initUi(binding);
/* myNetWorkReceiver=new MyNetWorkReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
@ -63,6 +66,7 @@ public class HomePageActivity extends AppCompatActivity {
protected void onDestroy() {
super.onDestroy();
var uhfLongerManager = MyApplication.getUhfLongerManager();
uhfLongerManager.setGen2session(false);
uhfLongerManager.asyncStopReading();
uhfLongerManager.close();
MyApplication.uhfLongerManager = null;
@ -70,6 +74,8 @@ public class HomePageActivity extends AppCompatActivity {
// unregisterReceiver(myNetWorkReceiver);
}
private void initUi(ActivityHomePageBinding binding) {
List<HomeIcon> list = new ArrayList<>();
list.add(new HomeIcon(R.mipmap.home_in1, "轮挡入库", InActivity.class));

@ -64,13 +64,21 @@ public class InActivity extends BaseActivity implements AdapterClickCall {
}
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.stream().forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
if (!epc.substring(0,8).equals("53574C44")) return;
Log.e("TAG", "sanRfid:" + epc);
try {
if (!epc.substring(0,8).equals("53574C44")) return;
}catch (StringIndexOutOfBoundsException indexOutOfBoundsException){
}
Log.e("TAG", "sanRfid:" + tagList.toString());
if (tagList.contains(epc)) return;
tagList.add(epc);
epcList.add(HexAscii.hex2Str(epc));
// epcList.add(epc);
});
vm.setSanLength(epcList.size());
adapter.notifyDataSetChanged();

@ -45,10 +45,7 @@ public class MainActivity extends BaseActivity {
// .update();
}
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
}
public void login_click(View view) {
String pass = loginVm.getPass();

@ -54,7 +54,7 @@ public class OutActivity extends BaseActivity implements AdapterClickCall {
}
@SuppressLint("NotifyDataSetChanged")
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId,t.EpcId.length);
if (!epc.startsWith("53574C44")) return;

@ -20,13 +20,13 @@ public class SetingPowerActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
ActivitySetingPowerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_seting_power);
powerData = new PowerData();
powerData.setPowerIn( SharedPreferencesUtils.getInt("powerIn",0));
powerData.setPowerOut( SharedPreferencesUtils.getInt("powerOut",0));
powerData.setPowerStockCheck( SharedPreferencesUtils.getInt("powerStoreCheck",0));
powerData.setPowerCheck( SharedPreferencesUtils.getInt("powerCheck",0));
powerData.setPowerScrap( SharedPreferencesUtils.getInt("powerScrap",0));
powerData.setPowerScrapIn( SharedPreferencesUtils.getInt("powerScrapIn",0));
powerData.setPowerScrapOut( SharedPreferencesUtils.getInt("powerScrapOut",0));
powerData.setPowerIn( SharedPreferencesUtils.getInt("powerIn",33));
powerData.setPowerOut( SharedPreferencesUtils.getInt("powerOut",17));
powerData.setPowerStockCheck( SharedPreferencesUtils.getInt("powerStoreCheck",33));
powerData.setPowerCheck( SharedPreferencesUtils.getInt("powerCheck",33));
powerData.setPowerScrap( SharedPreferencesUtils.getInt("powerScrap",17));
powerData.setPowerScrapIn( SharedPreferencesUtils.getInt("powerScrapIn",17));
powerData.setPowerScrapOut( SharedPreferencesUtils.getInt("powerScrapOut",17));
binding.setVm(powerData);

@ -44,7 +44,8 @@ public class StoreCheckActivity extends BaseActivity {
private int checkNumber;
private ActivityStoreCheckBinding binding;
private ActivityStoreCheckBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -54,16 +55,16 @@ public class StoreCheckActivity extends BaseActivity {
checkAdapter = new StoreCheckAdapter(this);
binding.setAdapter(checkAdapter);
initRequest();
checkNumber=0;
checkNumber = 0;
binding.setCheckNumber(checkNumber);
setPower(SharedPreferencesUtils.getInt("powerStoreCheck",33));
setPower(SharedPreferencesUtils.getInt("powerStoreCheck", 33));
}
private List<String> tagList;
@SuppressLint("NotifyDataSetChanged")
@Override
protected void sanRfid(List<Reader.TAGINFO> epcs) {
public void sanRfid(List<Reader.TAGINFO> epcs) {
if (tagList == null) return;
epcs.forEach(t -> {
var epc = Tools.Bytes2HexString(t.EpcId, t.EpcId.length);
@ -95,7 +96,7 @@ public class StoreCheckActivity extends BaseActivity {
}.getType());
tagList = new ArrayList<>();
checkAdapter.setList(list);
checkNumber=list.size();
checkNumber = list.size();
binding.setCheckNumber(checkNumber);
binding.setListNumber(checkNumber);
@ -119,10 +120,7 @@ public class StoreCheckActivity extends BaseActivity {
public void store_check_submit(View view) {
handler.removeCallbacks(runnable);
OkGo.<MyResult>post(url + "/storecheck/submit")
.tag(this)
.params("user", SharedPreferencesUtils.getstring("user", "test"))
.params("json", gson.toJson(list))
OkGo.<MyResult>post(url + "/storecheck/submit").tag(this).params("user", SharedPreferencesUtils.getstring("user", "test")).params("json", gson.toJson(list))
// .upRequestBody(RequestBody.create(JSON, gson.toJson(list)))
.execute(new MyRecultCall(dialog, this) {
@Override

@ -40,12 +40,12 @@ import java.util.List;
import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
public static String url = "http://192.168.137.1:8090/api";
// public static String url = "http://119.45.202.115:8090/api";
// public static String url = "http://192.168.137.1:8090/api";
public static String url = "http://119.45.202.115:8090/api";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
public UHFRManager uhfLongerManager;
public UHFRManager uhfrManager;
private MediaPlayer mediaPlayer;
public MyReceiver myReceiver;
public Intent broadcastIntent;
@ -77,12 +77,11 @@ public abstract class BaseActivity extends AppCompatActivity {
}
public void sanEpc() {
List<Reader.TAGINFO> strings = uhfLongerManager.tagInventoryRealTime();
// Log.e("TAG", "驱动" + (uhfLongerManager == null));
uhfrManager.asyncStartReading();
List<Reader.TAGINFO> strings = uhfrManager.tagInventoryRealTime();
if (strings == null || strings.isEmpty()) {
return;
}
mediaPlayer.start();
sanRfid(strings);
}
@ -96,10 +95,9 @@ public abstract class BaseActivity extends AppCompatActivity {
}
private void initSan() {
uhfLongerManager = MyApplication.getUhfLongerManager();
// intentFilter.addAction("android.intent.action.FUN_KEY");
uhfLongerManager.asyncStartReading();
uhfrManager = MyApplication.getUhfLongerManager();
// intentFilter.addAction("android.intent.action.FUN_KEY");
myReceiver = new MyReceiver();
IntentFilter intentFilter = new IntentFilter();
@ -110,10 +108,10 @@ public abstract class BaseActivity extends AppCompatActivity {
public void setPower(int power) {
try {
Reader.READER_ERR readerErr = uhfLongerManager.setPower(power, power);
Reader.READER_ERR readerErr = uhfrManager.setPower(power, power);
Log.e("TAG", "setPower:" + readerErr.name());
int[] power1 = uhfLongerManager.getPower();
int[] power1 = uhfrManager.getPower();
Log.e("TAG", "readPower:" + power1[0] + "," + power1[1]);
} catch (Exception e) {
@ -128,7 +126,7 @@ public abstract class BaseActivity extends AppCompatActivity {
}
protected abstract void sanRfid(List<Reader.TAGINFO> epcs);
public void sanRfid(List<Reader.TAGINFO> epcs){};
public static final int CAMERA_PHOTO = 0X02;
public File outputImage;

@ -15,6 +15,7 @@ import com.lzy.okgo.cookie.CookieJarImpl;
import com.lzy.okgo.cookie.store.MemoryCookieStore;
import com.lzy.okgo.https.HttpsUtils;
import com.lzy.okgo.interceptor.HttpLoggingInterceptor;
import com.uhf.api.cls.Reader;
import com.xuexiang.xupdate.XUpdate;
import com.xuexiang.xupdate.easy.service.OkHttpUpdateHttpServiceImpl;
@ -58,13 +59,18 @@ public class MyApplication extends Application {
.supportSilentInstall(false) // 设置是否支持静默安装默认是true
.setIUpdateHttpService(new OkHttpUpdateHttpServiceImpl()) // 这个必须设置!实现网络请求功能。
.init(this);
getUhfLongerManager();
}
public static UHFRManager getUhfLongerManager() {
if (uhfLongerManager==null){
try {
Log.e("TAG", "UhfLongerManager:初始化" );
uhfLongerManager = UHFRManager.getInstance();
uhfLongerManager.setRegion(Reader.Region_Conf.RG_PRC);
uhfLongerManager.setPower(33,33);
uhfLongerManager.setGen2session(true);
uhfLongerManager.asyncStartReading();
} catch (Exception e) {
e.printStackTrace();
}

Loading…
Cancel
Save