package com.sunzee.mvp.debug;

import android.util.Log;

import com.sunzee.base.BasePresenter;
import com.sunzee.thread.debugparameter.ThreadPoolDebugParameter;
import com.sunzee.utils.HexadecimalUtil;
import com.wuxiaolong.androidutils.library.LogUtil;

import java.util.ArrayList;

/**
 * 调试页界面 presenter
 */
public class DebugPresenter extends BasePresenter<DebugView> {
    public DebugPresenter(DebugView view) {
        attachView(view);
    }

    private static final String TAG = "DebugPresenter";

    public void setDebugParameter(String name, ArrayList<String> results, ThreadPoolDebugParameter threadGetParameter1) {
        if (name.equals("M311")) {
            if (!threadGetParameter1.isReceive1()) {
                threadGetParameter1.setReceive1(true);
                threadGetParameter1.stopReadM311();
                //参数19 D218
                threadGetParameter1.getValues().set(0, results.get(7));
                threadGetParameter1.getValues().set(1, results.get(8));
                threadGetParameter1.getValues().set(2, results.get(9));
                threadGetParameter1.getValues().set(3, results.get(11));
                threadGetParameter1.getValues().set(4, results.get(12));
                threadGetParameter1.getValues().set(5, results.get(13));
                threadGetParameter1.getValues().set(6, results.get(14));
                LogUtil.d(TAG, "setDebugParameter: "+threadGetParameter1.getValues());
            }
        }
        if (threadGetParameter1.isReceive1()) {
            mvpView.getDataSuccess();
            mvpView.hideLoading();
            threadGetParameter1.setReceive1(false);
        }
    }
}
