From da23e781a4ed4c37e3772d02e8000d9b006d01b9 Mon Sep 17 00:00:00 2001
From: endian11 <Dana_Lee1016@126.com>
Date: 星期二, 24 十一月 2020 17:35:49 +0800
Subject: [PATCH] 加入蓝牙扫描界面和功能 并发送蓝牙信息给远程服务进行连接;展示 蓝牙状态
---
app/src/main/java/safeluck/drive/evaluation/MainActivity.java | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/MainActivity.java b/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
index e978b18..109b774 100644
--- a/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
+++ b/app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -73,12 +73,12 @@
private RTKConfig mRTKConfig;//RTK閰嶇疆淇℃伅
private ImageView iv_rtk_status;
private Gson gson = new Gson();
- String[] PERMISSIONS = new String[]{ Manifest.permission.ACCESS_FINE_LOCATION};
+ String[] PERMISSIONS = new String[]{ Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.WRITE_EXTERNAL_STORAGE};
RTKConfigViewModel rtkConfigViewModel;
public ExamPlatformModel examPlatformModel;
private TextView tv_sat_num,tv_work_platform,tv_network_time,
- tv_qf;
+ tv_qf,tv_ble_status;
public Button btn_return;
public View viewtitle;
@@ -106,6 +106,34 @@
e.printStackTrace();
}
}
+ if (msgCode == Constant.ID_SM_BLUETOOTH_BRIEF){
+ if (tv_ble_status != null){
+ try {
+ JSONObject jsonObject = new JSONObject((String) obj);
+ int bleStatus = jsonObject.getInt("bluetooth_stauts");
+ String des ="钃濈墮鍏抽棴";
+ switch (bleStatus){
+ case 0:
+ des ="钃濈墮鍏抽棴";
+ break;
+ case 1:
+ des ="钃濈墮鎵撳紑";
+ break;
+ case 2:
+ des ="钃濈墮鏈繛鎺�";
+ break;
+ case 3:
+ des ="钃濈墮杩炴帴";
+ break;
+ }
+ tv_ble_status.setText(des);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+ }
}
};
@@ -131,6 +159,7 @@
tv_work_platform = findViewById(R.id.platform);
tv_sat_num = findViewById(R.id.tv_sat_num_instatus);
+ tv_ble_status = findViewById(R.id.tv_ble_status);
tv_qf = findViewById(R.id.tv_qf);
iv_rtk_status.getDrawable().setLevel(0);
tv_network_time = findViewById(R.id.network_time);
--
Gitblit v1.8.0