This is a Prolific PL2303 and cannot be used with this library (yet).I have this in device info
USB\VID_067B&PID_2303&REV_0300
USB\VID_067B&PID_2303
Hi,
You have to recompile usb-serial-for-android using the latest available source code from the repository. No need to modify anything in the wrapper built by Erel. Just replace the jar file in the library folder.
If you want to use one compiled by me, you can find it attached (unzip and copy to Library folder over the previous one).
Do not forget to Refresh the libraries in B4A.
Hope this help.
Dan
P.S. tested with a CP2102 module and a loopback (rx link to tx)
This is a Prolific PL2303 and cannot be used with this library (yet).
Try the one specifically designed for PL2303.
Look at Erels' example program in the first post. AsyncStreams should call your New_data event when data is received.
B4X:Sub Astreams_NewData (Buffer() As Byte) Log("NewData") Log(BytesToString(Buffer, 0, Buffer.Length, "UTF8")) End Sub
Code:
AddActivityText(main, <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />)
<?xml version="1.0" encoding="utf-8" ?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="b4a.example1" android:versionCode="1" android:versionName="" android:installLocation="internalOnly">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
<supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true" />
- <application android:icon="@drawable/icon" android:label="B4A Example">
- <activity android:windowSoftInputMode="stateHidden" android:launchMode="singleTop" android:name=".main" android:label="B4A Example" android:screenOrientation="unspecified">
- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
- <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
</activity>
</application>
AddActivityText(main,
- <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
)
</manifest>
@arge06 - What do you mean by "hex values"? As the data is sent and received as bytes you can send whatever you want.
@csjoe72 - We need to see the complete contents of that error dialog.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?