Compare commits

...

Author SHA1 Message Date
  pry c3dadf9e34 串口通讯 7 months ago
  pry 486ba4cd7e 串口通讯 7 months ago
  fyf 566bc57ce2 温度控制333 1 year ago
  fyf 24effdec99 888333 1 year ago
9 changed files with 86 additions and 18 deletions
Split View
  1. +8
    -1
      app/build.gradle
  2. BIN
     
  3. BIN
     
  4. BIN
     
  5. +2
    -0
      app/src/main/AndroidManifest.xml
  6. +52
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/TEST.java
  7. +8
    -4
      app/src/main/res/layout/item/layout/dialog_add_good.xml
  8. +7
    -4
      app/src/main/res/layout/item/layout/dialog_add_pf.xml
  9. +9
    -9
      app/src/main/res/layout/item/layout/item_right_lc.xml

+ 8
- 1
app/build.gradle View File

@@ -54,7 +54,9 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation files('libs\\PC_RFID.jar')
implementation files('libs\\sdkapi.jar')
compileOnly files('libs/sdkapi.jar')
//测试相关
testImplementation 'junit:junit:4.13-beta-2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
@@ -157,4 +159,9 @@ dependencies {
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'

implementation 'com.contrarywind:Android-PickerView:3.2.6'

implementation 'com.hoho.android:usb-serial-driver:1.3.0' // 串口驱动库
implementation 'com.hoho.android:usb-serial-util:1.3.0' // 串口工具库


}

BIN
View File


BIN
View File


BIN
View File


+ 2
- 0
app/src/main/AndroidManifest.xml View File

@@ -18,6 +18,8 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.permission.USB_PERMISSION" />

<application
android:name=".MainApplication"


+ 52
- 0
app/src/main/java/com/bonait/bnframework/common/helper/TEST.java View File

@@ -0,0 +1,52 @@
package com.bonait.bnframework.common.helper;

import android.hardware.usb.UsbManager;

public class TEST {
// private void tt(){
// UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
// UsbSerialProber prober = UsbSerialProber.getDefaultProber();
// List<UsbSerialDriver> availableDrivers = prober.findAllDrivers(usbManager);
//
// for (UsbSerialDriver driver : availableDrivers) {
// UsbDeviceConnection connection = usbManager.openDevice(driver.getDevice());
// if (connection == null) {
// // 设备未授权或无法打开
// continue;
// }
// try {
// UsbSerialPort port = driver.getPorts().get(0); // 选择第一个端口
// int baudRate = 9600; // 设置波特率
// port.open(connection);
// port.setParameters(baudRate, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE);
//
// // 从此处开始,你可以读取和写入端口
// byte[] buffer = new byte[16];
// int timeout = 0; // 毫秒
// int bytesRead = port.read(buffer, timeout);
//
// // 处理读取的数据
// // ...
//
// // 写入数据到串口
// String dataToWrite = "Hello Serial!";
// port.write(dataToWrite.getBytes(), timeout);
//
// } catch (IOException e) {
// // 处理异常
// } finally {
// // 确保在结束时关闭端口和连接
// if (port != null) {
// try {
// port.close();
// } catch (IOException e) {
// // 处理异常
// }
// }
// if (connection != null) {
// connection.close();
// }
// }
// }
// }
}

+ 8
- 4
app/src/main/res/layout/item/layout/dialog_add_good.xml View File

@@ -165,10 +165,14 @@
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_wl"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_wl"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>


+ 7
- 4
app/src/main/res/layout/item/layout/dialog_add_pf.xml View File

@@ -223,13 +223,16 @@


<!-- 物料 -->
<androidx.recyclerview.widget.RecyclerView
<ScrollView
android:layout_marginTop="30dp"
android:id="@+id/recycler_view_wl_click"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.5"/>

android:layout_weight="0.5">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_wl_click"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>
</LinearLayout>
</RelativeLayout>
<LinearLayout


+ 9
- 9
app/src/main/res/layout/item/layout/item_right_lc.xml View File

@@ -3,14 +3,14 @@
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_height="wrap_content">
<!-- <ScrollView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<!-- -->
<!-- </ScrollView>-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</ScrollView>

android:layout_height="wrap_content"/>
</LinearLayout>

Loading…
Cancel
Save