张海江
2017-08-11 51f8633b379efab41a8b19a375d5e41785a15ee6
app/src/main/java/com/moral/yunfushao/fragment/FragmentMonitor.java
@@ -197,6 +197,14 @@
            pv.setPercent(0);
            tv_ljjl.setText("0");
            tv_shishi.setText("0");
        }else if(msg.getType() == AppConfig.CHANGE_SETTING){
            if(timer!=null){
                timer.cancel();
                timer = null;
            }
            submitTime = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getRefresh_frequency();
            isupLoad  = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getIs_open_upload();
            doTask();
        }
    }
@@ -242,11 +250,13 @@
        iv_his.setOnClickListener(this);
        iv_search.setOnClickListener(this);
    }
    int submitTime;
    int isupLoad;
    @Override
    protected void initData() {
        submitTime = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getRefresh_frequency();
        isupLoad  = MainApp.theApp.sharedPreferencesUtil.getLoginInfo().getIs_open_upload();
        doTask();
    }
    @Override
@@ -268,7 +278,7 @@
                if(mBluetoothService==null){
                    return;
                }
                mBluetoothService.write(mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(),mBluetoothService.getWirteCharacteristic().getUuid().toString(),"5A0014010001000000000000004600000000005B",null);
                mBluetoothService.write(mBluetoothService.getWirteCharacteristic().getService().getUuid().toString(),mBluetoothService.getWirteCharacteristic().getUuid().toString(),BLECommon.BLE_SEARCH,null);
                break;
        }
@@ -278,8 +288,6 @@
    protected void onErrorPagerClick() {
    }
    private boolean isFinish = false;
    Timer timer;
    private void doTask() {
@@ -287,12 +295,12 @@
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                if (!isFinish) {
                if (isupLoad == 1) {
                    //上传数据
                    submitData();
                }
            }
        }, 0, 10000);
        }, 0, submitTime);
    }
    private void submitData() {