Android通过JNI操作串口《四》
2014-04-08 18:17
260 查看
7.
config_options.xml
<?xml
version="1.0"
encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="video_call_fallback_setting"
android:title="@string/tty_settings"
android:persistent="false">
<ListPreference
android:key="tty_databits"
android:title="@string/databits"
android:persistent="true"
android:entries="@array/databits_entries"
android:entryValues="@array/databits_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_event"
android:title="@string/event"
android:persistent="true"
android:entries="@array/event_entries"
android:entryValues="@array/event_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_speed"
android:title="@string/speed"
android:persistent="true"
android:entries="@array/speed_entries"
android:entryValues="@array/speed_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_stopbits"
android:title="@string/stopbits"
android:persistent="true"
android:entries="@array/stopbits_entries"
android:entryValues="@array/stopbits_values"
android:summary="data bits"/>
</PreferenceScreen>
8.
main.xml
<?xml
version="1.0"
encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dip"
android:orientation="horizontal"
>
<Button
android:id="@+id/openOrcloseBtn"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dip"
android:orientation="horizontal"
>
<EditText
android:id="@+id/sendMsg"
android:layout_gravity="left"
android:layout_width="200dip"
android:layout_height="50dip"
/>
<Button
android:id="@+id/sendBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:orientation="horizontal"
>
<TextView
android:id="@+id/receiveMsg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/receiveData"
/>
</LinearLayout>
</LinearLayout>
9.
string.xml
<?xml
version="1.0"
encoding="utf-8"?>
<resources>
<string
name="hello">Hello World, UARTCTLActivity!</string>
<string
name="receiveData">Receive data show!</string>
<string
name="app_name">UARTCTL</string>
<string
name="open">Open</string>
<string
name="close">Close</string>
<string
name="send">Send</string>
<string
name="config">Config</string>
<string
name="tty_settings">Settings</string>
<string
name="databits">Data bits</string>
<string
name="event">Event</string>
<string
name="speed">Speed</string>
<string
name="stopbits">Stop bits</string>
<string-array
name="databits_entries">
<item>-1</item>
<item>7</item>
<item>8</item>
</string-array>
<string-array
name="databits_values">
<item>-1</item>
<item>7</item>
<item>8</item>
</string-array>
<string-array
name="event_entries">
<item>Settings</item>
<item>None</item>
<item>Event</item>
<item>Odd</item>
</string-array>
<string-array
name="event_values">
<item>Q</item>
<item>N</item>
<item>E</item>
<item>O</item>
</string-array>
<string-array
name="speed_entries">
<item>-1</item>
<item>B2400</item>
<item>B4800</item>
<item>B9600</item>
<item>B115200</item>
</string-array>
<string-array
name="speed_values">
<item>-1</item>
<item>2400</item>
<item>4800</item>
<item>9600</item>
<item>115200</item>
</string-array>
<string-array
name="stopbits_entries">
<item>-1</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array
name="stopbits_values">
<item>-1</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>
10.
Android.mk
LOCAL_PATH:=$(call
my-dir)
include
$(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES :=
$(call all-java-files-under,src)
#LOCAL_J***A_LIBRARIES := uart-ctl
LOCAL_JNI_SHARED_LIBRARIES :=
uart_ctl #so文件打包到apk中
LOCAL_PACKAGE_NAME := UARTCTL
#LOCAL_CERTIFICATE := platform
include
$(BUILD_PACKAGE)
include
$(LOCAL_PATH)/jni/Android.mk
include
$(call all-makefiles-under,$(LOCAL_PATH))
11.
jni/Android.mk
LOCAL_PATH:=$(call
my-dir)
include
$(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
com_notioni_uart_manager_TtyNativeControl.cpp
LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE)
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
libandroid_runtime
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := uart_ctl
include
$(BUILD_SHARED_LIBRARY)
config_options.xml
<?xml
version="1.0"
encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="video_call_fallback_setting"
android:title="@string/tty_settings"
android:persistent="false">
<ListPreference
android:key="tty_databits"
android:title="@string/databits"
android:persistent="true"
android:entries="@array/databits_entries"
android:entryValues="@array/databits_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_event"
android:title="@string/event"
android:persistent="true"
android:entries="@array/event_entries"
android:entryValues="@array/event_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_speed"
android:title="@string/speed"
android:persistent="true"
android:entries="@array/speed_entries"
android:entryValues="@array/speed_values"
android:summary="data bits"/>
<ListPreference
android:key="tty_stopbits"
android:title="@string/stopbits"
android:persistent="true"
android:entries="@array/stopbits_entries"
android:entryValues="@array/stopbits_values"
android:summary="data bits"/>
</PreferenceScreen>
8.
main.xml
<?xml
version="1.0"
encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dip"
android:orientation="horizontal"
>
<Button
android:id="@+id/openOrcloseBtn"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/open"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dip"
android:orientation="horizontal"
>
<EditText
android:id="@+id/sendMsg"
android:layout_gravity="left"
android:layout_width="200dip"
android:layout_height="50dip"
/>
<Button
android:id="@+id/sendBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/send"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:orientation="horizontal"
>
<TextView
android:id="@+id/receiveMsg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/receiveData"
/>
</LinearLayout>
</LinearLayout>
9.
string.xml
<?xml
version="1.0"
encoding="utf-8"?>
<resources>
<string
name="hello">Hello World, UARTCTLActivity!</string>
<string
name="receiveData">Receive data show!</string>
<string
name="app_name">UARTCTL</string>
<string
name="open">Open</string>
<string
name="close">Close</string>
<string
name="send">Send</string>
<string
name="config">Config</string>
<string
name="tty_settings">Settings</string>
<string
name="databits">Data bits</string>
<string
name="event">Event</string>
<string
name="speed">Speed</string>
<string
name="stopbits">Stop bits</string>
<string-array
name="databits_entries">
<item>-1</item>
<item>7</item>
<item>8</item>
</string-array>
<string-array
name="databits_values">
<item>-1</item>
<item>7</item>
<item>8</item>
</string-array>
<string-array
name="event_entries">
<item>Settings</item>
<item>None</item>
<item>Event</item>
<item>Odd</item>
</string-array>
<string-array
name="event_values">
<item>Q</item>
<item>N</item>
<item>E</item>
<item>O</item>
</string-array>
<string-array
name="speed_entries">
<item>-1</item>
<item>B2400</item>
<item>B4800</item>
<item>B9600</item>
<item>B115200</item>
</string-array>
<string-array
name="speed_values">
<item>-1</item>
<item>2400</item>
<item>4800</item>
<item>9600</item>
<item>115200</item>
</string-array>
<string-array
name="stopbits_entries">
<item>-1</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array
name="stopbits_values">
<item>-1</item>
<item>1</item>
<item>2</item>
</string-array>
</resources>
10.
Android.mk
LOCAL_PATH:=$(call
my-dir)
include
$(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES :=
$(call all-java-files-under,src)
#LOCAL_J***A_LIBRARIES := uart-ctl
LOCAL_JNI_SHARED_LIBRARIES :=
uart_ctl #so文件打包到apk中
LOCAL_PACKAGE_NAME := UARTCTL
#LOCAL_CERTIFICATE := platform
include
$(BUILD_PACKAGE)
include
$(LOCAL_PATH)/jni/Android.mk
include
$(call all-makefiles-under,$(LOCAL_PATH))
11.
jni/Android.mk
LOCAL_PATH:=$(call
my-dir)
include
$(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES:= \
com_notioni_uart_manager_TtyNativeControl.cpp
LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE)
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libui \
libandroid_runtime
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := uart_ctl
include
$(BUILD_SHARED_LIBRARY)
相关文章推荐
- Android通过JNI操作串口
- Android通过JNI操作串口《一》
- Android通过JNI操作串口《二》
- Android通过JNI操作串口《三》
- Android通过JNI操作串口
- Android通过JNI实现与C语言的串口通讯操作蓝牙硬件模块
- [Android]通过JNI访问并操作Bitmap的元素,支持RGB565和ARGB8888
- [Android]通过JNI访问并操作Bitmap的元素,支持RGB565和ARGB8888
- win7与android设备通过蓝牙串口的连接方法
- [Android]通过JNI实现卸载自身App后台发送Http请求~
- Android串口操作-基于tiny4412
- 在Android中通过jni方式使用编译好的FFmpeg库-Android中使用FFmpeg媒体库
- 通过JNI调用android驱动
- AndroidJNI 通过C++调用JAVA
- Android java层与jni之间字符串数据传递需进行编码解码操作
- Android 真机,微信打开 H5,切换到 webview,能通过 webdriver 方法操作页面元素,然后链接到新的 H5 页面后,无法操作元素,appium 服务器没有收到 response,
- Android 通过Jni调用Native
- cocos2d-x中通过jni调用android方法
- Android中的JNI数组操作教程
- Android 通过JNI实现守护进程,使Service服务不被杀死