据我所知,Chainway 将 API 更改为他们的硬件库,从 Android 7 迁移到 Android 11,导致几乎所有不同框架的当前包都不再工作。除了这个有问题的 Android Studio sample project 之外,是否有人拥有在 Android 11 上运行的 Chainway C72 的工作示例代码?最大的偏好是 Xamarin/Maui 或 Flutter,但老实说,我们将不胜感激任何稳定的代码。
我们尝试了什么:: 我们注意到大多数库都使用一个已弃用的 API 类,称为 UHFWithRFID。 我们联系了 Chainway 技术支持,他们为我们提供了固件更新文件,并提到我们应该改用 RFIDWithUHFUart 类。他们提供了一个 Android Studio sample project,如果您重新启动设备并运行该项目,您就可以扫描 RFID 标签,但它有很多错误并且很快就会崩溃。不幸的是,关闭应用程序并重新启动它不会从该状态恢复它,即使代码在启动时执行了免费和初始化。您必须重新启动设备才能使其脱离此状态。
我们尝试使用以下包/库,结果如下:
An Observatory debugger and profiler on C72 is available at: http://127.0.0.1:61316/iEK5kGMghqQ=/
The Flutter DevTools debugger and profiler on C72 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:61316/iEK5kGMghqQ=/
I/DeviceAPI_DeviceCon(30538): getDeviceInfoFromFile configPath=/storage/emulated/0/PDAConfig.txt
D/DeviceAPI_DeviceCon(30538): cw.model2:
D/DeviceAPI_DeviceCon(30538): cw.model:mtk.6765.c72
D/DeviceAPI_DeviceCon(30538): 最终cw.model:mtk.6765.c72
I/DeviceAPI_DeviceCon(30538): model=C72,uartPath=/dev/ttyMT3,uartPath_Fingerprint=/dev/ttyMT0,uartPath_RFID=
I/DeviceAPI_DeviceCon(30538): getModel() model=C72
D/DeviceAPI(30538): UHF device = C72
D/DeviceAPI(30538): UHF_Init----------->DevIsOpen = 1
D/DeviceAPI(30538): UHF uart = /dev/ttyMT3
D/DeviceAPI_SerialPort(30538): [SerialPort_Open] [2]: No such file or directory
D/DeviceAPI(30538): UHF uhf_uart_fd = -1
I/DeviceAPI_UHF(30538): init() Uart = /dev/ttyMT3
E/DeviceAPI_UHF(30538): init() err UHFOpenAndConnect result:-1
E/DeviceAPI_UHF(30538): startInventory() err :-1
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Repos\Sandbox\ReactNative\c72ScannerReact\node_modules\c72-rfid-scanner\android\build.gradle' line: 23
* What went wrong:
A problem occurred evaluating project ':c72-rfid-scanner'.
> Plugin with id 'maven' not found.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':c72-rfid-scanner'.
> compileSdkVersion is not specified. Please add it to build.gradle
我也在看同一个设备(Xamarin)。我无法让示例在线工作,但在联系技术支持后我收到了工作示例代码。