feat(device): 添加USB设备通信支持和程序参数优化
- 在AndroidManifest.xml中添加USB Host权限和设备过滤器配置 - 新增设备控制国际化词条包括速度档位、吹气时间等 - 重构数据库结构将速度相关字段统一为档位数值存储 - 添加通用KV存储方法用于settings表数据读写 - 优化首页导航实现tab间跳转和状态保持功能 - 更新程序详情页面布局和参数表单界面 - 移除模拟运行器相关测试代码 - 添加USB串口通信依赖包usb_serial
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
<!-- USB Host:与下位机(USB 转串口)通信 -->
|
||||
<uses-feature android:name="android.hardware.usb.host" android:required="true" />
|
||||
|
||||
<application
|
||||
android:label="kuaishai2"
|
||||
android:name="${applicationName}"
|
||||
@@ -28,6 +31,15 @@
|
||||
<category android:name="android.intent.category.HOME"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
<!-- USB 设备过滤:当下位机(USB 转串口)插入时,系统会启动本 Activity 并附带设备信息。
|
||||
配合 @xml/usb_device_filter 中声明的 vendor-id 列表使用。
|
||||
若下位机使用其它芯片,可在此追加 vendor-id。 -->
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
||||
android:resource="@xml/usb_device_filter" />
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
|
||||
12
android/app/src/main/res/xml/usb_device_filter.xml
Normal file
12
android/app/src/main/res/xml/usb_device_filter.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
USB 设备过滤:下位机使用常见 USB 转串口芯片时自动识别
|
||||
包含:CH340 / CH341 / CH343 / CH9103、FTDI、CP210x、PL2303
|
||||
若下位机使用其他芯片,可继续追加 vendor-id + product-id
|
||||
-->
|
||||
<resources>
|
||||
<usb-device vendor-id="0x1A86" /> <!-- CH340 / CH341 / CH343 / CH9103 系列 -->
|
||||
<usb-device vendor-id="0x0403" /> <!-- FTDI 系列 -->
|
||||
<usb-device vendor-id="0x10C4" /> <!-- Silicon Labs CP210x 系列 -->
|
||||
<usb-device vendor-id="0x067B" /> <!-- Prolific PL2303 系列 -->
|
||||
</resources>
|
||||
Reference in New Issue
Block a user