资源简介
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 */
相关资源
- android语音识别两种方法讯飞+google
- [Google.API大全:编程·开发·]扫描版
- Google Java 编程规范中文版
- Google官方Android开发教程-入门篇
- Learn ARCore - Fundamentals of Google ARCore
- android地铁助手
- exmaple_google_oauth2_java.zip
- Android串口(AndroidSerialPort)通信代码
- Android串口编程--开关灯Demo
- google 服务包
- GoogleEarthAPI开发者指南_目录版
- google protobuf 开发指南中文版
- Google Android应用案例开发大全随书光盘
- Android串口通讯库
- Android串口通信超简单的Demo
- Guava 19 API ( CHM格式 )
- Android串口通信demo(AS)
- Unity5Google Protobuf解析工具,支持andr
- android的NFC应用源代码(google全国应用
- Google Guava 15.0
- android串口开发demo
- Android串口通信
- google play store
- 通过Google内置计步器和加速度传感器
- Android facebook 和 Twitter 和google三方登录
- google play services 总包
- Google手机模拟器Android Emulator v1.0
- jdk1.8_google_中文离线版帮助文档
- gvr-android-sdk-master.zip
- Android串口通信Android Studio
评论
共有 条评论