USB Serial Module for Android that is a wrapper of usb-serial-for-android http://code.google.com/p/usb-serial-for-android
USB Serial Module is the wrapper module of usb-serial-for-android.
USB Serial Module is for communication with Arduinos and other USB serial hardware on Android.
If you use Titanium with USB Serial module, you can write Android app for USB serial communication using JavaScript, and can communicate with USB device very easily.
Current compatibility list is here :
Note: You need the OTG (USB On-the-Go) cable that connects between Android and other USB hardware.
Android min-sdk: Android 2.3.3 (API Level 10) Titanium 2.1.0.GA
To access this module from JavaScript, you would do the following:
var usbserial = require("jp.isisredirect.usbserial");
The usbserial variable is a reference to the Module object.
5 data bits.
6 data bits.
7 data bits.
8 data bits.
No flow control.
RTS/CTS input flow control.
RTS/CTS output flow control.
XON/XOFF input flow control.
XON/XOFF output flow control.
No parity.
Odd parity.
Even parity.
Mark parity.
Space parity.
1 stop bit.
1.5 stop bits.
2 stop bits.
- baudRate
(optional)
- dataBits
(optional)
- stopBits
(optional)
- parity
(optional)
- Boolean
true if succeeded.
- void
- void
- void
- String device name
-
baudRate
-
dataBits
-
stopBits
-
parity
- Boolean
- buffer : Titanium.Buffer
- void
- Boolean
- data : Titanium.Buffer
For details of setting configurations of your Titanium project that is necessary to use USB serial, see Step by step.
Here only to show sample code for a simple explanation about the usage of USB Serial module.
Sample code is below:
var USBSERIAL = require('jp.isisredirect.usbserial');
Ti.API.info("module is => " + USBSERIAL);
USBSERIAL.addEventListener(USBSERIAL.RECEIVED, function(e) {
conTextField.value += '\n' + e.data.length + ":" + e.data +";";
});
USBSERIAL.open();
var buffer = Ti.createBuffer({
value:sendText.value
});
USBSERIAL.sendData(buffer);
Kastumi ISHIDA (isis re-direct) in k.i.office.
Copyright 2013 Katsumi ISHIDA. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
usb-serial-for-android is written and maintained by mike wakerly.
This library is licensed under LGPL Version 2.1. Please see LICENSE.txt for the complete license.
Copyright 2011-2012, Google Inc. All Rights Reserved.
Portions of this library are based on libftdi (http://www.intra2net.com/en/developer/libftdi). Please see FtdiSerialDriver.java for more information.