B4J Library jSerial library

Status
Not open for further replies.
The jSerial library allows you to open and communicate with other devices through the computer COM ports.

It can also be used to communicate with Bluetooth devices over a virtual com port.
(jBluetooth library is now available: https://www.b4x.com/android/forum/threads/jbluetooth-library.60184/)

SS-2013-11-21_15.46.10.png


The attached examples implement an Android <-> PC chat app.

In order to run the example you need to first pair the PC and the device and make sure that the Bluetooth is mapped to a virtual com port.

jSerial works with AsyncStreams. Both standard mode and prefix mode are supported. Note that prefix mode can only work if both sides of the connection follow the protocol.
Change AStream.InitializePrefix to AStream.Initialize to disable prefix mode.

jSerial depends on an open source project named JSSC: https://github.com/java-native/jssc

Updates:
v1.31 - Adds missing BAUDRATE, DATABITS, STOPBITS and PARITY constants.
v1.30 - Adds support for Java 11 and 64 bit computers based on: https://github.com/java-native/jssc

Instructions related to jSerial and B4J Packager 11: https://www.b4x.com/android/forum/threads/jserial-library.34762/post-735742
 

Attachments

  • B4J_Chat.zip
    1.7 KB · Views: 3,860
  • B4A_Chat.zip
    9.2 KB · Views: 2,271
  • jSerial.zip
    414.2 KB · Views: 1,230
Last edited:

Erel

Administrator
Staff member
Licensed User
jSerial and B4J Packager 11

jSerial depends on a native library named jssc.dll. It is included inside jssc.jar, under the natives folder. Remember that a jar file is actually a zip file.

This dll should be copied to build\bin folder, after you ran B4JPackager.
For your convenience the dll for Windows 64 bit is attached. Note that Windows 32 bit is not supported by Java 11+.
 

Attachments

  • jssc.zip
    48.3 KB · Views: 275
Last edited:
Status
Not open for further replies.
Top