xxx
yy1717
2020-11-25 8c69444d8129193511eca990b6d97be5c36232ea
app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -93,6 +93,7 @@
    private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
   private AuthMapViewmodel authMapViewmodel;
    String des ="蓝牙关闭";
    private ICEventListener icEventListener = new ICEventListener() {
        @Override
        public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
@@ -117,10 +118,12 @@
            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 mac = jsonObject.getString("bluetooth_addr");
                        String des ="蓝牙关闭";
                        String str = (String) obj;
                        Log.i(TAG,"shou=="+str);
                        JSONObject jsonObject = new JSONObject(str);
                        int bleStatus = jsonObject.getInt("bluetooth_status");
                        switch (bleStatus){
                            case 0:
                                des ="蓝牙关闭";
@@ -134,10 +137,17 @@
                            case 3:
                                authMapViewmodel.setAuthValue(3);
                                des ="蓝牙连接";
                                String mac = jsonObject.getString("bluetooth_addr");
                                SPUtils.put(getApplicationContext(),SPUtils.BLUETOOTH_MAC,mac);
                                break;
                        }
                        tv_ble_status.setText(des);
                        tv_ble_status.post(new Runnable() {
                            @Override
                            public void run() {
                                tv_ble_status.setText(des);
                            }
                        });
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }