Skip to content

Jean-Emile/Serial-to-USB-ANDROID

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Copyright (C) 2012 JeD <[email protected]>
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);
}


About

Serial to USB driver using the Android USB-Host API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages