安卓:与Android设备的RS232串行通讯

问题描述:

我有一个 MR400s计价器的硬件。我想用RS232电缆与此计价器进行沟通,我已经实现了这一点,并在Windows通信。但我想使用Android设备进行连接。

I have a MR400s taximeter hardware. I want to communicate with this taximeter using RS232 cable and I have already achieved this connection and communication in windows. But I wanted to make connection using android device.

我怎样才能做到这一点?

How can I achieve this?

谢谢 依禅耆那教

我用的是USB转串口库,你可以在这里找到:的 USB串口为Android。 它不需要任何root访问权限。你需要检查,如果你的Andr​​oid设备支持USB主机模式。然后,使用USB OTG线和USB转串口适配器电缆就可以开始通过RS-232串行设备进行通信。有code例子让你开始了USB串行库的Github的页面上。

I use the USB to serial library, you can find it here: USB Serial for Android. It doesn't require any root access. You'll need to check if your Android device supports USB host mode. Then, using a usb OTG cable and a USB to serial adapter cable you can start communicating with your serial device via RS232. There are code examples to get you started on the Github page of the USB to Serial library.