资源简介
android默认是没有标准串口的api的,这个包增加了jni来访问linux串口设备,以及增加java api来访问,有完整的示例代码。
代码片段和文件信息
/*
sercd: RFC 2217 compliant serial port redirector
Copyright 2003-2008 Peter Åstrand for Cendio AB
Copyright (C) 1999 - 2003 InfoTecna s.r.l.
Copyright (C) 2001 2002 Trustees of Columbia University
in the City of New York
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. 675 Mass Ave Cambridge MA 02139 USA.
*/
#ifdef ANDROID
#include “android.h“
#include
static jobject ConvertToJava(JNIEnv *env ProxyState newstate)
{
jclass class = (*env)->FindClass(env “gnu.sercd.SercdService$ProxyState“);
const char *name;
switch(newstate)
{
case STATE_READY: name = “STATE_READY“; break;
case STATE_CONNECTED: name = “STATE_CONNECTED“; break;
case STATE_PORT_OPENED: name = “STATE_PORT_OPENED“; break;
case STATE_STOPPED: name = “STATE_STOPPED“; break;
case STATE_CRASHED: name = “STATE_CRASHED“; break;
}
jfieldID fieldid = (*env)->GetStaticFieldID(
env
class
name
“Lgnu/sercd/SercdService$ProxyState;“);
return (*env)->GetStaticobjectField(
env
class
fieldid);
}
void ChangeState(JNIEnv *env jobject thiz ProxyState newstate)
{
jclass class = (*env)->GetobjectClass(
env
thiz);
jmethodID methodid = (*env)->GetMethodID(
env
class
“ChangeState“
“(Lgnu/sercd/SercdService$ProxyState;)V“);
jvalue value;
value.l = ConvertToJava(
env
newstate);
(*env)->CallVoidMethodA(
env
thiz
methodid
&value);
}
#endif /* ANDROID */
相关资源
- Google gson
- protobuf-java-2.6.0.jar
- com.google.gson.Gson4个jar包
- Android SerialPort
- Java三种生成条形码的源码barcode4j、
-
eclipse-java-google-st
yle - Android 基于google Zxing实现二维码的生成
- Android googlemap
- google-common.jar
- android 美食天下源码 googlemap
- Google Android手机嵌入式系统的研究与开
- ComAssistantAndroid串口通信
- android串口调试助手源代码
- 根据GoogleMapApi给出地名获取经纬度,
- Android串口调试工具源码
- Google 推出的 Java 编码规范
- android串口收发数据
- google地图jar包——maps.jar
- socketio-netty服务器推送jar包
- Android串口工具.apk
- google common jar包
- java语言实现google的机器翻译模型
- google zxing生成二维码两个必备jar包
- com.google.common.jar
- com.google.common.collect jar包
- android串口demo
- com.google.common中的jar包
- WebViewGoogle
- google play services jar
- GoogleLoginService.apk
评论
共有 条评论