diff --git a/app/build.gradle b/app/build.gradle index 420184d..e972357 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,43 +39,23 @@ android { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) implementation 'androidx.appcompat:appcompat:1.6.1' - //noinspection GradleCompatible 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\\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') -// implementation files('libs\\uhflonger_v1.3.jar') -// implementation files('libs\\ModuleAPI_J.jar') + 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') testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'com.lzy.net:okgo:3.0.4' - // https://mvnrepository.com/artifact/com.google.code.gson/gson implementation 'com.google.code.gson:gson:2.10.1' - // https://mvnrepository.com/artifact/com.contrarywind/Android-PickerView -// implementation 'com.contrarywind:Android-PickerView:4.1.9' implementation 'org.litepal.android:java:3.0.0' - - implementation 'com.github.xuexiangjys:XUpdate:2.1.4' implementation 'com.github.xuexiangjys.XUpdateAPI:xupdate-easy:1.0.1' -// -// -// implementation 'com.lzy.net:okhttputils:1.6.0' //可以单独使用,不需要依赖下方的扩展包 -// implementation 'com.lzy.net:okhttpserver:0.1.7' //扩展了下载管理和上传管理,根据需要添加 - -// implementation 'com.jakewharton:butterknife:10.2.0' -// annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' -// implementation 'com.github.bumptech.glide:glide:4.8.0' -// annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' - - // https://mvnrepository.com/artifact/com.github.bumptech.glide/glide implementation 'com.github.bumptech.glide:glide:4.16.0' } \ No newline at end of file diff --git a/app/libs/App_Demo_API.jar b/app/libs/6109/App_Demo_API.jar similarity index 100% rename from app/libs/App_Demo_API.jar rename to app/libs/6109/App_Demo_API.jar diff --git a/app/libs/DeviceAPIver20150204.jar b/app/libs/6109/DeviceAPIver20150204.jar similarity index 100% rename from app/libs/DeviceAPIver20150204.jar rename to app/libs/6109/DeviceAPIver20150204.jar diff --git a/app/libs/ModuleAPI_J.jar b/app/libs/6109/ModuleAPI_J.jar similarity index 100% rename from app/libs/ModuleAPI_J.jar rename to app/libs/6109/ModuleAPI_J.jar diff --git a/app/libs/UHF67_v3.6.jar b/app/libs/6109/UHF67_v3.6.jar similarity index 100% rename from app/libs/UHF67_v3.6.jar rename to app/libs/6109/UHF67_v3.6.jar diff --git a/app/libs/logutil-1.5.1.1.jar b/app/libs/6109/logutil-1.5.1.1.jar similarity index 100% rename from app/libs/logutil-1.5.1.1.jar rename to app/libs/6109/logutil-1.5.1.1.jar diff --git a/app/libs/reader(1).jar b/app/libs/6109/reader(1).jar similarity index 100% rename from app/libs/reader(1).jar rename to app/libs/6109/reader(1).jar diff --git a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java index ba3f464..069d398 100644 --- a/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/HomePageActivity.java @@ -61,12 +61,8 @@ public class HomePageActivity extends AppCompatActivity { @Override protected void onDestroy() { super.onDestroy(); - var uhfLongerManager = MyApplication.getUhfLongerManager(); - uhfLongerManager.asyncStopReading(); - uhfLongerManager.close(); - MyApplication.uhfLongerManager = null; Log.e("TAG", "关闭" ); - // unregisterReceiver(myNetWorkReceiver); + } private void initUi(ActivityHomePageBinding binding) { @@ -75,11 +71,10 @@ public class HomePageActivity extends AppCompatActivity { list.add(new HomeIcon(R.mipmap.home_out1, "轮挡领用出库", OutActivity.class)); list.add(new HomeIcon(R.mipmap.home_store_check, "仓库盘点", StoreCheckActivity.class)); list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", CheckActivity.class)); - // list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", OffLineCheckActivity.class)); list.add(new HomeIcon(R.mipmap.home_bf, "轮挡报废", BFActivity.class)); list.add(new HomeIcon(R.mipmap.home_in, "废品入库", FpInActivity.class)); list.add(new HomeIcon(R.mipmap.home_out, "废品出库", FpOutActivity.class)); - // list.add(new HomeIcon(R.mipmap.home_out, "功率设置", FpOutActivity.class)); + list.add(new HomeIcon(R.mipmap.home_setting, "功率设置", SetingPowerActivity.class)); var intent = getIntent(); try { if (!intent.getStringExtra("user").equals("admin")) { diff --git a/app/src/main/java/com/example/beijing_daxing/SetingPowerActivity.java b/app/src/main/java/com/example/beijing_daxing/SetingPowerActivity.java index 4a09dda..0c78366 100644 --- a/app/src/main/java/com/example/beijing_daxing/SetingPowerActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/SetingPowerActivity.java @@ -1,14 +1,47 @@ package com.example.beijing_daxing; import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; +import androidx.databinding.ViewDataBinding; +import android.app.Activity; import android.os.Bundle; +import android.view.View; + +import com.example.beijing_daxing.databinding.ActivitySetingPowerBinding; +import com.example.beijing_daxing.uitls.SharedPreferencesUtils; +import com.example.beijing_daxing.vm.PowerData; public class SetingPowerActivity extends AppCompatActivity { + private PowerData powerData; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_seting_power); + 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)); + + binding.setVm(powerData); + + } + + public void settingSeva(View view) { + SharedPreferencesUtils.putInt("powerIn", powerData.getPowerIn()); + SharedPreferencesUtils.putInt("powerOut", powerData.getPowerOut()); + SharedPreferencesUtils.putInt("powerStoreCheck", powerData.getPowerStockCheck()); + SharedPreferencesUtils.putInt("powerCheck", powerData.getPowerCheck()); + SharedPreferencesUtils.putInt("powerScrap", powerData.getPowerScrap()); + SharedPreferencesUtils.putInt("powerScrapIn", powerData.getPowerScrapIn()); + SharedPreferencesUtils.putInt("powerScrapOut", powerData.getPowerScrapOut()); + + finish(); + } } \ No newline at end of file diff --git a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java index 4fcde3d..a398e65 100644 --- a/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java +++ b/app/src/main/java/com/example/beijing_daxing/base/BaseActivity.java @@ -60,6 +60,7 @@ public abstract class BaseActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); gson = new Gson(); + initDialog(); initSan(); broadcastIntent = new Intent("android.rfid.FUN_KEY"); @@ -101,10 +102,6 @@ public abstract class BaseActivity extends AppCompatActivity { } private void initSan() { - uhfLongerManager = MyApplication.getUhfLongerManager(); - // intentFilter.addAction("android.intent.action.FUN_KEY"); - - uhfLongerManager.asyncStartReading(); myReceiver = new MyReceiver(); IntentFilter intentFilter = new IntentFilter(); @@ -148,9 +145,7 @@ public abstract class BaseActivity extends AppCompatActivity { outputImage = new File(getExternalCacheDir(), "output_imgage" + format.format(new Date()) + ".jpg"); -// if (outputImage.exists()) { -// outputImage.delete(); -// } + try { outputImage.createNewFile(); @@ -160,15 +155,12 @@ public abstract class BaseActivity extends AppCompatActivity { } if (Build.VERSION.SDK_INT >= 24) { img_uri = FileProvider.getUriForFile(this, "com.example.beijing_daxing", outputImage); - Log.e("TAG", "teke_photo1"+img_uri.toString() ); + Log.e("TAG", "teke_photo1" + img_uri.toString()); } else { img_uri = Uri.fromFile(outputImage); - Log.e("TAG", "teke_photo2" ); + Log.e("TAG", "teke_photo2"); } - if ( - PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) - - ) { + if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT, img_uri); startActivityForResult(intent, CAMERA_PHOTO); diff --git a/app/src/main/java/com/example/beijing_daxing/base/MyApplication.java b/app/src/main/java/com/example/beijing_daxing/base/MyApplication.java index b42ed2d..3a9daf8 100644 --- a/app/src/main/java/com/example/beijing_daxing/base/MyApplication.java +++ b/app/src/main/java/com/example/beijing_daxing/base/MyApplication.java @@ -39,7 +39,8 @@ import okhttp3.OkHttpClient; public class MyApplication extends Application { MyApplication application; - public static UHFRManager uhfLongerManager; + // public static UHFRManager uhfLongerManager; + @Override public void onCreate() { super.onCreate(); @@ -47,32 +48,30 @@ public class MyApplication extends Application { LitePal.initialize(this); SharedPreferencesUtils.init(getApplicationContext(), "myapp"); okGoBase(); - getUhfLongerManager(); - XUpdate.get() - .debug(true) - .isWifiOnly(false) //默认设置只在wifi下检查版本更新 - .isGet(true) //默认设置使用get请求检查版本 - .isAutoMode(false) //默认设置非自动模式,可根据具体使用配置 + // getUhfLongerManager(); + XUpdate.get().debug(true).isWifiOnly(false) // 默认设置只在wifi下检查版本更新 + .isGet(true) // 默认设置使用get请求检查版本 + .isAutoMode(false) // 默认设置非自动模式,可根据具体使用配置 // .param("versionCode", UpdateUtils.getVersionCode(this)) //设置默认公共请求参数 // .param("appKey", getPackageName()) - .supportSilentInstall(false) //设置是否支持静默安装,默认是true - .setIUpdateHttpService(new OkHttpUpdateHttpServiceImpl()) //这个必须设置!实现网络请求功能。 + .supportSilentInstall(false) // 设置是否支持静默安装,默认是true + .setIUpdateHttpService(new OkHttpUpdateHttpServiceImpl()) // 这个必须设置!实现网络请求功能。 .init(this); } - public static UHFRManager getUhfLongerManager() { - if (uhfLongerManager==null){ - try { - uhfLongerManager = UHFRManager.getInstance(); - uhfLongerManager.setPower(33,33); - } catch (Exception e) { - e.printStackTrace(); - } - } - - return uhfLongerManager; - } + // public static UHFRManager getUhfLongerManager() { + // if (uhfLongerManager==null){ + // try { + // uhfLongerManager = UHFRManager.getInstance(); + // uhfLongerManager.setPower(33,33); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // } + // + // return uhfLongerManager; + // } // OKGO 初始化 private void okGoBase() { OkHttpClient.Builder builder = new OkHttpClient.Builder(); @@ -85,11 +84,11 @@ public class MyApplication extends Application { HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory(); builder.sslSocketFactory(sslParams1.sSLSocketFactory, sslParams1.trustManager); builder.addInterceptor(loggingInterceptor); -// 全局的读取超时时间 + // 全局的读取超时时间 builder.readTimeout(3000, TimeUnit.MILLISECONDS); -// 全局的写入超时时间 + // 全局的写入超时时间 builder.writeTimeout(3000, TimeUnit.MILLISECONDS); -// 全局的连接超时时间 + // 全局的连接超时时间 builder.connectTimeout(3000, TimeUnit.MILLISECONDS); // 使用内存保持cookie,app退出后,cookie消失 builder.cookieJar(new CookieJarImpl(new MemoryCookieStore())); @@ -101,4 +100,6 @@ public class MyApplication extends Application { } + + } diff --git a/app/src/main/java/com/example/beijing_daxing/rfid/RFID.java b/app/src/main/java/com/example/beijing_daxing/rfid/RFID.java new file mode 100644 index 0000000..b52ce67 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/rfid/RFID.java @@ -0,0 +1,7 @@ +package com.example.beijing_daxing.rfid; + +public interface RFID { + void initRFIDModel(); + void setPower(int power); + void close(); +} diff --git a/app/src/main/java/com/example/beijing_daxing/rfid/impl/Device6109.java b/app/src/main/java/com/example/beijing_daxing/rfid/impl/Device6109.java new file mode 100644 index 0000000..417ff4c --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/rfid/impl/Device6109.java @@ -0,0 +1,40 @@ +package com.example.beijing_daxing.rfid.impl; + +import android.content.IntentFilter; +import android.media.MediaPlayer; +import android.util.Log; + +import com.example.beijing_daxing.R; +import com.example.beijing_daxing.base.BaseActivity; +import com.example.beijing_daxing.base.MyApplication; +import com.example.beijing_daxing.rfid.RFID; +import com.handheld.uhfr.UHFRManager; +import com.uhf.api.cls.Reader; + +public class Device6109 implements RFID { + + private UHFRManager uhfrManager; + @Override + public void initRFIDModel() { + if (uhfrManager==null){ + uhfrManager=UHFRManager.getInstance(); + } + uhfrManager.asyncStartReading(); + } + + @Override + public void setPower(int power) { + Reader.READER_ERR readerErr = uhfrManager.setPower(power, power); + Log.e("TAG", "setPower:" + readerErr); + } + + @Override + public void close() { + if (uhfrManager==null){ + return; + } + uhfrManager.asyncStopReading(); + uhfrManager.close(); + uhfrManager=null; + } +} diff --git a/app/src/main/java/com/example/beijing_daxing/vm/PowerData.java b/app/src/main/java/com/example/beijing_daxing/vm/PowerData.java new file mode 100644 index 0000000..b9fa6a3 --- /dev/null +++ b/app/src/main/java/com/example/beijing_daxing/vm/PowerData.java @@ -0,0 +1,76 @@ +package com.example.beijing_daxing.vm; + +import androidx.databinding.BaseObservable; + +public class PowerData extends BaseObservable { + private int powerIn; + private int powerOut; + private int powerStockCheck; + private int powerCheck; + private int powerScrap; + private int powerScrapIn; + private int powerScrapOut; + + public int getPowerIn() { + return powerIn; + } + + public void setPowerIn(int powerIn) { + this.powerIn = powerIn; + notifyChange(); + } + + public int getPowerOut() { + return powerOut; + } + + public void setPowerOut(int powerOut) { + this.powerOut = powerOut; + notifyChange(); + } + + public int getPowerStockCheck() { + return powerStockCheck; + } + + public void setPowerStockCheck(int powerStockCheck) { + this.powerStockCheck = powerStockCheck; + notifyChange(); + } + + public int getPowerCheck() { + return powerCheck; + } + + public void setPowerCheck(int powerCheck) { + this.powerCheck = powerCheck; + notifyChange(); + } + + public int getPowerScrap() { + return powerScrap; + } + + public void setPowerScrap(int powerScrap) { + this.powerScrap = powerScrap; + notifyChange(); + } + + public int getPowerScrapIn() { + return powerScrapIn; + } + + public void setPowerScrapIn(int powerScrapIn) { + this.powerScrapIn = powerScrapIn; + notifyChange(); + } + + public int getPowerScrapOut() { + return powerScrapOut; + } + + public void setPowerScrapOut(int powerScrapOut) { + this.powerScrapOut = powerScrapOut; + notifyChange(); + } +} diff --git a/app/src/main/jniLibs/arm64-v8a/libModuleAPIJni.so b/app/src/main/jniLibs/arm64-v8a/libModuleAPIJni.so new file mode 100644 index 0000000..9d41f26 Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libModuleAPIJni.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libSerialPort.so b/app/src/main/jniLibs/arm64-v8a/libSerialPort.so new file mode 100644 index 0000000..18949be Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libSerialPort.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libdevapi.so b/app/src/main/jniLibs/arm64-v8a/libdevapi.so new file mode 100644 index 0000000..4e65b7e Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libdevapi.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libirdaSerialPort.so b/app/src/main/jniLibs/arm64-v8a/libirdaSerialPort.so new file mode 100644 index 0000000..8c43d80 Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libirdaSerialPort.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libjni_rfid_driver.so b/app/src/main/jniLibs/arm64-v8a/libjni_rfid_driver.so new file mode 100644 index 0000000..6d66476 Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libjni_rfid_driver.so differ diff --git a/app/src/main/jniLibs/arm64-v8a/libserial_port.so b/app/src/main/jniLibs/arm64-v8a/libserial_port.so new file mode 100644 index 0000000..bbd2cce Binary files /dev/null and b/app/src/main/jniLibs/arm64-v8a/libserial_port.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libirdaSerialPort.so b/app/src/main/jniLibs/armeabi-v7a/libirdaSerialPort.so new file mode 100644 index 0000000..b8a8974 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libirdaSerialPort.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libjni_rfid_driver.so b/app/src/main/jniLibs/armeabi-v7a/libjni_rfid_driver.so new file mode 100644 index 0000000..4438c32 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libjni_rfid_driver.so differ diff --git a/app/src/main/jniLibs/armeabi-v7a/libserial_port.so b/app/src/main/jniLibs/armeabi-v7a/libserial_port.so new file mode 100644 index 0000000..f240561 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/libserial_port.so differ diff --git a/app/src/main/jniLibs/armeabi/libirdaSerialPort.so b/app/src/main/jniLibs/armeabi/libirdaSerialPort.so new file mode 100644 index 0000000..b8a8974 Binary files /dev/null and b/app/src/main/jniLibs/armeabi/libirdaSerialPort.so differ diff --git a/app/src/main/jniLibs/armeabi/libjni_rfid_driver.so b/app/src/main/jniLibs/armeabi/libjni_rfid_driver.so new file mode 100644 index 0000000..4438c32 Binary files /dev/null and b/app/src/main/jniLibs/armeabi/libjni_rfid_driver.so differ diff --git a/app/src/main/jniLibs/armeabi/libserial_port.so b/app/src/main/jniLibs/armeabi/libserial_port.so new file mode 100644 index 0000000..f240561 Binary files /dev/null and b/app/src/main/jniLibs/armeabi/libserial_port.so differ diff --git a/app/src/main/res/layout/activity_seting_power.xml b/app/src/main/res/layout/activity_seting_power.xml index 9baeef6..ac364ac 100644 --- a/app/src/main/res/layout/activity_seting_power.xml +++ b/app/src/main/res/layout/activity_seting_power.xml @@ -1,171 +1,179 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xhdpi/home_setting.png b/app/src/main/res/mipmap-xhdpi/home_setting.png new file mode 100644 index 0000000..d8bbb95 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/home_setting.png differ