zigbeeAnaloglibrary.jar包是用来获取四通道独立采集模块中的数据的
首先将jar包和so文件添加到工程,可参考
https://blog.csdn.net/qq_40733723/article/details/89032484
基本步骤
1、初始化ui
2、初始化zigbee
(1)打开串口
(2)如果串口打开成功则开启数据接收线程
3、初始化回调函数,由于子线程无法更新ui,需要发送消息给ui线程
4、创建Handler用来接收子线程发来的消息
xml代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:textColor="@android:color/black"
android:text="温度:"/>
<TextView
android:id="@+id/tvTemp"
android:layout_width="wrap_content"
android:te