| | |
| | | |
| | | 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) { |
| | |
| | | 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 ="蓝牙关闭"; |
| | |
| | | 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(); |
| | | } |