Chainway C72 UHF在Android 11版本上的样例代码

huangapple go评论80阅读模式
英文:

Working Chainway C72 UHF sample code for Android 11 version

问题

从我所了解的情况来看,Chainway在从Android 7升级到Android 11时更改了其硬件库的API,导致几乎所有当前不同框架的软件包不再起作用。除了这个有问题的Android Studio示例项目之外,是否有其他在运行Android 11的Chainway C72上运行的工作示例代码?首选是Xamarin/Maui或Flutter,但实际上任何稳定的代码都将非常感激。

我们尝试过的内容:
我们注意到大多数库使用了一个名为RFIDWithUHF的已弃用API类。我们联系了Chainway技术支持,他们为我们提供了固件更新文件,并提到应该使用RFIDWithUHFUart类。他们提供了一个Android Studio示例项目,如果重新启动设备并运行项目,就能够扫描RFID标签,但它非常不稳定并且很快崩溃。不幸的是,即使代码在启动时进行了释放和初始化,关闭应用程序并重新启动它也不能恢复它的状态。必须重新启动设备才能将其恢复正常。

我们尝试使用以下包/库,结果如下:

  • 在Xamarin上使用这三个Nuget包1 2 3 - Initialize方法始终返回false,无法扫描标签
  • 使用这个Flutter包package - 在控制台上得到以下打印输出:
C72上提供了一个观察室调试器和分析器:http://127.0.0.1:61316/iEK5kGMghqQ=/
C72上提供了Flutter DevTools调试器和分析器:http://127.0.0.1:9101?uri=http://127.0.0.1:61316/iEK5kGMghqQ=/
I/DeviceAPI_DeviceCon(30538): 从configPath=/storage/emulated/0/PDAConfig.txt获取DeviceInfo
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设备=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结果:-1
E/DeviceAPI_UHF(30538): startInventory() err :-1
  • 这个React package - 得到以下构建错误:
错误:无法安装应用程序。确保您已设置好Android开发环境:https://reactnative.dev/docs/environment-setup。   
错误:命令失败:gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

失败:构建完成,有2个失败。

1:任务发生异常。
-----------
* 在哪里:
构建文件‘C:\Repos\Sandbox\ReactNative\c72ScannerReact\node_modules\c72-rfid-scanner\android\build.gradle’的第23行

* 出了什么问题:
评估项目‘:c72-rfid-scanner’时发生了问题。
> 未找到id为‘maven’的插件。

* 尝试:
> 使用--stacktrace选项运行以获取堆栈跟踪。
> 使用--info或--debug选项运行以获取更多日志输出。
> 使用--scan运行以获取完整的见解。
==============================================================================

2:任务发生异常。
-----------
* 出了什么问题:
配置项目‘:c72-rfid-scanner’时发生了问题。
> 未指定compileSdkVersion。请将其添加到build.gradle中
  • 我们还尝试了这里的所有示例代码,但也没有运气。
英文:

From what I can gather Chainway changed the API to their hardware library with the move from Android 7 to Android 11 causing almost all the current packages for different frameworks out there to no longer work. Does anyone have working sample code for the Chainway C72 running on Android 11 other than this buggy Android Studio sample project? Biggest preference would be Xamarin/Maui or Flutter, but honestly any stable code would be greatly appreciated.

What we've tried:
We have noticed that most of the libraries use a deprecated API class called RFIDWithUHF.
We contacted Chainway technical support and they provided us with firmware update files and mentioned that we should use RFIDWithUHFUart class instead. They provided an Android Studio sample project, if you restart the device and run the project you are able to scan RFID tags, but it is extremely buggy and quickly crashes. Closing the app and restarting it unfortunately does not recover it from this state even though the code does a free and initialise on startup. You have to reboot the device to get it out of this state.

We attempted to use the following packages/libraries with the following results:

  • Using these three Nuget packages on Xamarin 1 2 3 - Initialize method always return false and we're unable to scan tags
  • Using this flutter package - We got the following printouts on our console:
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
  • This react package - Get the following build error:
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 
  • We've also tried all the example code here with no luck either.

答案1

得分: 0

我也在查看相同的设备(Xamarin)。我无法使在线示例工作,但在联系技术支持后,我收到了可工作的示例代码。

英文:

I am also looking at the same device (Xamarin). I was not able to get the samples online working, but after contacting tech support I received working sample code.

答案2

得分: 0

我最终使用了支持 Android 11 版本的 C72 的 rfid_c72_plugin Flutter 包。尽管每当我按下硬件按钮时,固件似乎会崩溃,我不得不重新启动设备。不确定是我们的设备还是固件版本可能有问题。

英文:

I ended up using the rfid_c72_plugin Flutter package that seems to support the Android 11 version of the C72 well. Although whenever I press the hardware buttons it seems like the firmware crashes and I have to reboot the device. Not sure if our device or firmware version might be faulty.

huangapple
  • 本文由 发表于 2023年2月16日 19:41:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75471747.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定