Back to project page HRCF--Hermes-RC-Framework-.
The source code is released under:
GNU Lesser General Public License
If you think the Android project HRCF--Hermes-RC-Framework- listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.rclibtest1; /* w w w.jav a2 s .c o m*/ import java.io.IOException; import com.hoho.android.usbserial.driver.UsbSerialDriver; import android.util.Log; public class USB_Serial{ public void begin(UsbSerialDriver driver, int baudrate){ if (driver != null) { //USB Driver Check & Serial Initialize. try{ driver.open(); driver.setBaudRate(baudrate); } catch(IOException e){ Log.e("SerialErr", "baudrate Setting Exception.");} } } public void print(UsbSerialDriver driver, byte buf[]) { try { driver.write(buf,buf.length); } catch(IOException e){ Log.e("SerialErr","Data Sending Exception.");} } public void close(UsbSerialDriver driver) { try{ driver.close();} catch(IOException e){Log.e("SerialErr","Serial Driver Closing Exception.");} } }