资源简介
使用时 广播注册 和meta-data的注册 必须在Acticvity节点下,功能:扫描串口信息 读写串口数据 不需要使用 root权限

代码片段和文件信息
/* 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.UsbManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.ScrollView;
import android.widget.TextView;
import com.hoho.android.usbserial.driver.UsbSerialDriver;
import com.hoho.android.usbserial.driver.UsbSerialProber;
import com.hoho.android.usbserial.util.HexDump;
import com.hoho.android.usbserial.util.SerialInputOutputManager;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* A sample Activity demonstrating USB-Serial support.
*
* @author mike wakerly (opensource@hoho.com)
*/
public class DemoActivity extends Activity {
private final String TAG = DemoActivity.class.getSimpleName();
/**
* The device currently in use or {@code null}.
*/
private UsbSerialDriver mSerialDevice;
/**
* The system‘s USB service.
*/
private UsbManager mUsbManager;
private TextView mtitleTextView;
private TextView mDumpTextView;
private ScrollView mScrollView;
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
private SerialInputOutputManager mSerialIoManager;
private final SerialInputOutputManager.Listener mListener =
new SerialInputOutputManager.Listener() {
@Override
public void onRunError(Exception e) {
Log.d(TAG “Runner stopped.“);
}
@Override
public void onNewData(final byte[] data) {
DemoActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
DemoActivity.this.updateReceivedData(data);
}
});
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
mtitleTextView = (TextView) findViewById(R.id.demotitle);
mDumpTextView =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-12-04 17:43 usb-serial-for-android-master\
文件 218 2012-12-04 17:43 usb-serial-for-android-master\.gitignore
文件 69 2012-12-04 17:43 usb-serial-for-android-master\CHANGELOG.txt
文件 7651 2012-12-04 17:43 usb-serial-for-android-master\LICENSE.txt
文件 1695 2012-12-04 17:43 usb-serial-for-android-master\README.md
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\
文件 438 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\.classpath
文件 820 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\.project
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\.settings\
文件 23139 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\.settings\org.eclipse.jdt.core.prefs
文件 117 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\.settings\org.eclipse.jdt.ui.prefs
文件 1235 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\AndroidManifest.xm
文件 1248 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\proguard.cfg
文件 409 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\project.properties
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-hdpi\
文件 4147 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-hdpi\ic_launcher.png
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-ldpi\
文件 1723 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-ldpi\ic_launcher.png
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-mdpi\
文件 2574 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\drawable-mdpi\ic_launcher.png
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\layout\
文件 798 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\layout\main.xm
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\values\
文件 182 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\values\strings.xm
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\xm
文件 430 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\res\xm
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\src\
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\src\com\
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\src\com\hoho\
目录 0 2012-12-04 17:43 usb-serial-for-android-master\UsbSerialExamples\src\com\hoho\android\
............此处省略29个文件信息
- 上一篇:PickAddressAndDate
- 下一篇:Android 蓝牙使用
相关资源
- android带百分比进度条的文件上传,使
- 美食天下项目Android版源码和Web版源码
- Android之自定义ToggleButton使用
- Android非常漂亮的登录界面
- pc与android通过usb socket实现手机通信
- android毕业设计
- 百度地图自定义Markerandroid
- Android分区工具包
- android-support-v4.jar已打包进去源代码
- u-blox_Android_GNSS_Driver_v3.10驱动源码+中
- 个人根据Android移动开发案例详解手写
- android 视频播放器 项目和原码
- Android【动画】【特效】 17种动画特效
- 基于Android智能家居详细设计(经典)
- android通过JDBC连接Mysql数据库
- Android通讯录的源代码
- android 瀑布流Demo
- 指纹传感器FPC1080在android下的驱动
- delphi xe5 android 调用照相机摄像头拍照
- Android手机连连看游戏源码
- android-sdk-windows v2.3离线完整版
- android 底部弹出菜单(带透明背景)
- Android工程模式简介.rar
- Android蓝牙和Cors网络开发源码
- Android powermanger wakelock
- USB串口通讯助手OTG转USB
- Android v7的一些jar包
- 最新android supportV7包
- android图片压缩工具类分享
- 单机搭建Android(解决Network is unreach
评论
共有 条评论