Other How get (read) CTS and DSR state using felUsbSerial library?

pistikebacsi

New Member
- For set (write) of RTS and DTR line of FTDI, CP2102 or CH340 type USB to Serial dongle I found on the Forum and tested two working program sequence:
After declaring in

Sub Process_Globals
Private usbserial As felUsbSerial ' library ver.2.4 I can use

1 Solution: use sequence

Dim r As Reflector
r.Target = usbserial
r.RunMethod2("setRTS", True, "java.lang.boolean") ' or
r.RunMethod2("setDTR", False, "java.lang.boolean") ' work OK

( In forum example found also the line r.Target = r.getField("driver") ' but this produce errors, maybe not need )

or

2 Solution: use

Dim jo as JavaObject = usbserial
jo.RunMethod("setRTS", Array(False)) ' state flag or
jo.RunMethode("setDTR", Array(True)) ' Work OK.

- For get (read) CTS and DSR maybe exist a simple similar solution, please help me if You can.
In this situation in library used a "Callback" named variable, not boolean but I suppose, the returned value of this reflects the state of the tested line (CTS or DTR).

- I see, the standard UsbSerial library is based on https://code.google.com/p/usb-serial-for-android/ (https://github.com/mik3y/usb-serial-for-android) java project, but
the control line manipulation routine is not given and implemented in B4X version libraries.

Thank You in advance for any help.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…