Serial to USB driver using the Android USB-Host API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
src
target
README
pom.xml

README

Serial-To-USB-ANDROID is an implementation of Serial to USB driver using the Android USB Host API. 

Copyright (C) 2012 JeD <jedartois@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

REQUIREMENTS
--------------------------------------------------------------------------------------------
- ANDROID USB Host API (Android 3.1 or upper)
- no need to root the device 
--------------------------------------------------------------------------------------------


END USE EXAMPLE
----------------------------------------------------------------------------------------

ISerial usb_serial=null;


usb_serial = new UsbSerial(UsbDeviceID.FT232RL,19200,mycontext);
usb_serial.open();


usb_serial.addEventListener(new SerialListener() {
	@Override
	public void incomingDataEvent(final SerialEvent evt) {
	{
    		 System.out.println("Event from Usb Serial"+new String(evt.read));

	}
});


usb_serial.write("Hello World");
usb_serial.close();


------------------------------------------------------------------------------------------------
Serial-To-USB-Android Interface
------------------------------------------------------------------------------------------------
public interface ISerial {
    public void open() throws SerialError;
    public void open(String usbDeviceID,int baudrate) throws SerialError;
    public void open(String _usbDeviceID) throws SerialError;
    public abstract void open(UsbDeviceID usbDeviceID) throws SerialError;
    public abstract void close();
    public abstract void setBaudrate(int bitrate) throws SerialError;
    public abstract boolean isConnected();
    public abstract void write(byte[] data) throws SerialError;
    public abstract void write(String data) throws SerialError;
    public abstract byte[] read() throws SerialError;
    public abstract void addEventListener (SerialListener listener);
    public abstract void removeEventListener (SerialListener listener);
}