资源简介
安卓 Android OTG USB 串口通信,支持Cp2102、FT232R, CDC/ACM,
代码片段和文件信息
/* Copyright 2011 Google Inc.
*
* 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.
*
* Project home page: http://code.google.com/p/usb-serial-for-android/
*/
package com.hoho.android.usbserial.examples;
import android.app.Activity;
import android.content.Context;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TwoLineListItem;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.hoho.android.usbserial.util.HexDump;
import java.util.ArrayList;
import java.util.List;
/**
* Shows a {@link ListView} of available USB devices.
*
* @author mike wakerly (opensource@hoho.com)
*/
public class DeviceListActivity extends Activity {
private final String TAG = DeviceListActivity.class.getSimpleName();
private UsbManager mUsbManager;
private ListView mListView;
private TextView mProgressBartitle;
private ProgressBar mProgressBar;
private static final int MESSAGE_REFRESH = 101;
private static final long REFRESH_TIMEOUT_MILLIS = 5000;
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MESSAGE_REFRESH:
refreshDeviceList();
mHandler.sendEmptyMessageDelayed(MESSAGE_REFRESH REFRESH_TIMEOUT_MILLIS);
break;
default:
super.handleMessage(msg);
break;
}
}
};
/** Simple container for a UsbDevice and its driver. */
private static class DeviceEntry {
public UsbDevice device;
public UsbSerialDriver driver;
DeviceEntry(UsbDevice device UsbSerialDriver driver) {
this.device = device;
this.dri
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 372 2013-11-06 18:34 UsbSerialLibrary\.classpath
文件 819 2013-11-06 18:34 UsbSerialLibrary\.project
文件 28028 2013-11-06 18:34 UsbSerialLibrary\.settings\org.eclipse.jdt.core.prefs
文件 306 2013-11-06 18:34 UsbSerialLibrary\.settings\org.eclipse.jdt.ui.prefs
文件 270 2013-11-06 18:34 UsbSerialLibrary\AndroidManifest.xm
文件 1159 2013-11-06 18:34 UsbSerialLibrary\proguard.cfg
文件 382 2013-11-06 18:34 UsbSerialLibrary\project.properties
文件 490 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\BuildInfo.java
文件 8791 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\CdcAcmSerialDriver.java
文件 4434 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\CommonUsbSerialDriver.java
文件 9761 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\Cp2102SerialDriver.java
文件 18571 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\FtdiSerialDriver.java
文件 18187 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\ProlificSerialDriver.java
文件 2532 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\UsbId.java
文件 7015 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\UsbSerialDriver.java
文件 9275 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\UsbSerialProber.java
文件 1428 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\driver\UsbSerialRuntimeException.java
文件 4690 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\util\HexDump.java
文件 5589 2013-11-06 18:34 UsbSerialLibrary\src\com\hoho\android\usbserial\util\SerialInputOutputManager.java
文件 532 2013-11-06 18:34 UsbSerialExamples\.classpath
文件 820 2013-11-06 18:34 UsbSerialExamples\.project
文件 23139 2013-11-06 18:34 UsbSerialExamples\.settings\org.eclipse.jdt.core.prefs
文件 306 2013-11-06 18:34 UsbSerialExamples\.settings\org.eclipse.jdt.ui.prefs
文件 1541 2013-11-06 18:34 UsbSerialExamples\AndroidManifest.xm
文件 1248 2013-11-06 18:34 UsbSerialExamples\proguard.cfg
文件 409 2013-11-06 18:34 UsbSerialExamples\project.properties
文件 4147 2013-11-06 18:34 UsbSerialExamples\res\drawable-hdpi\ic_launcher.png
文件 1723 2013-11-06 18:34 UsbSerialExamples\res\drawable-ldpi\ic_launcher.png
文件 2574 2013-11-06 18:34 UsbSerialExamples\res\drawable-mdpi\ic_launcher.png
文件 1745 2013-11-06 18:34 UsbSerialExamples\res\layout\main.xm
............此处省略32个文件信息
- 上一篇:读者写者问题图形界面--Java
- 下一篇:java实验5.doc
评论
共有 条评论