jacklinquan / usbserial4a

Python package for Android USB host serial port.
MIT License
60 stars 17 forks source link

Usb serial 4A for chaquopy ? #12

Closed arwysyah closed 2 years ago

arwysyah commented 2 years ago

Hi @jacklinquan , i have a question, is it possible to implement this module usbserial4 with chaquopy ? Without UI from Kivy ? Thank you πŸ™πŸ»

jacklinquan commented 2 years ago

Hi @arwysyah ,

I never played with chaquopy yet. usbserial4a depends on usb4a which in turn depends on pyjnius from kivy.

With the help of pyjnius, usb4a introduces several java class into python environment:

from jnius import autoclass

PythonActivity = autoclass('org.kivy.android.PythonActivity')
PythonService = autoclass('org.kivy.android.PythonService')
Context = autoclass('android.content.Context')
Intent = autoclass('android.content.Intent')
PendingIntent = autoclass('android.app.PendingIntent')

UsbConstants = autoclass('android.hardware.usb.UsbConstants')
UsbRequest = autoclass('android.hardware.usb.UsbRequest')

ByteBuffer = autoclass('java.nio.ByteBuffer')

If chaquopy can offer the equivalent classes as above, it would be possible.

arwys commented 2 years ago

interesting, i am not python guy, but i think it won’t wrong to try it 😁 ,thank you so much@jacklinquan