Android Open Source - UsbSerial Usb Serial Debugger






From Project

Back to project page UsbSerial.

License

The source code is released under:

MIT License

If you think the Android project UsbSerial listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.felhr.usbserial;
/*from   w w w .  j a  v  a 2 s.c  om*/
import com.felhr.utils.HexData;

import android.util.Log;

public class UsbSerialDebugger 
{
  private static final String CLASS_ID = UsbSerialDebugger.class.getSimpleName();
  public static final String ENCODING = "UTF-8";
  
  private UsbSerialDebugger()
  {
    
  }
  
  public static void printLogGet(byte[] src, boolean verbose)
  {
    if(!verbose)
    {
      Log.i(CLASS_ID, "Data obtained from write buffer: " + new String(src));
    }else
    {
      Log.i(CLASS_ID, "Data obtained from write buffer: " + new String(src));
      Log.i(CLASS_ID, "Raw data from write buffer: " + HexData.hexToString(src));
      Log.i(CLASS_ID, "Number of bytes obtained from write buffer: " + src.length);
    }
  }
  
  public static void printLogPut(byte[] src, boolean verbose)
  {
    if(!verbose)
    {
      Log.i(CLASS_ID, "Data obtained pushed to write buffer: " + new String(src));
    }else
    {
      Log.i(CLASS_ID, "Data obtained pushed to write buffer: " + new String(src));
      Log.i(CLASS_ID, "Raw data pushed to write buffer: " + HexData.hexToString(src));
      Log.i(CLASS_ID, "Number of bytes pushed from write buffer: " + src.length);
    }
  }
  
  public static void printReadLogGet(byte[] src, boolean verbose)
  {
    if(!verbose)
    {
      Log.i(CLASS_ID, "Data obtained from Read buffer: " + new String(src));
    }else
    {
      Log.i(CLASS_ID, "Data obtained from Read buffer: " + new String(src));
      Log.i(CLASS_ID, "Raw data from Read buffer: " + HexData.hexToString(src));
      Log.i(CLASS_ID, "Number of bytes obtained from Read buffer: " + src.length);
    }
  }
  
  public static void printReadLogPut(byte[] src, boolean verbose)
  {
    if(!verbose)
    {
      Log.i(CLASS_ID, "Data obtained pushed to read buffer: " + new String(src));
    }else
    {
      Log.i(CLASS_ID, "Data obtained pushed to read buffer: " + new String(src));
      Log.i(CLASS_ID, "Raw data pushed to read buffer: " + HexData.hexToString(src));
      Log.i(CLASS_ID, "Number of bytes pushed from read buffer: " + src.length);
    }
  }
  
  

}




Java Source Code List

com.felhr.deviceids.CP210xIds.java
com.felhr.deviceids.FTDISioIds.java
com.felhr.deviceids.PL2303Ids.java
com.felhr.usbserial.BLED112SerialDevice.java
com.felhr.usbserial.CDCSerialDevice.java
com.felhr.usbserial.CP2102SerialDevice.java
com.felhr.usbserial.FTDISerialDevice.java
com.felhr.usbserial.PL2303SerialDevice.java
com.felhr.usbserial.SerialBuffer.java
com.felhr.usbserial.UsbSerialDebugger.java
com.felhr.usbserial.UsbSerialDevice.java
com.felhr.usbserial.UsbSerialInterface.java
com.felhr.utils.HexData.java