/** 开始读历史数据 */ private void syncHistory() { if (mReceiveCharacteristic != null) { mBlueToothConnction.setCharacteristicNotification(mReceiveCharacteristic, true); } mRequestHistoryDataThread = new RequestHistoryDataThread(); isRequestHistoryDataRunning = true; mRequestHistoryDataThread.start(); }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (TravelConstant.ACTION_UI_SERICE_TRAVEL_STATE_CHANGE.equals(action) && BaseApplication.workModel == EBConstant.WORK_BLUETOOTH) { if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_START) { // 开始 if (mRequestHistoryDataThread != null) { mRequestHistoryDataThread.cancel(); } startTravel(); } else if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_PAUSE) { // 暂停 isRequestData = false; } else if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_FAKE_PAUSE) { // 伪暂停 // 不做处理 } else if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_RESUME) { // 恢复 isRequestData = true; } else if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_COMPLETED) { // 完成 stopTravel(); } else if (BaseApplication.travelState == TravelConstant.TRAVEL_STATE_STOP) { // 停止 stopTravel(); } } }