导航菜单

页面标题

页面副标题

六分钟步行测试管理软件 v1.1.0.2112120029 - MainActivity.java 源代码

正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 MainActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package cn.neoprint.padmonitor.ui;

import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.Process;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.InputFilter;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.view.MotionEventCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.fragment.app.FragmentTransaction;
import androidx.vectordrawable.graphics.drawable.PathInterpolatorCompat;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.data.DataRepository;
import cn.neoprint.padmonitor.data.entity.AlarmData;
import cn.neoprint.padmonitor.data.entity.AlarmList;
import cn.neoprint.padmonitor.data.entity.Mydata;
import cn.neoprint.padmonitor.data.entity.PatientEntityDao;
import cn.neoprint.padmonitor.presenter.MainTestPresenter;
import cn.neoprint.padmonitor.presenter.ReportListPresenter;
import cn.neoprint.padmonitor.thread.AddInvalidateDataThread;
import cn.neoprint.padmonitor.thread.AlarmShowThread;
import cn.neoprint.padmonitor.thread.DrawLineThread;
import cn.neoprint.padmonitor.thread.RecvDataProcess;
import cn.neoprint.padmonitor.thread.SendDataThread;
import cn.neoprint.padmonitor.thread.ShowTimeThread;
import cn.neoprint.padmonitor.thread.StreamDataSaveThread;
import cn.neoprint.padmonitor.thread.TCPDataSend;
import cn.neoprint.padmonitor.thread.TSocketClient;
import cn.neoprint.padmonitor.thread.WaveDataSaveThread;
import cn.neoprint.padmonitor.ui.MainActivity;
import cn.neoprint.padmonitor.ui.fragment.BleFragment;
import cn.neoprint.padmonitor.ui.view.ChannelView;
import cn.neoprint.padmonitor.ui.view.ECG1Channel_view;
import cn.neoprint.padmonitor.ui.view.EmergencyStopPopupWindow;
import cn.neoprint.padmonitor.ui.view.ManualInputNibpPopupWindow;
import cn.neoprint.padmonitor.ui.view.MyViewGroup;
import cn.neoprint.padmonitor.ui.view.MyViewGroupHorizontal;
import cn.neoprint.padmonitor.utils.CSVWriter;
import cn.neoprint.padmonitor.utils.DateUtils;
import cn.neoprint.padmonitor.utils.DialogUtils;
import cn.neoprint.padmonitor.utils.DisplayUtils;
import cn.neoprint.padmonitor.utils.FileUtils;
import cn.neoprint.padmonitor.utils.FontManager;
import cn.neoprint.padmonitor.utils.ReaderClientUtils;
import cn.neoprint.padmonitor.utils.ToastUtils;
import cn.neoprint.padmonitor.utils.constant.ConstDefine;
import cn.neoprint.padmonitor.utils.constant.GzjSharePref;
import cn.neoprint.padmonitor.utils.constant.SharePreferenceConstant;
import com.sayeasytech.base.log.KLog;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread;
import java.lang.ref.WeakReference;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener, View.OnTouchListener, View.OnClickListener, SensorEventListener {
    public static boolean alarming;
    public static SharedPreferences gzj;
    public static Activity instance;
    public static boolean isalarm;
    public TextView Bodystatus;
    public TextView Deviceno;
    public AlarmList HRSCAlarmList;
    public List<Byte> HRflag;
    public TextView HRunit;
    public TextView NIBPTestTime;
    public TextView NIBPunit;
    public TextView PIN_monitor;
    public ImageView PVCSalarmImg;
    public AlarmList ParaAlarmList;
    public TextView ParaAlarm_zone;
    public List<Byte> Qiboflag;
    public List<Byte> RespList;
    public List<Integer> STDataList1;
    public List<Integer> STDataList2;
    public TextView STValue1;
    public TextView STValue2;
    public ImageView STalarmbmp;
    public TextView STtext1;
    public TextView STtext2;
    public int SpO2alarmlevel;
    public List<Byte> Spo2List;
    public AlarmList TechAlarmList;
    public TextView TechAlarm_zone;
    public ImageView TechalarmImage;
    public AudioManager audioManager;
    private IntentFilter batteryLevelFilter;
    private BroadcastReceiver batteryLevelRcvr;
    public TextView bpm;
    public TextView brpm;
    public ImageView btnConnect;
    public Button btnEmergencyStop;
    public Button btnFunSetting;
    public Button btnLogin;
    public Button btnLogout;
    public Button btnMute;
    public Button btnPrint;
    public Button btnStartNIBP;
    public long currentTime;
    public SQLiteDatabase database;
    public float dia_high;
    public float dia_low;
    public List<Integer> eCG_1List;
    public List<Integer> eCG_2List;
    public List<Integer> eCG_3List;
    public RelativeLayout ecgLayout;
    public TextView ecg_channel1_tx;
    public TextView ecg_channel2_tx;
    public TextView ecg_gain;
    public TextView ecg_gain1;
    public ImageView ecgalarmbmp;
    public ImageView ecgbmp;
    public TextView ecgspeed;
    public TextView ecgspeed1;
    public int hr_alarmlevel;
    public int hr_high;
    public boolean hr_lock;
    public int hr_low;
    public boolean hrsc_lock;
    public boolean isdia;
    public boolean isfrozen;
    public boolean isresp;
    public boolean isspo2;
    public boolean isstart;
    public boolean issys;
    public boolean istemp;
    private ImageView ivBTPowerImage;
    public ImageView iv_ble_status;
    public int lastMinStepCount;
    public LinearLayout lv;
    public BleFragment mBleFragment;
    private Thread.UncaughtExceptionHandler mDefaultHandler;
    public GestureDetector mGestureDetector;
    private OrientationEventListener mOrientationListener;
    public boolean mRegisteredSensor;
    public SensorManager mSensorManager;
    public int m_AlarmPauseTime;
    public int m_PRAlarmHigh;
    public int m_PRAlarmLow;
    public String m_PatientName;
    public List<Byte> m_RealdataList;
    private SoundPool m_SPHigh;
    private SoundPool m_SPLow;
    private SoundPool m_SPMiddle;
    public float m_STAlarmHigh;
    public float m_STAlarmLow;
    public boolean m_STAlarmSwitch;
    public boolean m_STShow;
    public int m_ZhixiAlarmTime;
    public int m_alarmVolumelevel;
    public String m_bedno;
    public ProgressBar m_bpBar;
    public boolean m_currentBoltLock;
    private int m_loadIdHigh;
    private int m_loadIdLow;
    private int m_loadIdMiddle;
    public float m_nibpMAPAlarmHigh;
    public float m_nibpMAPAlarmLow;
    public int m_nibpalarmlevel;
    public int m_nibptest;
    public int m_nibpunit;
    public String m_remotestate;
    public int m_respalarmlevel;
    public int m_stalarmlevel;
    public int m_tempalarmlevel;
    public int m_tempunit;
    public TextView m_txnibp;
    public TextView m_txnibpDiscription;
    public TextView m_txnibpItem;
    public TextView m_txnibpManualInput;
    public TextView m_txnibpStart;
    public TextView m_txnibpStop;
    public TextView m_txnibpmap;
    public TextView map;
    public TextView mmhg;
    public RelativeLayout mmhgLayout;
    public TextView mon;
    public TextView mon1;
    public File myFilePath;
    public FrameLayout myLayout;
    public RelativeLayout myNIBPLayout;
    public MyViewGroup myViewGroupleft;
    public MyViewGroupHorizontal myViewGroupright;
    public Drawable nBackAll;
    public boolean nibp_lock;
    public ImageView nibpalarmbmp;
    public TextView nibpunitTextView;
    public TextView remotedis;
    public Resources res;
    public RelativeLayout respLayout;
    public TextView resp_gain;
    public int resp_high;
    public boolean resp_lock;
    public int resp_low;
    public ImageView respalarmbmp;
    public TextView respspeed;
    public TextView shownowtime;
    public TextView spo2;
    public RelativeLayout spo2Layout;
    public int spo2_high;
    public boolean spo2_lock;
    public int spo2_low;
    public ImageView spo2alarmbmp;
    public ProgressBar spo2bt;
    public TextView spo2speed;
    public TextView spo2xh;
    public TextView spo2xhname;
    private int stay1Load;
    private SoundPool stay1Sp;
    private int stay2Load;
    private SoundPool stay2Sp;
    public TextView stepno;
    String strAddress;
    String strDevicename;
    public float sys_high;
    public float sys_low;
    public TextView temp;
    public TextView tempUnit;
    public float temp_high;
    public boolean temp_lock;
    public float temp_low;
    public ImageView tempalarmbmp;
    public float temperature;
    public TextView timerTv;
    public TextView txBedno;
    public TextView txECGJZTip;
    public TextView txECGJZTip1;
    public TextView txFreeze;
    public TextView txFreeze1;
    public TextView txMuteTime;
    public TextView txPatientType;
    public ECG1Channel_view view_1;
    public ChannelView view_2;
    public ChannelView view_3;
    public ChannelView view_4;
    public ChannelView view_ECGI;
    public ECG1Channel_view view_ECGII;
    public ChannelView view_ECGIII;
    public ChannelView view_ECGV;
    public ChannelView view_ECGavF;
    public ChannelView view_ECGavL;
    public ChannelView view_ECGavR;
    private int walk1Load;
    private SoundPool walk1Sp;
    private int walk2Load;
    private SoundPool walk2Sp;
    private int walk3Load;
    private SoundPool walk3Sp;
    private int walk4Load;
    private SoundPool walk4Sp;
    private int walk5Load;
    private SoundPool walk5Sp;
    private int walk6Load;
    private SoundPool walk6Sp;
    private int walkLoad;
    private SoundPool walkSp;
    private ReportListPresenter reportListPresenter = new ReportListPresenter();
    public AppGlobal myApp = null;
    public int nowwidth = 826;
    public int nAllchannelHeight = 0;
    public int nChannelWide = 0;
    public int nParaWide = 0;
    public int nECGcolor = 0;
    public int nSpo2color = 0;
    public int nRespcolor = 0;
    public int nTempcolor = 0;
    public Typeface fontFace = null;
    private DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
    private Map<String, String> infos = new HashMap();
    public float[] array = new float[6];
    public int[] sensormonitor = new int[6];
    public boolean m_bDemo = false;
    public TextView txDemotext = null;
    public TextView txDemotext1 = null;
    public TextView ECGPVCSValue = null;
    public int PVCSValue = 0;
    public TSocketClient m_RetransDataProcess = null;
    public Handler retranshandle = null;
    public int reConnectSum = 0;
    public boolean stopconnect = false;
    public PowerManager powerManager = null;
    public PowerManager.WakeLock wakeLock = null;
    public int ecgchanno1 = 1;
    public int ecgchanno2 = 0;
    public int m_JGTime = 0;
    public int ecgHRsource = 0;
    public int remotedisTextId = 0;
    public int m_nPatientType = 0;
    public int sys = 0;
    public int dia = 0;
    private boolean isNibpTesting = false;
    public int nibpunit = 0;
    private float m_currentAlarmVol = 0.0f;
    public ArrayList<Integer> stepCountList = new ArrayList<>();
    public int count = 0;
    public int firClick = (int) System.currentTimeMillis();
    public int secClick = 0;
    public boolean secflag = false;
    public Handler mClickHandler = new Handler();
    public boolean ishrhigh = false;
    public boolean ishrlow = false;
    public boolean isStartBPSTAT = false;
    public boolean isStartBPJZ = false;
    public boolean isStartBPLouqiCheck = false;
    public int index = 0;
    public boolean m_STFresh1 = false;
    public boolean m_STFresh2 = false;
    public int m_inx1 = 0;
    public int m_inx2 = 0;
    public int m_nVolumAlarmLevel = 1;
    public int verticalMinDistance = 20;
    public int minVelocity = 0;
    public SendDataThread sendData = null;
    public ShowTimeThread nShowTime = null;
    public RecvDataProcess m_RecvDataProcess = null;
    public TCPDataSend mTCPDataSend = null;
    public Mydata mydata = new Mydata();
    public DrawLineThread m_DrawLineThread = null;
    public AddInvalidateDataThread m_AddInvalidateDataThread = null;
    public StreamDataSaveThread m_StreamDataSaveThread = null;
    public WaveDataSaveThread m_WaveDataSaveThread = null;
    public AlarmShowThread m_AlarmShowThread = null;
    public Handler HBhandler = new Handler();
    int logonresult = -1;
    private String RHOST = "192.168.0.86";
    private int TPORT = 9876;
    public int ifuploaddata = 0;
    String CDKEY = "0000000000000000";
    String verifycode = "123456";
    boolean showDialogFlag = false;
    private Handler handler = new MainHandler(this);
    TimerTask task50ms = new TimerTask() {
        @Override
        public void run() {
            Message message = new Message();
            message.what = 102;
            MainActivity.this.myHandler.sendMessage(message);
        }
    };
    private Handler myHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what != 102) {
                return;
            }
            MainActivity.this.sensorTimerView();
        }
    };
    public Timer timer50ms = new Timer();
    public boolean isTiming = false;
    public long sensorTimeCounter = 0;
    public long sensorCounterLastSec = 0;
    public int lastMinCircleCount = 0;
    public float lastMinLeftDistance = 0.0f;
    public List<Integer> sensorCircleCountList = new ArrayList();
    public List<Integer> sensorAfterTriggerTimeList = new ArrayList();
    public List<Float> sensorDistanceList = new ArrayList();
    public CountDownTimerHandler timer = new AnonymousClass7(480, 1000);
    public int NetErrorCount = 0;
    private boolean HBneedrun = true;
    Runnable tcpHeartbeat = new Runnable() {
        @Override
        public void run() {
            if (MainActivity.this.HBneedrun) {
                if (MainActivity.this.ifuploaddata == 2 && MainActivity.this.m_RetransDataProcess != null) {
                    MainActivity.this.datafromserver();
                }
                if ((MainActivity.this.ifuploaddata == 1 || MainActivity.this.ifuploaddata == 3) && MainActivity.this.m_RetransDataProcess != null) {
                    MainActivity.this.dataFromDevice();
                }
                MainActivity.this.HBhandler.postDelayed(this, 5000L);
            }
        }
    };
    int whichview = -1;
    public boolean bBlueDialogOpen = false;
    String randomnum = " ";
    private Runnable nibpRunnable = new Runnable() {
        @Override
        public void run() {
            if (MainActivity.this.myApp.GetBPFinish() == 0) {
                int GetNowNIBPPP = MainActivity.this.myApp.GetNowNIBPPP();
                if (MainActivity.this.nibpunit == 0) {
                    MainActivity.this.m_txnibp.setText(GetNowNIBPPP + "mmHg");
                } else {
                    MainActivity.this.m_txnibp.setText((Math.round(((GetNowNIBPPP * 2) / 15.0f) * 10.0f) / 10.0f) + "kPa");
                }
                MainActivity.this.m_txnibpmap.setText("");
                MainActivity.this.m_bpBar.setProgress(GetNowNIBPPP);
                MainActivity.this.isNibpTesting = true;
                MainActivity.this.m_txnibpStart.setVisibility(4);
                MainActivity.this.refreshBPDiscription();
                MainActivity.this.handler.postDelayed(MainActivity.this.nibpRunnable, 50L);
                return;
            }
            if (MainActivity.this.myApp.GetBPFinish() < 0) {
                MainActivity.this.m_bpBar.setProgress(0);
                return;
            }
            if (MainActivity.this.myApp.GetBPSuccessFlag()) {
                if (MainActivity.this.myApp.GetBPType() == 5) {
                    MainActivity.this.m_txnibp.setText(R.string.LQCheckSuccess);
                    MainActivity.this.m_txnibpmap.setText("");
                } else {
                    MainActivity.this.m_txnibp.setText(MainActivity.this.myApp.GetBPResult1());
                    MainActivity.this.m_txnibpmap.setText(MainActivity.this.myApp.GetBPResult2());
                }
                MainActivity.this.m_bpBar.setProgress(0);
            } else {
                MainActivity.this.m_txnibp.setText(MainActivity.this.myApp.GetBPResult1());
                MainActivity.this.m_txnibpmap.setText("");
                MainActivity.this.m_bpBar.setProgress(0);
            }
            MainActivity.this.refreshBPFinish();
        }
    };

    static void lambda$init$2() {
    }

    public void setLanguage() {
    }

    @Override
    public void onAccuracyChanged(Sensor sensor, int i) {
    }

    @Override
    public boolean onDown(MotionEvent motionEvent) {
        return false;
    }

    @Override
    public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        return true;
    }

    @Override
    public void onLongPress(MotionEvent motionEvent) {
    }

    @Override
    public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent2, float f, float f2) {
        return false;
    }

    @Override
    public void onShowPress(MotionEvent motionEvent) {
    }

    @Override
    public boolean onSingleTapUp(MotionEvent motionEvent) {
        return false;
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        return true;
    }

    public int getPVCSValue() {
        return this.PVCSValue;
    }

    public void setPVCSValue(int i) {
        this.PVCSValue = i;
    }

    static class MainHandler extends Handler {
        WeakReference<Activity> mActivityReference;

        MainHandler(Activity activity) {
            this.mActivityReference = new WeakReference<>(activity);
        }

        public void showBleStatusImg(boolean z) {
            Activity activity = this.mActivityReference.get();
            if (activity instanceof MainActivity) {
                ((MainActivity) activity).iv_ble_status.setImageResource(z ? R.drawable.dot_red : R.drawable.dot_gray);
            }
        }

        @Override
        public void handleMessage(Message message) {
            Activity activity = this.mActivityReference.get();
            if (activity instanceof MainActivity) {
                MainActivity mainActivity = (MainActivity) activity;
                switch (message.what) {
                    case 0:
                        mainActivity.myApp.SetNowNIBPPP(((Integer) message.obj).intValue());
                        if (mainActivity.myApp.GetBPFinish() == -1) {
                            mainActivity.myApp.SetBPFinish(0);
                            break;
                        }
                        break;
                    case 1:
                        if (mainActivity.myApp.isconnect) {
                            mainActivity.myApp.isconnect = false;
                            mainActivity.ProcessalarmInfo(R.string.wrong, 1, 0);
                            mainActivity.btnConnect.setImageResource(R.drawable.bluetooth_search);
                            KLog.d("bluetooth communication is error.");
                            mainActivity.StartAddInvalidatadataThread();
                        }
                        if (!mainActivity.stopconnect) {
                            mainActivity.ShowMessage(R.string.toast_04);
                            mainActivity.ResetButtonStatus();
                            mainActivity.ReConnectDevice();
                        }
                        showBleStatusImg(false);
                        break;
                    case 2:
                        KLog.d("bluetooth communication timeout.");
                        if (mainActivity.stopconnect) {
                            mainActivity.ShowMessage(R.string.disconnected_device);
                            break;
                        } else {
                            mainActivity.myApp.isconnect = false;
                            mainActivity.ReConnectDevice();
                            showBleStatusImg(false);
                            break;
                        }
                    case 3:
                        mainActivity.ShowMessage(R.string.yes);
                        break;
                    case 4:
                        KLog.d("bluetooth communication is ok.");
                        mainActivity.stopconnect = false;
                        mainActivity.myApp.isconnect = true;
                        mainActivity.reConnectSum = 0;
                        mainActivity.ProcessalarmInfo(R.string.wrong, 0, 0);
                        mainActivity.ProcessalarmInfo(R.string.Reconnect, 0, 0);
                        if (mainActivity.m_AddInvalidateDataThread != null) {
                            mainActivity.m_AddInvalidateDataThread.StopMyself();
                            mainActivity.m_AddInvalidateDataThread = null;
                        }
                        mainActivity.isStartBPJZ = false;
                        mainActivity.isStartBPLouqiCheck = false;
                        mainActivity.isStartBPSTAT = false;
                        mainActivity.btnConnect.setImageResource(R.drawable.bluetooth_connected);
                        mainActivity.SendALLPara();
                        mainActivity.GOTOStartTCPTread();
                        if (mainActivity.sendData != null && mainActivity.m_RetransDataProcess != null && mainActivity.m_RetransDataProcess.m_bConnected) {
                            mainActivity.sendData.SetMyTCPRun(true);
                        }
                        if (!mainActivity.myApp.isStartWalkTest) {
                            mainActivity.stopNibp();
                            mainActivity.startNibp(1000L);
                            mainActivity.myApp.isStartWalkTest = true;
                        }
                        mainActivity.remotedis.setText(mainActivity.getString(R.string.updata));
                        mainActivity.remotedisTextId = R.string.updata;
                        showBleStatusImg(true);
                        break;
                    case 5:
                        mainActivity.shownowtime.setText((String) message.obj);
                        break;
                    case 6:
                        mainActivity.btnStartNIBP.setBackgroundResource(R.drawable.nibp);
                        break;
                    case 7:
                        if (mainActivity.sendData != null) {
                            mainActivity.sendData.SetNowCommand(SendDataThread.DeviceState.StartBPJZ);
                            mainActivity.btnStartNIBP.setBackgroundResource(R.drawable.nibping);
                            break;
                        }
                        break;
                    case 8:
                        mainActivity.setLanguage();
                        mainActivity.checkTexts();
                        break;
                    case 9:
                        mainActivity.NIBPControl(true);
                        break;
                    case 10:
                        mainActivity.RefreshPatientInfo();
                        mainActivity.clearAllData();
                        break;
                    case 11:
                        mainActivity.m_AlarmPauseTime = MainActivity.gzj.getInt("AlarmPauseTime", 120);
                        break;
                    case 12:
                        mainActivity.NIBPControl(false);
                        break;
                    case 13:
                        if (mainActivity.sendData != null) {
                            mainActivity.sendData.SetNowCommand(SendDataThread.DeviceState.StartBPLQCheck);
                            mainActivity.btnStartNIBP.setBackgroundResource(R.drawable.nibping);
                            break;
                        }
                        break;
                    case 14:
                        mainActivity.m_currentAlarmVol = MainActivity.gzj.getFloat("AlarmCurrentVolume", 1.0f);
                        mainActivity.RefreshAlarmVol();
                        if (mainActivity.myApp.isconnect) {
                            if ((mainActivity.ifuploaddata == 1 || mainActivity.ifuploaddata == 3) && mainActivity.m_RetransDataProcess != null && mainActivity.m_RetransDataProcess.m_bConnected) {
                                mainActivity.myApp.OtherparaList.clear();
                                mainActivity.myApp.OtherparaList.add((byte) 16);
                                if (MainActivity.alarming) {
                                    mainActivity.myApp.OtherparaList.add(Byte.valueOf(ConstDefine.msg_RemoteOffLine));
                                } else {
                                    mainActivity.myApp.OtherparaList.add((byte) 16);
                                }
                                mainActivity.m_RetransDataProcess.paraList = mainActivity.myApp.OtherparaList;
                                mainActivity.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                                break;
                            }
                        }
                        break;
                    case 15:
                        break;
                    case 16:
                        mainActivity.RHOST = MainActivity.gzj.getString("serverip", "192.168.0.86");
                        mainActivity.TPORT = MainActivity.gzj.getInt("serverport", 9876);
                        mainActivity.ifuploaddata = MainActivity.gzj.getInt("ifuploaddata", 0);
                        mainActivity.RefreshPatientInfo();
                        break;
                    case 17:
                        mainActivity.ShowMessage(R.string.str_RemoteOffline);
                        break;
                    case 18:
                        mainActivity.ShowMessage(R.string.TimeisOver);
                        mainActivity.finish();
                        break;
                    case 19:
                        mainActivity.sendData.SetNowCommand(SendDataThread.DeviceState.ARRRelearn);
                        break;
                    case 20:
                        mainActivity.ShowMessage(R.string.ARRStudySuc);
                        break;
                    case 21:
                        if (mainActivity.ifuploaddata == 1 || mainActivity.ifuploaddata == 3) {
                            mainActivity.ProcessDeviceLogInResult(((Integer) message.obj).intValue());
                        }
                        if (mainActivity.ifuploaddata == 2) {
                            mainActivity.ProcessMontiorLogInResult(((Integer) message.obj).intValue());
                            break;
                        }
                        break;
                    case 22:
                        mainActivity.ReConnectToServer();
                        break;
                    case 23:
                        if (!mainActivity.stopconnect) {
                            mainActivity.remotedis.setText(mainActivity.getString(R.string.DevConnectServerError));
                            mainActivity.remotedisTextId = R.string.DevConnectServerError;
                            mainActivity.ReConnectToServer();
                            break;
                        }
                        break;
                    case 24:
                        mainActivity.ConnectToServer();
                        break;
                    case 25:
                        if (mainActivity.myApp.isconnect && mainActivity.ifuploaddata == 3 && mainActivity.sendData != null) {
                            AppGlobal appGlobal = mainActivity.myApp;
                            appGlobal.m_FunTypehigh = (byte) (appGlobal.m_FunTypehigh | 2);
                            mainActivity.sendData.m_FunTypehigh = mainActivity.myApp.m_FunTypehigh;
                            mainActivity.sendData.m_FunTypelow = mainActivity.myApp.m_FunTypelow;
                            mainActivity.sendData.SetNowCommand(SendDataThread.DeviceState.Start);
                            break;
                        }
                        break;
                    case 26:
                        if (mainActivity.myApp.isconnect && mainActivity.ifuploaddata == 3 && mainActivity.sendData != null) {
                            AppGlobal appGlobal2 = mainActivity.myApp;
                            appGlobal2.m_stopFunTypehigh = (byte) (appGlobal2.m_stopFunTypehigh | 2);
                            AppGlobal appGlobal3 = mainActivity.myApp;
                            appGlobal3.m_FunTypehigh = (byte) (appGlobal3.m_FunTypehigh & 253);
                            mainActivity.sendData.m_stopFunTypehigh = mainActivity.myApp.m_stopFunTypehigh;
                            mainActivity.sendData.m_stopFunTypelow = mainActivity.myApp.m_stopFunTypelow;
                            mainActivity.sendData.SetNowCommand(SendDataThread.DeviceState.Stop);
                            break;
                        }
                        break;
                    case 27:
                        if (mainActivity.ifuploaddata != 2) {
                            mainActivity.RefreshNetInfo(((Integer) message.obj).intValue());
                            break;
                        }
                        break;
                    default:
                        super.handleMessage(message);
                        break;
                }
            }
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        DisplayUtils.setDeviceDefaultDisplay(this);
        SharedPreferences sharedPreferences = getSharedPreferences("gzj", 0);
        gzj = sharedPreferences;
        sharedPreferences.edit().putInt("nibptest", 0).commit();
        this.mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable th) {
                new Thread() {
                    @Override
                    public void run() {
                        Looper.prepare();
                        MainActivity.this.ShowMessage(R.string.exception);
                        Looper.loop();
                    }
                }.start();
                MainActivity.this.HandleuncaughtException(thread, th);
                MainActivity.this.mDefaultHandler.uncaughtException(thread, th);
                MainActivity.this.GotoSleep(PathInterpolatorCompat.MAX_NUM_POINTS);
                MainActivity.this.onDestroy();
                MainActivity.this.finish();
                Process.killProcess(Process.myPid());
            }
        });
        OrientationEventListener orientationEventListener = new OrientationEventListener(this) {
            @Override
            public void onOrientationChanged(int i) {
                MainActivity mainActivity = MainActivity.this;
                mainActivity.res = mainActivity.getResources();
                MainActivity.this.setLanguage();
            }
        };
        this.mOrientationListener = orientationEventListener;
        orientationEventListener.enable();
        setRequestedOrientation(6);
        AppGlobal appGlobal = AppGlobal.getInstance();
        this.myApp = appGlobal;
        appGlobal.setSystemBarVisible(this, false);
        this.myApp.lStartTime = System.currentTimeMillis();
        getWindow().addFlags(1024);
        setContentView(R.layout.splash);
        ((ImageView) findViewById(R.id.bootanim)).setBackgroundResource(R.anim.bootanimation);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        ConstDefine.widthDip = displayMetrics.widthPixels;
        ConstDefine.heightDip = displayMetrics.heightPixels;
        this.res = getResources();
        this.mRegisteredSensor = false;
        this.mSensorManager = (SensorManager) getSystemService("sensor");
        this.TechAlarmList = new AlarmList();
        this.ParaAlarmList = new AlarmList();
        this.HRSCAlarmList = new AlarmList();
        instance = this;
        initSoundPool();
        setLanguage();
        clearSys();
        init();
        initInputBp();
        this.isTiming = false;
        if (this.myApp.isconnect) {
            stopNibp();
            startNibp(1000L);
            this.myApp.isStartWalkTest = true;
            this.remotedis.setText(getString(R.string.updata));
            this.remotedisTextId = R.string.updata;
        } else {
            this.remotedis.setText(getString(R.string.Readyforupload));
            this.remotedisTextId = R.string.Readyforupload;
            searchBluetooth();
        }
        KLog.d("welcome to 6min walk test.");
    }

    public void init() {
        DisplayUtils.setDeviceDefaultDisplay(this);
        setContentView(R.layout.main);
        if (AppGlobal.getInstance().currentPatient == null) {
            ToastUtils.showMessage(this, R.string.please_select_patient);
            finish();
            return;
        }
        this.myViewGroupleft = (MyViewGroup) findViewById(R.id.viewgroupchannel);
        this.myViewGroupleft.addView(LayoutInflater.from(this).inflate(R.layout.wavechannel, (ViewGroup) null));
        this.myViewGroupleft.addView(LayoutInflater.from(this).inflate(R.layout.ecgchannel, (ViewGroup) null));
        this.myViewGroupright = (MyViewGroupHorizontal) findViewById(R.id.viewflipperpara);
        this.myViewGroupright.addView(LayoutInflater.from(this).inflate(R.layout.bigpara, (ViewGroup) null));
        this.nAllchannelHeight = (int) this.res.getDimension(R.dimen.AllChannelHeight);
        this.nChannelWide = (int) this.res.getDimension(R.dimen.channel_width);
        int dimension = (int) this.res.getDimension(R.dimen.Grid_width);
        this.nParaWide = dimension;
        this.nowwidth = dimension;
        this.nECGcolor = this.res.getColor(R.color.ECGclor);
        this.nSpo2color = this.res.getColor(R.color.SPo2clor);
        this.nRespcolor = this.res.getColor(R.color.Respclor);
        this.nTempcolor = this.res.getColor(R.color.Nibpclor);
        InitManyECGChannel();
        InitWaveChannel();
        this.myLayout = (FrameLayout) findViewById(R.id.mainface);
        this.fontFace = Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf");
        FontManager.changeFonts((ViewGroup) getWindow().getDecorView(), this, this.fontFace);
        TextView textView = (TextView) findViewById(R.id.alarm_zone);
        this.TechAlarm_zone = textView;
        textView.getPaint().setFakeBoldText(true);
        this.ParaAlarm_zone = (TextView) findViewById(R.id.Paraalarm_zone);
        ImageView imageView = (ImageView) findViewById(R.id.imageViewTechalarm);
        this.TechalarmImage = imageView;
        imageView.setVisibility(4);
        this.ParaAlarm_zone.getPaint().setFakeBoldText(true);
        this.Deviceno = (TextView) findViewById(R.id.Deviceno);
        this.shownowtime = (TextView) findViewById(R.id.Times);
        this.ivBTPowerImage = (ImageView) findViewById(R.id.BTPowerImage);
        this.iv_ble_status = (ImageView) findViewById(R.id.iv_ble_status);
        this.txPatientType = (TextView) findViewById(R.id.PatientType);
        this.txBedno = (TextView) findViewById(R.id.bedno);
        this.remotedis = (TextView) findViewById(R.id.Remoteinfo);
        Button button = (Button) findViewById(R.id.menu);
        this.btnFunSetting = button;
        button.setOnClickListener(this);
        ImageView imageView2 = (ImageView) findViewById(R.id.connect);
        this.btnConnect = imageView2;
        imageView2.setOnClickListener(this);
        Button button2 = (Button) findViewById(R.id.login);
        this.btnLogin = button2;
        button2.setOnClickListener(this);
        Button button3 = (Button) findViewById(R.id.logout);
        this.btnLogout = button3;
        button3.setOnClickListener(this);
        Button button4 = (Button) findViewById(R.id.print);
        this.btnPrint = button4;
        button4.setOnClickListener(this);
        Button button5 = (Button) findViewById(R.id.startBP);
        this.btnStartNIBP = button5;
        button5.setOnClickListener(this);
        Button button6 = (Button) findViewById(R.id.mute);
        this.btnMute = button6;
        button6.setOnClickListener(this);
        TextView textView2 = (TextView) findViewById(R.id.mutetime);
        this.txMuteTime = textView2;
        textView2.getPaint().setFakeBoldText(true);
        this.txMuteTime.setText("");
        this.timerTv = (TextView) findViewById(R.id.timer_tv);
        TextView textView3 = (TextView) findViewById(R.id.nibpPP);
        this.m_txnibp = textView3;
        textView3.setTypeface(this.fontFace);
        this.m_txnibp.getPaint().setFakeBoldText(true);
        this.m_txnibp.setText("");
        TextView textView4 = (TextView) findViewById(R.id.nibpmap);
        this.m_txnibpmap = textView4;
        textView4.setTypeface(this.fontFace);
        this.m_txnibpmap.getPaint().setFakeBoldText(true);
        this.m_txnibpmap.setText("");
        TextView textView5 = (TextView) findViewById(R.id.stop_bp);
        this.m_txnibpStop = textView5;
        textView5.setTypeface(this.fontFace);
        this.m_txnibpStop.getPaint().setFakeBoldText(true);
        this.m_txnibpStop.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.m216lambda$init$0$cnneoprintpadmonitoruiMainActivity(view);
            }
        });
        TextView textView6 = (TextView) findViewById(R.id.start_bp);
        this.m_txnibpStart = textView6;
        textView6.setTypeface(this.fontFace);
        this.m_txnibpStart.getPaint().setFakeBoldText(true);
        this.m_txnibpStart.setOnClickListener(this);
        TextView textView7 = (TextView) findViewById(R.id.manual_input_bp);
        this.m_txnibpManualInput = textView7;
        textView7.setTypeface(this.fontFace);
        this.m_txnibpManualInput.getPaint().setFakeBoldText(true);
        this.m_txnibpManualInput.setOnClickListener(this);
        this.m_txnibpManualInput.setVisibility(8);
        TextView textView8 = (TextView) findViewById(R.id.nibpTestItem);
        this.m_txnibpItem = textView8;
        textView8.setTypeface(this.fontFace);
        this.m_txnibpItem.getPaint().setFakeBoldText(true);
        TextView textView9 = (TextView) findViewById(R.id.nibpdicription);
        this.m_txnibpDiscription = textView9;
        textView9.setTypeface(this.fontFace);
        this.m_txnibpDiscription.getPaint().setFakeBoldText(true);
        this.m_bpBar = (ProgressBar) findViewById(R.id.nibpprogress);
        Button button7 = (Button) findViewById(R.id.btn_emergency_stop);
        this.btnEmergencyStop = button7;
        button7.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.m217lambda$init$1$cnneoprintpadmonitoruiMainActivity(view);
            }
        });
        ((RelativeLayout) findViewById(R.id.rl_emergency_stop)).setVisibility(GzjSharePref.getBoolValue(this, GzjSharePref.KEY_ENABLE_EMERGENCY_STOP) ? 0 : 8);
        initViewGroup();
        initViewFillper();
        RefreshNowChannelWidth();
        this.mGestureDetector = new GestureDetector(null, this, null);
        this.myLayout.setBackgroundDrawable(this.nBackAll);
        this.audioManager = (AudioManager) getSystemService("audio");
        getExtremeValue();
        PowerManager powerManager = (PowerManager) getSystemService("power");
        this.powerManager = powerManager;
        PowerManager.WakeLock newWakeLock = powerManager.newWakeLock(26, "My Lock");
        this.wakeLock = newWakeLock;
        newWakeLock.acquire();
        this.myApp.isconnect = false;
        this.myApp.isStartWalkTest = false;
        this.isfrozen = false;
        this.isstart = true;
        isalarm = false;
        alarming = false;
        this.m_alarmVolumelevel = -1;
        this.m_nPatientType = gzj.getInt("PatientType", 0);
        this.RHOST = gzj.getString("serverip", "192.168.0.86");
        this.TPORT = gzj.getInt("serverport", 9876);
        this.ifuploaddata = gzj.getInt("ifuploaddata", 0);
        checkTexts();
        this.m_JGTime = 0;
        this.issys = false;
        this.isdia = false;
        this.isspo2 = false;
        this.isresp = false;
        this.istemp = false;
        SendDataThread.handler = this.handler;
        ShowTimeThread.handler = this.handler;
        RecvDataProcess.handler = this.handler;
        if (this.nShowTime == null) {
            ShowTimeThread showTimeThread = new ShowTimeThread(this);
            this.nShowTime = showTimeThread;
            showTimeThread.start();
        }
        if (this.m_RecvDataProcess == null) {
            RecvDataProcess recvDataProcess = new RecvDataProcess(this);
            this.m_RecvDataProcess = recvDataProcess;
            recvDataProcess.start();
        }
        if (this.mTCPDataSend == null) {
            TCPDataSend tCPDataSend = new TCPDataSend(this);
            this.mTCPDataSend = tCPDataSend;
            tCPDataSend.start();
        }
        if (this.m_DrawLineThread == null) {
            DrawLineThread drawLineThread = new DrawLineThread(this);
            this.m_DrawLineThread = drawLineThread;
            drawLineThread.start();
        }
        if (this.m_StreamDataSaveThread == null) {
            StreamDataSaveThread streamDataSaveThread = new StreamDataSaveThread(this);
            this.m_StreamDataSaveThread = streamDataSaveThread;
            streamDataSaveThread.start();
        }
        if (this.m_WaveDataSaveThread == null) {
            WaveDataSaveThread waveDataSaveThread = new WaveDataSaveThread(this);
            this.m_WaveDataSaveThread = waveDataSaveThread;
            waveDataSaveThread.start();
        }
        if (this.m_AlarmShowThread == null) {
            AlarmShowThread alarmShowThread = new AlarmShowThread(this);
            this.m_AlarmShowThread = alarmShowThread;
            alarmShowThread.start();
        }
        Menu.m_handler = this.handler;
        NIBPTestting.m_handler = this.handler;
        ECGParaSettingActivity.m_handler = this.handler;
        monitorBatteryState();
        if (this.ifuploaddata == 2) {
            this.remotedis.setText(R.string.DatasrcServer);
            this.remotedisTextId = R.string.DatasrcServer;
            startActivityForResult(new Intent(this, (Class<?>) VerificationCode.class), 25);
        }
        new AsyncTask<Void, Void, Integer>() {
            @Override
            public void onPostExecute(Integer num) {
            }

            @Override
            public Integer doInBackground(Void... voidArr) {
                return 0;
            }
        }.execute(new Void[0]);
        LoginOutAndRefreshFace();
        ((TextView) findViewById(R.id.name_tv)).setText(String.format("%s: %s", getString(R.string.name), AppGlobal.getInstance().currentPatient.getName()));
        ((TextView) findViewById(R.id.tv_age)).setText(String.format("%s: %s", getString(R.string.age), Integer.valueOf(DateUtils.yearsSpan1(AppGlobal.getInstance().currentPatient.getBirth().longValue(), System.currentTimeMillis()))));
        ((TextView) findViewById(R.id.gender_tv)).setText(String.format("%s: %s", getString(R.string.gender), AppGlobal.getInstance().currentPatient.getGender()));
        ((TextView) findViewById(R.id.height_tv)).setText(String.format("%s %s", getString(R.string.height_), Double.valueOf(AppGlobal.getInstance().currentPatient.getHeight())));
        ((TextView) findViewById(R.id.weight_tv)).setText(String.format("%s %s", getString(R.string.weight_), Double.valueOf(AppGlobal.getInstance().currentPatient.getWeight())));
        this.mBleFragment = BleFragment.newInstance(true);
        FragmentTransaction beginTransaction = getSupportFragmentManager().beginTransaction();
        beginTransaction.replace(R.id.step_counting_container, this.mBleFragment);
        beginTransaction.commit();
        new MainTestPresenter().setRunTestQRCodeToImagView((ImageView) findViewById(R.id.iv_motion_qr_code), this);
        AppGlobal.readerClient.setCircleListener(new ReaderClientUtils.CircleListener() {
            @Override
            public final void listener() {
                MainActivity.lambda$init$2();
            }
        });
    }

    public void m216lambda$init$0$cnneoprintpadmonitoruiMainActivity(View view) {
        stopNibp();
    }

    public void m217lambda$init$1$cnneoprintpadmonitoruiMainActivity(View view) {
        stopNibp();
    }

    public void startWalkTestTimer() {
        if (AppGlobal.isAutoBp) {
            boolean z = false;
            for (int i = 0; i < this.ParaAlarmList.GetAlarmListNum(); i++) {
                AlarmData GetAlarmDataById = this.ParaAlarmList.GetAlarmDataById(i);
                if (GetAlarmDataById != null && (GetAlarmDataById.textId == 2131887150 || GetAlarmDataById.textId == 2131887149 || GetAlarmDataById.textId == 2131886469 || GetAlarmDataById.textId == 2131886468)) {
                    z = true;
                    break;
                }
            }
            if (z) {
                KLog.d("nibp is alarm, show dialog for user choose");
                DialogUtils.showTimerDialog(this, getString(R.string.dialog_02), getString(R.string.notice_nibp_result), getString(R.string.retest_nibp), getString(R.string.still_continue), new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        MainActivity.this.m222x52f51921(dialogInterface, i2);
                    }
                }, new DialogInterface.OnClickListener() {
                    @Override
                    public final void onClick(DialogInterface dialogInterface, int i2) {
                        MainActivity.this.m223xaa130a00(dialogInterface, i2);
                    }
                }, 30000L);
            } else {
                checkSensorStatus();
            }
        }
    }

    public void m222x52f51921(DialogInterface dialogInterface, int i) {
        startNibp();
    }

    public void m223xaa130a00(DialogInterface dialogInterface, int i) {
        if (this.isTiming) {
            KLog.d("walk test timer has been started");
        } else {
            checkSensorStatus();
        }
    }

    public void checkSensorStatus() {
        int i = AppGlobal.getInstance().sensor_device_type;
        if (this.mBleFragment.circleCounterMode == 1) {
            this.timer.start();
            return;
        }
        this.mBleFragment.refreshStatusView1(AppGlobal.readerClient.isClient);
        if ((i == 1 && this.mBleFragment.getSensorTriggerStatus() != 0) || (i == 2 && !AppGlobal.readerClient.isClient)) {
            KLog.e("sensor status error.");
            DialogUtils.showDialog(this, getString(R.string.dialog_notice), getString(R.string.notice_check_sensor_status), getString(R.string.modify_sensor), getString(R.string.exit_test), new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    MainActivity.this.m214x684da0d(dialogInterface, i2);
                }
            }, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i2) {
                    MainActivity.this.m215x5da2caec(dialogInterface, i2);
                }
            });
        } else {
            this.timer.start();
            KLog.d("walk test timer start");
        }
    }

    public void m214x684da0d(DialogInterface dialogInterface, int i) {
        this.timerTv.postDelayed(new Runnable() {
            @Override
            public void run() {
                MainActivity.this.checkSensorStatus();
            }
        }, 1000L);
    }

    public void m215x5da2caec(DialogInterface dialogInterface, int i) {
        this.stopconnect = true;
        KLog.d("user cancel walk test");
        finish();
    }

    class CountDownTimerHandler extends Handler {
        private long lastMills = 0;
        private long mCountdownInterval;
        private long mMillisInFuture;

        public void onFinish() {
        }

        public void onTick(long j) {
        }

        CountDownTimerHandler(long j, long j2) {
            this.mMillisInFuture = j;
            this.mCountdownInterval = j2;
        }

        public void start() {
            sendMessage(obtainMessage());
        }

        @Override
        public void handleMessage(Message message) {
            boolean z;
            super.handleMessage(message);
            long j = this.mMillisInFuture;
            if (j > 0) {
                onTick(j);
                z = true;
            } else {
                z = false;
            }
            if (z) {
                this.mMillisInFuture--;
                long j2 = this.mCountdownInterval;
                long currentTimeMillis = System.currentTimeMillis();
                long j3 = this.lastMills;
                if (j3 != 0) {
                    j2 -= currentTimeMillis - j3;
                    this.lastMills = j3 + this.mCountdownInterval;
                } else {
                    this.lastMills = currentTimeMillis + this.mCountdownInterval;
                }
                sendMessageDelayed(obtainMessage(), j2);
                return;
            }
            onFinish();
        }
    }

    class AnonymousClass7 extends CountDownTimerHandler {
        AnonymousClass7(long j, long j2) {
            super(j, j2);
        }

        @Override
        public void onTick(long j) {
            int i = AppGlobal.getInstance().sensor_device_type;
            MainActivity.this.isTiming = true;
            MainActivity.this.sensorTimeCounter = j;
            MainActivity.this.updateTimerView(j);
            MainActivity.this.flashTimerView(j);
            if (j <= 420 && j >= 60) {
                long j2 = j % 60;
                if (j2 != 0 && j % 10 == 0) {
                    MainActivity.this.mBleFragment.syncDataCmd();
                }
                if (j <= 360 && j2 == 51) {
                    MainActivity.this.addStepCountList();
                }
            }
            if (j == 479) {
                MainActivity.this.playNoticeSound(1);
                KLog.d("play start to stay1 notice sound");
                MainActivity.this.m_txnibpStart.setVisibility(4);
                MainActivity.this.btnEmergencyStop.setBackground(MainActivity.this.getDrawable(R.drawable.selector_red_btn));
                MainActivity.this.btnEmergencyStop.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        MainActivity.AnonymousClass7.this.m224lambda$onTick$0$cnneoprintpadmonitoruiMainActivity$7(view);
                    }
                });
                MainActivity.this.mBleFragment.mStatusTv3.setText(R.string.waiting_count_step);
                MainActivity.this.mBleFragment.mSensorStatusTv2.setText(R.string.stay_start);
                MainActivity.this.mBleFragment.btnManualCircleCount.setEnabled(false);
            }
            if ((j == 470 || j == 460) && !MainActivity.this.getString(R.string.bt_connected).equals(MainActivity.this.mBleFragment.mStatusTv.getText().toString())) {
                MainActivity.this.mBleFragment.connectBleDevice();
            }
            if (j == 450) {
                MainActivity.this.mBleFragment.clearManualTriggerStatus();
                if (!MainActivity.this.getString(R.string.bt_connected).equals(MainActivity.this.mBleFragment.mStatusTv.getText().toString()) && MainActivity.this.mBleFragment.getSensorTriggerStatus() != 0 && (i == 1 || i == 2)) {
                    MainActivity.this.mBleFragment.refreshStatusView1(AppGlobal.readerClient.isClient);
                    Intent intent = new Intent();
                    Bundle bundle = new Bundle();
                    bundle.putInt("popuptextview", R.string.dialog_title_sensor_error);
                    bundle.putBoolean("onlyconfirm", false);
                    intent.putExtras(bundle);
                    intent.setClass(MainActivity.this, PopUpDialogActivity.class);
                    MainActivity.this.startActivityForResult(intent, 15);
                }
            }
            if (j == 420) {
                MainActivity.this.playNoticeSound(2);
                KLog.d("play start to walk notice sound");
                MainActivity.this.mBleFragment.isStartCount = true;
                MainActivity.this.mBleFragment.mStatusTv3.setText(R.string.is_counting_step);
                MainActivity.this.mBleFragment.sensorCircle = 0;
                if (MainActivity.this.mBleFragment.circleCounterMode == 0) {
                    AppGlobal.readerClient.readCard(false);
                }
                MainActivity.this.timer50ms.schedule(MainActivity.this.task50ms, 100L, 50L);
                MainActivity.this.mBleFragment.mSensorStatusTv2.setText(R.string.counting_circle);
                MainActivity.this.mBleFragment.btnManualCircleCount.setEnabled(true);
                MainActivity.this.mBleFragment.clearManualTriggerStatus();
            }
            if (j == 360) {
                MainActivity.this.playNoticeSound(4);
            }
            if (j == 300) {
                MainActivity.this.playNoticeSound(5);
            }
            if (j == 240) {
                MainActivity.this.playNoticeSound(6);
            }
            if (j == 180) {
                MainActivity.this.playNoticeSound(7);
            }
            if (j == 120) {
                MainActivity.this.playNoticeSound(8);
            }
            if (j == 75) {
                MainActivity.this.playNoticeSound(9);
            }
            if (j == 60) {
                MainActivity mainActivity = MainActivity.this;
                mainActivity.mmhg = (TextView) mainActivity.myViewGroupright.getChildAt(0).findViewById(R.id.after_nibp_high);
                MainActivity mainActivity2 = MainActivity.this;
                mainActivity2.mmhgLayout = (RelativeLayout) mainActivity2.myViewGroupright.getChildAt(0).findViewById(R.id.after_nibp_layout);
                MainActivity mainActivity3 = MainActivity.this;
                mainActivity3.map = (TextView) mainActivity3.myViewGroupright.getChildAt(0).findViewById(R.id.after_nibp_low);
                MainActivity.this.playNoticeSound(3);
                KLog.d("play start to stay2 notice sound");
                MainActivity.this.mBleFragment.mStatusTv3.setText(R.string.waiting_count_step);
                MainActivity.this.mBleFragment.btnManualCircleCount.setEnabled(false);
            }
            if (j == 55) {
                MainActivity.this.startNibp();
                MainActivity.this.m_txnibpStart.setVisibility(AppGlobal.isAutoBp ? 0 : 4);
                MainActivity.this.btnEmergencyStop.setBackground(MainActivity.this.getDrawable(R.drawable.selector_red_btn));
                MainActivity.this.btnEmergencyStop.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        MainActivity.AnonymousClass7.this.m225lambda$onTick$1$cnneoprintpadmonitoruiMainActivity$7(view);
                    }
                });
            }
        }

        public void m224lambda$onTick$0$cnneoprintpadmonitoruiMainActivity$7(View view) {
            EmergencyStopPopupWindow emergencyStopPopupWindow = new EmergencyStopPopupWindow(MainActivity.this, new EmergencyStopPopupWindow.EmergencyStopBackListener() {
                @Override
                public void onBack() {
                    KLog.i("Cancel emergency stop.");
                }

                @Override
                public void onConfirm(String str) {
                    KLog.i("Emergency stop in timeCounter=" + MainActivity.this.sensorTimeCounter + ", cause of: " + str);
                    MainActivity.this.currentTime = System.currentTimeMillis();
                    MainActivity.this.calculateSensorDistance((int) MainActivity.this.sensorTimeCounter);
                    AppGlobal.readerClient.close();
                    MainActivity.this.startWalkTestReportActivity(false, str, (int) MainActivity.this.sensorTimeCounter);
                }
            });
            emergencyStopPopupWindow.setOutSideDismiss(false);
            emergencyStopPopupWindow.setBackPressEnable(false);
            emergencyStopPopupWindow.showPopupWindow();
        }

        public void m225lambda$onTick$1$cnneoprintpadmonitoruiMainActivity$7(View view) {
            KLog.i("Emergency stop in timeCounter=" + MainActivity.this.sensorTimeCounter);
            MainActivity.this.currentTime = System.currentTimeMillis();
            MainActivity.this.stopNibp();
            MainActivity mainActivity = MainActivity.this;
            mainActivity.calculateSensorDistance((int) mainActivity.sensorTimeCounter);
            AppGlobal.readerClient.close();
            MainActivity mainActivity2 = MainActivity.this;
            mainActivity2.startWalkTestReportActivity(false, mainActivity2.getString(R.string.after_walk_emergency), (int) MainActivity.this.sensorTimeCounter);
        }

        @Override
        public void onFinish() {
            MainActivity.this.isTiming = false;
            MainActivity.this.timerTv.setText(R.string.time_up);
            MainActivity.this.currentTime = System.currentTimeMillis();
            KLog.d("walk test timer is finish.");
            MainActivity.this.mBleFragment.isStartCount = false;
            MainActivity.this.addStepCountList();
            MainActivity.this.myApp.isStartWalkTest = false;
            if (AppGlobal.isAutoBp && (MainActivity.this.mmhg.getText().equals("---") || MainActivity.this.mmhg.getText().equals(MainActivity.this.getString(R.string.NIBPFAil)))) {
                KLog.w("运动后测量nibp失败!");
                MainActivity.this.m_txnibpManualInput.setVisibility(0);
            } else {
                MainActivity.this.startWalkTestReportActivity(false, "", 0);
            }
            AppGlobal.readerClient.close();
        }
    }

    private void logToFile(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        Intent intent = getIntent();
        FileUtils.contentToFile(str, ConstDefine.SD_PATH + "/WalkTest/Logs", intent.getStringExtra("name") + "_" + intent.getStringExtra("patient_idcard") + "_" + DateUtils.long2TimeMillisStr(System.currentTimeMillis()) + ".log");
    }

    private void initInputBp() {
        findViewById(R.id.before_nibp_high).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.m218lambda$initInputBp$7$cnneoprintpadmonitoruiMainActivity(view);
            }
        });
        findViewById(R.id.before_nibp_high_unit).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.m219lambda$initInputBp$8$cnneoprintpadmonitoruiMainActivity(view);
            }
        });
        findViewById(R.id.after_nibp_value_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MainActivity.this.m220lambda$initInputBp$9$cnneoprintpadmonitoruiMainActivity(view);
            }
        });
        if (AppGlobal.isAutoBp) {
            return;
        }
        findViewById(R.id.start_bp).setVisibility(4);
        findViewById(R.id.before_nibp_low).setVisibility(4);
        findViewById(R.id.before_nibp_low_unit).setVisibility(4);
        findViewById(R.id.after_nibp_low).setVisibility(4);
        findViewById(R.id.after_nibp_low_unit).setVisibility(4);
    }

    public void m218lambda$initInputBp$7$cnneoprintpadmonitoruiMainActivity(View view) {
        showInputBp(R.id.before_nibp_high);
    }

    public void m219lambda$initInputBp$8$cnneoprintpadmonitoruiMainActivity(View view) {
        showInputBp(R.id.before_nibp_high_unit);
    }

    public void m220lambda$initInputBp$9$cnneoprintpadmonitoruiMainActivity(View view) {
        showInputBp(R.id.after_nibp_value_layout);
    }

    private void showInputBp(final int i) {
        if (AppGlobal.isAutoBp) {
            return;
        }
        View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_blood_pressure_edit_text, (ViewGroup) null);
        final EditText editText = (EditText) inflate.findViewById(R.id.et_bp1);
        final EditText editText2 = (EditText) inflate.findViewById(R.id.et_bp2);
        InputFilter[] inputFilterArr = {new InputFilter.LengthFilter(3)};
        editText.setInputType(2);
        editText.setFilters(inputFilterArr);
        editText2.setInputType(2);
        editText2.setFilters(inputFilterArr);
        DialogUtils.showEditTextDialog(this, getString(R.string.dialog_02), getString(R.string.input_nibp_value), getString(R.string.confirm), getString(R.string.cancel), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                MainActivity.this.m221lambda$showInputBp$10$cnneoprintpadmonitoruiMainActivity(editText, editText2, i, dialogInterface, i2);
            }
        }, null, inflate);
    }

    public void m221lambda$showInputBp$10$cnneoprintpadmonitoruiMainActivity(EditText editText, EditText editText2, int i, DialogInterface dialogInterface, int i2) {
        dialogInterface.dismiss();
        String obj = editText.getText().toString();
        String obj2 = editText2.getText().toString();
        if (TextUtils.isEmpty(obj) || TextUtils.isEmpty(obj2)) {
            ToastUtils.showMessage(getString(R.string.input_nibp_value));
            return;
        }
        if (i == 2131362187 || i == 2131362188) {
            ((TextView) findViewById(R.id.before_nibp_high)).setText(obj + "/" + obj2);
            checkSensorStatus();
        } else if (i == 2131362148) {
            ((TextView) findViewById(R.id.after_nibp_high)).setText(obj + "/" + obj2);
            this.currentTime = System.currentTimeMillis();
            if (this.sensorTimeCounter <= 0) {
                startWalkTestReportActivity(true, "", 0);
            }
        }
    }

    public void addStepCountList() {
        int parseInt = Integer.parseInt(this.mBleFragment.mStepTv.getText().toString());
        if (this.stepCountList.isEmpty()) {
            this.stepCountList.add(Integer.valueOf(parseInt));
        } else {
            this.stepCountList.add(Integer.valueOf(parseInt - this.lastMinStepCount));
        }
        this.lastMinStepCount = parseInt;
    }

    public void sensorTimerView() {
        long j = this.sensorTimeCounter;
        if (j == 420) {
            this.sensorCounterLastSec = j;
            this.lastMinLeftDistance = this.mBleFragment.getSensorPosition();
            return;
        }
        if (j >= 420 || j < 60) {
            return;
        }
        checkValidSensorTrigger();
        long j2 = this.sensorTimeCounter;
        if (j2 >= this.sensorCounterLastSec) {
            return;
        }
        int i = ((int) j2) / 60;
        int i2 = ((int) j2) % 60;
        this.sensorCounterLastSec = j2;
        if (i2 == 0) {
            this.sensorCircleCountList.add(Integer.valueOf(this.mBleFragment.sensorCircle - this.lastMinCircleCount));
            this.lastMinCircleCount = this.mBleFragment.sensorCircle;
            long j3 = this.mBleFragment.sensorSparkTime;
            long j4 = this.sensorTimeCounter;
            if (j3 > j4 + 60) {
                this.mBleFragment.sensorSparkTime = (int) (j4 + 60);
            }
            this.sensorAfterTriggerTimeList.add(Integer.valueOf(this.mBleFragment.sensorSparkTime - ((int) this.sensorTimeCounter)));
            KLog.d("No." + i + " minute sensorCircleCountList: " + this.sensorCircleCountList + ", lastMinCircleCount: " + this.lastMinCircleCount + ", sensorAfterTriggerTimeList: " + this.sensorAfterTriggerTimeList);
        }
        if (this.sensorTimeCounter == 60) {
            if (this.mBleFragment.getSensorTriggerStatus() == 0) {
                calculateSensorDistance(60);
            } else {
                KLog.i("sensor status is error.");
                calculateSensorDistance(60);
            }
            KLog.i("总步行距离: " + this.sensorDistanceList + ", 推车距起点距离: " + this.mBleFragment.getSensorPosition() + ", 单趟行程: " + this.mBleFragment.getSensorDistance());
            this.mBleFragment.mSensorStatusTv2.setText(R.string.complete_walk);
            Timer timer = this.timer50ms;
            if (timer != null) {
                timer.cancel();
            }
            this.mBleFragment.mStatusTv3.setText("");
        }
    }

    public void calculateSensorDistance(int i) {
        int i2 = 420 - i;
        int i3 = 6;
        Float valueOf = Float.valueOf(0.0f);
        int i4 = 1;
        if (i2 < 0) {
            this.sensorDistanceList = Arrays.asList(valueOf, valueOf, valueOf, valueOf, valueOf, valueOf);
            KLog.d("haven't walk at all!");
            return;
        }
        float sensorPosition = this.mBleFragment.sensorSparkTime != 420 ? (this.mBleFragment.getSensorPosition() + ((this.mBleFragment.sensorCircle - 1) * this.mBleFragment.getSensorDistance())) / (TypedValues.CycleType.TYPE_EASING - this.mBleFragment.sensorSparkTime) : 2.0f;
        int i5 = 0;
        while (i5 < i3) {
            if (i5 < this.sensorCircleCountList.size()) {
                if (this.sensorCircleCountList.get(i5).intValue() > 0) {
                    float intValue = ((this.sensorCircleCountList.get(i5).intValue() - i4) * this.mBleFragment.getSensorDistance()) + this.lastMinLeftDistance;
                    float intValue2 = this.sensorAfterTriggerTimeList.get(i5).intValue() * sensorPosition;
                    if (intValue2 > this.mBleFragment.getSensorDistance()) {
                        intValue2 = this.mBleFragment.getSensorDistance();
                    }
                    float f = intValue + intValue2;
                    this.sensorDistanceList.add(Float.valueOf(f));
                    this.lastMinLeftDistance = this.mBleFragment.getSensorDistance() - intValue2;
                    KLog.d("No." + (i5 + 1) + " minute afterTriggerTime: " + this.sensorAfterTriggerTimeList.get(i5) + ", beforeTriggerDistance: " + intValue + ", speed: " + sensorPosition + ", afterTriggerDistance: " + intValue2 + ", result distance: " + f + ", lastMinLeftDistance: " + this.lastMinLeftDistance);
                } else {
                    this.sensorDistanceList.add(Float.valueOf(this.mBleFragment.getSensorDistance()));
                    this.lastMinLeftDistance = 0.0f;
                    KLog.d("No." + (i5 + 1) + " minute haven't trigger sensor!");
                }
            } else if (i5 == this.sensorCircleCountList.size()) {
                if (this.mBleFragment.sensorCircle - this.lastMinCircleCount == 0 && i5 == 0) {
                    this.sensorDistanceList.add(Float.valueOf(this.lastMinLeftDistance));
                    KLog.d("No." + (i5 + 1) + " minute can't complete! lastMinLeftDistance: " + this.lastMinLeftDistance);
                } else {
                    float max = (Math.max(r3 - 1, 0) * this.mBleFragment.getSensorDistance()) + this.lastMinLeftDistance;
                    float f2 = (this.mBleFragment.sensorSparkTime - i2) * sensorPosition;
                    if (f2 > this.mBleFragment.getSensorDistance()) {
                        f2 = this.mBleFragment.getSensorDistance();
                    }
                    float f3 = max + f2;
                    this.sensorDistanceList.add(Float.valueOf(f3));
                    KLog.d("No." + (i5 + 1) + " minute beforeTriggerDistance: " + max + ", speed: " + sensorPosition + ", afterTriggerDistance: " + f2 + ", result distance: " + f3);
                }
            } else if (i5 > this.sensorCircleCountList.size()) {
                this.sensorDistanceList.add(valueOf);
                KLog.d("No." + (i5 + 1) + " minute can't complete!");
            }
            i5++;
            i3 = 6;
            i4 = 1;
        }
    }

    private void checkValidSensorTrigger() {
        if (this.mBleFragment.sensorSparkTime - this.sensorTimeCounter >= 3) {
            if (this.mBleFragment.circleCounterMode == 1 || this.mBleFragment.sensorDeviceType == 1) {
                int[] iArr = this.sensormonitor;
                iArr[3] = iArr[2];
                iArr[2] = iArr[1];
                iArr[1] = iArr[0];
                iArr[0] = this.mBleFragment.getSensorTriggerStatus();
                int[] iArr2 = this.sensormonitor;
                if (iArr2[3] == 1 && iArr2[2] == 1 && iArr2[1] == 0 && iArr2[0] == 0) {
                    this.mBleFragment.sensorSparkTime = (int) this.sensorTimeCounter;
                    this.mBleFragment.sensorCircle++;
                    this.mBleFragment.mSensorStepTv.setText(String.valueOf(this.mBleFragment.sensorCircle));
                    Arrays.fill(this.sensormonitor, 0);
                    return;
                }
                return;
            }
            this.mBleFragment.sensorCircle = AppGlobal.readerClient.number;
            this.mBleFragment.mSensorStepTv.setText(String.valueOf(this.mBleFragment.sensorCircle));
            return;
        }
        this.mBleFragment.clearManualTriggerStatus();
    }

    private void showPopupWindow(int i, String str, String str2, int i2) {
        if (this.showDialogFlag) {
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("requestCode", i2);
        Bundle bundle = new Bundle();
        bundle.putInt("popuptextview", i);
        bundle.putString("yes", str);
        bundle.putString(SharePreferenceConstant.DEFAULT_VALUE_USER_SN, str2);
        intent.putExtras(bundle);
        intent.setClass(this, PopUpDialogActivity.class);
        startActivityForResult(intent, i2);
        this.showDialogFlag = true;
    }

    public void updateTimerView(long j) {
        String string;
        String str;
        String string2;
        int i = (int) (j / 60);
        int i2 = (int) (j % 60);
        String str2 = i2 != 0 ? i2 + getString(R.string.second_unit) : "";
        if (j > 420) {
            string = getString(R.string.timer_stay);
            int i3 = i - 7;
            str = i3 > 0 ? i3 + getString(R.string.minute_unit) : "";
            string2 = getString(R.string.total_timer_stay);
        } else if (j > 60) {
            string = getString(R.string.timer_walk);
            str = (i - 1) + getString(R.string.minute_unit);
            string2 = getString(R.string.total_timer_walk);
        } else {
            string = getString(R.string.timer_stay);
            str = i > 0 ? i + getString(R.string.minute_unit) : "";
            string2 = getString(R.string.total_timer_stay);
        }
        this.timerTv.setText(String.format("%s: %s%s %s", string, str, str2, string2));
    }

    public void flashTimerView(long j) {
        if (j >= 75 || j <= 60) {
            this.timerTv.setBackgroundColor(getResources().getColor(R.color.transparent));
        } else if (j % 2 == 0) {
            this.timerTv.setBackgroundColor(getResources().getColor(R.color.yellow));
        } else {
            this.timerTv.setBackgroundColor(getResources().getColor(R.color.transparent));
        }
    }

    public void startWalkTestReportActivity(boolean z, String str, int i) {
        Intent intent = this.reportListPresenter.getIntent(this);
        Bundle bundle = new Bundle();
        bundle.putLong("current_time", this.currentTime);
        bundle.putIntegerArrayList("step_count_list", this.stepCountList);
        int size = this.sensorDistanceList.size() <= 6 ? this.sensorDistanceList.size() : 6;
        float[] fArr = new float[size];
        for (int i2 = 0; i2 < size; i2++) {
            fArr[i2] = Float.valueOf(String.format("%.0f", Float.valueOf(Math.abs(this.sensorDistanceList.get(i2).floatValue())))).floatValue();
        }
        bundle.putFloatArray("distance_array", fArr);
        bundle.putInt("total_circle", Math.max(0, this.mBleFragment.sensorCircle - 1));
        bundle.putInt("circle_distance", this.mBleFragment.getSensorDistance());
        ArrayList<String> arrayList = new ArrayList<>();
        arrayList.add(((TextView) findViewById(R.id.before_nibp_high)).getText().toString());
        arrayList.add(((TextView) findViewById(R.id.after_nibp_high)).getText().toString());
        bundle.putStringArrayList("bp_list", arrayList);
        bundle.putBoolean("is_manual_input_nibp", z);
        bundle.putString("stop_cause", str);
        bundle.putInt("time_remaining", i);
        bundle.putSerializable(PatientEntityDao.TABLENAME, AppGlobal.getInstance().currentPatient);
        intent.putExtras(bundle);
        intent.setFlags(268435456);
        KLog.i("start report, current_time: " + DateUtils.longToTimeMillisStr(this.currentTime) + ", step_count_list: " + this.stepCountList + ", distance array: " + Arrays.toString(fArr) + ", total_circle: " + Math.max(0, this.mBleFragment.sensorCircle - 1) + ", circle_distance: " + this.mBleFragment.getSensorDistance() + ", bp_list: " + arrayList + ", is_manual_input_nibp: " + z + ", stop_cause: " + str + ", time_remaining: " + i);
        startActivity(intent);
        finish();
    }

    @Override
    protected void onResume() {
        super.onResume();
        List<Sensor> sensorList = this.mSensorManager.getSensorList(1);
        if (sensorList.size() > 0) {
            this.mRegisteredSensor = this.mSensorManager.registerListener(this, sensorList.get(0), 3);
        }
    }

    @Override
    protected void onPause() {
        if (this.mRegisteredSensor) {
            this.mSensorManager.unregisterListener(this);
            this.mRegisteredSensor = false;
        }
        super.onPause();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (configuration.orientation == 1) {
            Toast.makeText(this, "现在是竖屏", 0).show();
        }
        if (configuration.orientation == 2) {
            Toast.makeText(this, "现在是横屏", 0).show();
        }
    }

    @Override
    protected void onNewIntent(Intent intent) {
        setIntent(intent);
        gzj = getSharedPreferences("gzj", 0);
        this.res = getResources();
        setLanguage();
        super.onNewIntent(intent);
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        TSocketClient tSocketClient;
        TSocketClient tSocketClient2;
        TSocketClient tSocketClient3;
        TSocketClient tSocketClient4;
        SendDataThread sendDataThread;
        TSocketClient tSocketClient5;
        super.onActivityResult(i, i2, intent);
        if (i == 15) {
            this.showDialogFlag = false;
            if (intent == null || !intent.getExtras().getBoolean("popupresult")) {
                return;
            }
            this.stopconnect = true;
            KLog.d("user cancel walk test");
            finish();
        }
        if (i == 25) {
            if (intent != null) {
                stoptcpthread();
                StartTCPIPThread();
                this.verifycode = intent.getExtras().getString("verifycode");
                ConnectRemoteDevice();
                this.stopconnect = false;
                return;
            }
            return;
        }
        switch (i) {
            case 2:
                setLanguage();
                checkTexts();
                break;
            case 3:
                GetSearchResult(intent);
                this.bBlueDialogOpen = false;
                break;
            case 4:
                setECGChannelText();
                setChannelText();
                setSpO2ChannelText();
                if (intent != null && this.myApp.isconnect && this.sendData != null) {
                    Bundle extras = intent.getExtras();
                    if (extras.getBoolean("bcgparaset")) {
                        this.sendData.paraList = this.myApp.paraList;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
                    }
                    if (extras.getBoolean("becgcommandstart")) {
                        this.sendData.m_FunTypehigh = this.myApp.m_FunTypehigh;
                        this.sendData.m_FunTypelow = this.myApp.m_FunTypelow;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.Start);
                    }
                    if (extras.getBoolean("becgcommandstop")) {
                        this.sendData.m_stopFunTypehigh = this.myApp.m_stopFunTypehigh;
                        this.sendData.m_stopFunTypelow = this.myApp.m_stopFunTypelow;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.Stop);
                    }
                    if (extras.getBoolean("netparaset") && (tSocketClient = this.m_RetransDataProcess) != null && tSocketClient.m_bConnected) {
                        int i3 = this.ifuploaddata;
                        if (i3 == 1 || i3 == 3) {
                            this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                            this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                            break;
                        }
                    }
                }
                break;
            case 5:
                if (intent != null) {
                    System.out.println("收到外部命令" + intent.getExtras().getInt("FaceType"));
                    break;
                }
                break;
            case 6:
                setSTChannelText();
                if (intent != null && this.myApp.isconnect && this.sendData != null && intent.getExtras().getBoolean("bcgparaset")) {
                    this.sendData.paraList = this.myApp.paraList;
                    this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
                    break;
                }
                break;
            case 7:
                setSpO2ChannelText();
                setECGChannelText();
                setChannelText();
                if (intent != null && this.myApp.isconnect && this.ifuploaddata != 2 && intent.getExtras().getBoolean("netparaset") && (tSocketClient2 = this.m_RetransDataProcess) != null && tSocketClient2.m_bConnected) {
                    int i4 = this.ifuploaddata;
                    if (i4 == 1 || i4 == 3) {
                        this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                        this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                        break;
                    }
                }
                break;
            case 8:
                setTempChannelText();
                if (intent != null && this.myApp.isconnect && this.ifuploaddata != 2 && intent.getExtras().getBoolean("netparaset") && (tSocketClient3 = this.m_RetransDataProcess) != null && tSocketClient3.m_bConnected) {
                    int i5 = this.ifuploaddata;
                    if (i5 == 1 || i5 == 3) {
                        this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                        this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                        break;
                    }
                }
                break;
            case 9:
                setRespChannelText();
                setChannelText();
                if (intent != null && this.myApp.isconnect && this.sendData != null) {
                    Bundle extras2 = intent.getExtras();
                    if (extras2.getBoolean("bcgparaset") && this.m_ZhixiAlarmTime > 0 && (sendDataThread = this.sendData) != null) {
                        sendDataThread.paraList = this.myApp.paraList;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
                    }
                    if (extras2.getBoolean("netparaset") && (tSocketClient4 = this.m_RetransDataProcess) != null && tSocketClient4.m_bConnected) {
                        int i6 = this.ifuploaddata;
                        if (i6 == 1 || i6 == 3) {
                            this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                            this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                            break;
                        }
                    }
                }
                break;
            case 10:
                setNIBPChannelText();
                if (intent != null && this.myApp.isconnect && this.ifuploaddata != 2) {
                    Bundle extras3 = intent.getExtras();
                    if (extras3.getBoolean("bcgparaset")) {
                        this.sendData.paraList = this.myApp.paraList;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
                    }
                    if (extras3.getBoolean("becgcommandstart")) {
                        this.sendData.m_FunTypehigh = this.myApp.m_FunTypehigh;
                        this.sendData.m_FunTypelow = this.myApp.m_FunTypelow;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.Start);
                        this.m_nibptest = 1;
                    }
                    if (extras3.getBoolean("becgcommandstop")) {
                        this.sendData.m_stopFunTypehigh = this.myApp.m_stopFunTypehigh;
                        this.sendData.m_stopFunTypelow = this.myApp.m_stopFunTypelow;
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.Stop);
                        this.m_nibptest = 0;
                    }
                    if (extras3.getBoolean("becgcommand")) {
                        this.sendData.SetNowCommand(SendDataThread.DeviceState.StartSTATNBP);
                        StartBPTestingActivity();
                    }
                    if (extras3.getBoolean("netparaset") && (tSocketClient5 = this.m_RetransDataProcess) != null && tSocketClient5.m_bConnected) {
                        int i7 = this.ifuploaddata;
                        if (i7 == 1 || i7 == 3) {
                            this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                            this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
                            break;
                        }
                    }
                }
                break;
            case 11:
                if (intent != null) {
                    NIBPControl(false);
                }
                Button button = this.btnStartNIBP;
                if (button != null) {
                    button.setBackgroundResource(R.drawable.nibp);
                    break;
                }
                break;
            case 12:
                Button button2 = this.btnFunSetting;
                if (button2 != null) {
                    button2.setBackgroundResource(R.drawable.menu);
                    break;
                }
                break;
            case 13:
                if (intent != null && this.myApp.isconnect && intent.getExtras().getBoolean("popupresult")) {
                    this.stopconnect = true;
                    StopNowConn();
                    this.btnConnect.setImageResource(R.drawable.bluetooth_search);
                    ProcessalarmInfo(R.string.wrong, 1, 0);
                    GotoSleep(500);
                    break;
                }
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        DisplayUtils.resetDeviceConfigDisplay(this);
        this.mBleFragment.isStartCount = false;
        CountDownTimerHandler countDownTimerHandler = this.timer;
        if (countDownTimerHandler != null) {
            countDownTimerHandler.removeCallbacksAndMessages(null);
            this.timer = null;
        }
        Timer timer = this.timer50ms;
        if (timer != null) {
            timer.cancel();
            this.timer50ms = null;
        }
        PowerManager.WakeLock wakeLock = this.wakeLock;
        if (wakeLock != null) {
            wakeLock.release();
        }
        ShowTimeThread showTimeThread = this.nShowTime;
        if (showTimeThread != null) {
            showTimeThread.stopmyself();
        }
        SQLiteDatabase sQLiteDatabase = this.database;
        if (sQLiteDatabase != null) {
            sQLiteDatabase.close();
        }
        BroadcastReceiver broadcastReceiver = this.batteryLevelRcvr;
        if (broadcastReceiver != null) {
            unregisterReceiver(broadcastReceiver);
        }
        DrawLineThread drawLineThread = this.m_DrawLineThread;
        if (drawLineThread != null) {
            drawLineThread.StopMyself();
            GotoSleep(200);
        }
        TCPDataSend tCPDataSend = this.mTCPDataSend;
        if (tCPDataSend != null) {
            tCPDataSend.mHandler.getLooper().quit();
        }
        RecvDataProcess recvDataProcess = this.m_RecvDataProcess;
        if (recvDataProcess != null) {
            recvDataProcess.mHandler.getLooper().quit();
        }
        StreamDataSaveThread streamDataSaveThread = this.m_StreamDataSaveThread;
        if (streamDataSaveThread != null) {
            streamDataSaveThread.Stopmyself();
            GotoSleep(200);
        }
        WaveDataSaveThread waveDataSaveThread = this.m_WaveDataSaveThread;
        if (waveDataSaveThread != null) {
            waveDataSaveThread.Stopmyself();
            GotoSleep(200);
        }
        AlarmShowThread alarmShowThread = this.m_AlarmShowThread;
        if (alarmShowThread != null) {
            alarmShowThread.Stopmyself();
            GotoSleep(200);
        }
        this.myApp.isconnect = false;
        SendDataThread sendDataThread = this.sendData;
        if (sendDataThread != null) {
            sendDataThread.StopMyself();
            GotoSleep(200);
            this.sendData = null;
        }
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient != null) {
            tSocketClient.StopMyself();
            GotoSleep(200);
            this.m_RetransDataProcess = null;
        }
        this.HBhandler.removeCallbacks(this.tcpHeartbeat);
        SharedPreferences sharedPreferences = gzj;
        if (sharedPreferences != null) {
            sharedPreferences.edit().putInt("nibptest", 0).commit();
        }
        System.out.println("退出!");
        KLog.d("finish walk test");
        instance = null;
        this.myApp.setM_bStartAPK(false);
        if (AppGlobal.readerClient.isClient) {
            AppGlobal.readerClient.client.close();
            AppGlobal.readerClient.isClient = false;
        }
    }

    public void RefreshNetInfo(int i) {
        switch (i) {
            case 0:
                this.remotedis.setText(getString(R.string.updata));
                this.remotedisTextId = R.string.updata;
                break;
            case 1:
                this.remotedis.setText(getString(R.string.DeviceBlueteethError));
                this.remotedisTextId = R.string.DeviceBlueteethError;
                break;
            case 2:
                this.remotedis.setText(getString(R.string.str_RemoteOffline));
                this.remotedisTextId = R.string.str_RemoteOffline;
                break;
            case 3:
                this.remotedis.setText(getString(R.string.str_RemoteLogout));
                this.remotedisTextId = R.string.str_RemoteLogout;
                break;
            case 4:
                this.remotedis.setText(getString(R.string.CenterDisConnect));
                this.remotedisTextId = R.string.CenterDisConnect;
                break;
            case 5:
                this.remotedis.setText(getString(R.string.CenterNormal));
                this.remotedisTextId = R.string.CenterNormal;
                break;
            case 6:
                this.remotedis.setText(getString(R.string.CenterOccupy));
                this.remotedisTextId = R.string.CenterOccupy;
                break;
        }
    }

    public void RefreshAlarmVol() {
        if (this.m_currentAlarmVol == 0.0f) {
            alarming = false;
            if (this.TechAlarmList.GetAlarmData(R.string.AlarmIsOff) == null) {
                this.TechAlarmList.AddAlarmdatatoList(R.string.AlarmIsOff, 0, 0, false);
            }
            ResetAlarmStatus();
            return;
        }
        alarming = true;
        AlarmData GetAlarmData = this.TechAlarmList.GetAlarmData(R.string.AlarmIsOff);
        if (GetAlarmData != null) {
            this.TechAlarmList.DeleteAlarmFromList(GetAlarmData);
        }
    }

    public void ReConnectDevice() {
        ProcessalarmInfo(R.string.wrong, 0, 0);
        ProcessalarmInfo(R.string.Reconnect, 1, 0);
        connectdevice();
        ShowMessage(R.string.toast_06);
    }

    public void ResetButtonStatus() {
        this.myApp.isconnect = false;
    }

    public void RefreshNowChannelWidth() {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(this.nowwidth, this.nAllchannelHeight);
        LinearLayout linearLayout = (LinearLayout) this.myViewGroupleft.getChildAt(0).findViewById(R.id.channels);
        this.lv = linearLayout;
        linearLayout.setLayoutParams(layoutParams);
        LinearLayout linearLayout2 = (LinearLayout) this.myViewGroupleft.getChildAt(1).findViewById(R.id.channels);
        this.lv = linearLayout2;
        linearLayout2.setLayoutParams(layoutParams);
        this.view_1.SetScreenWidth(this.nowwidth);
        this.view_2.SetScreenWidth(this.nowwidth);
        this.view_3.SetScreenWidth(this.nowwidth);
        this.view_4.SetScreenWidth(this.nowwidth);
        this.view_ECGII.SetScreenWidth(this.nowwidth);
        this.view_ECGI.SetScreenWidth(this.nowwidth);
        this.view_ECGIII.SetScreenWidth(this.nowwidth);
        this.view_ECGavR.SetScreenWidth(this.nowwidth);
        this.view_ECGavL.SetScreenWidth(this.nowwidth);
        this.view_ECGavF.SetScreenWidth(this.nowwidth);
        this.view_ECGV.SetScreenWidth(this.nowwidth);
    }

    private long getAvailMemory(Context context) {
        ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
        ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
        activityManager.getMemoryInfo(memoryInfo);
        return memoryInfo.availMem / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED;
    }

    private void clearSys() {
        ActivityManager activityManager = (ActivityManager) getSystemService("activity");
        List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = activityManager.getRunningAppProcesses();
        if (runningAppProcesses != null) {
            for (int i = 0; i < runningAppProcesses.size(); i++) {
                ActivityManager.RunningAppProcessInfo runningAppProcessInfo = runningAppProcesses.get(i);
                String[] strArr = runningAppProcessInfo.pkgList;
                if (runningAppProcessInfo.importance > 300) {
                    for (String str : strArr) {
                        activityManager.killBackgroundProcesses(str);
                        System.out.println("processName     " + runningAppProcessInfo.processName);
                    }
                }
            }
        }
    }

    public void initSoundPool() {
        SoundPool build = new SoundPool.Builder().setMaxStreams(10).build();
        this.m_SPHigh = build;
        this.m_loadIdHigh = build.load(instance, R.raw.highalarm, 2);
        SoundPool build2 = new SoundPool.Builder().setMaxStreams(10).build();
        this.m_SPMiddle = build2;
        this.m_loadIdMiddle = build2.load(instance, R.raw.middlealarm, 3);
        SoundPool build3 = new SoundPool.Builder().setMaxStreams(10).build();
        this.m_SPLow = build3;
        this.m_loadIdLow = build3.load(instance, R.raw.lowalarm, 4);
        SoundPool build4 = new SoundPool.Builder().setMaxStreams(10).build();
        this.stay1Sp = build4;
        this.stay1Load = build4.load(this, R.raw.stay1, 2);
        SoundPool build5 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walkSp = build5;
        this.walkLoad = build5.load(this, R.raw.walk, 2);
        SoundPool build6 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk1Sp = build6;
        this.walk1Load = build6.load(this, R.raw.walk1, 2);
        SoundPool build7 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk2Sp = build7;
        this.walk2Load = build7.load(this, R.raw.walk2, 2);
        SoundPool build8 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk3Sp = build8;
        this.walk3Load = build8.load(this, R.raw.walk3, 2);
        SoundPool build9 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk4Sp = build9;
        this.walk4Load = build9.load(this, R.raw.walk4, 2);
        SoundPool build10 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk5Sp = build10;
        this.walk5Load = build10.load(this, R.raw.walk5, 2);
        SoundPool build11 = new SoundPool.Builder().setMaxStreams(10).build();
        this.walk6Sp = build11;
        this.walk6Load = build11.load(this, R.raw.walk6, 2);
        SoundPool build12 = new SoundPool.Builder().setMaxStreams(10).build();
        this.stay2Sp = build12;
        this.stay2Load = build12.load(this, R.raw.stay2, 2);
        AudioManager audioManager = (AudioManager) getSystemService("audio");
        audioManager.setStreamVolume(3, audioManager.getStreamMaxVolume(3), 4);
        SharedPreferences.Editor edit = gzj.edit();
        edit.putFloat("AlarmCurrentVolume", 1.0f);
        int streamMaxVolume = audioManager.getStreamMaxVolume(2);
        audioManager.setStreamVolume(2, streamMaxVolume, 4);
        edit.putInt("HRCurrentVolume", streamMaxVolume);
        edit.commit();
    }

    public void HandleuncaughtException(Thread thread, Throwable th) {
        StackTraceElement[] stackTrace;
        String th2;
        if (th != null) {
            StringBuilder sb = new StringBuilder();
            String message = th.getMessage();
            if (message != null) {
                sb.append(message);
            }
            sb.append("\r\n");
            sb.append(thread.getName());
            sb.append(" Trace: \r\n");
            StackTraceElement[] stackTrace2 = th.getStackTrace();
            if (stackTrace2 != null) {
                for (StackTraceElement stackTraceElement : stackTrace2) {
                    String stackTraceElement2 = stackTraceElement.toString();
                    if (stackTraceElement2 != null) {
                        sb.append(stackTraceElement2);
                    }
                    sb.append("\r\n");
                }
            }
            sb.append("Cause: ");
            Throwable cause = th.getCause();
            if (cause != null && (th2 = cause.toString()) != null) {
                sb.append(th2);
            }
            sb.append("\r\nCause Stack:\r\n");
            Throwable cause2 = th.getCause();
            if (cause2 != null && (stackTrace = cause2.getStackTrace()) != null) {
                for (StackTraceElement stackTraceElement3 : stackTrace) {
                    String stackTraceElement4 = stackTraceElement3.toString();
                    if (stackTraceElement4 != null) {
                        sb.append(stackTraceElement4);
                    }
                    sb.append("\r\n");
                }
            }
            for (Map.Entry<String, String> entry : this.infos.entrySet()) {
                sb.append(entry.getKey() + "=" + entry.getValue() + CSVWriter.DEFAULT_LINE_END);
            }
            StringWriter stringWriter = new StringWriter();
            PrintWriter printWriter = new PrintWriter(stringWriter);
            th.printStackTrace(printWriter);
            for (Throwable cause3 = th.getCause(); cause3 != null; cause3 = cause3.getCause()) {
                cause3.printStackTrace(printWriter);
            }
            printWriter.close();
            sb.append(stringWriter.toString());
            try {
                String str = "crash-" + this.formatter.format(new Date()) + "-" + System.currentTimeMillis() + ".txt";
                if (Environment.getExternalStorageState().equals("mounted")) {
                    String str2 = ConstDefine.SD_PATH + "/WalkTest/crash/";
                    File file = new File(str2);
                    if (!file.exists()) {
                        file.mkdirs();
                    }
                    FileOutputStream fileOutputStream = new FileOutputStream(str2 + str);
                    fileOutputStream.write(sb.toString().getBytes());
                    fileOutputStream.close();
                }
            } catch (Exception e) {
                Log.e("myexceptionhanlder", "an error occured while writing file...", e);
            }
        }
    }

    @java.lang.Deprecated
    public static java.lang.String getIpSer() {
        throw new UnsupportedOperationException("Method not decompiled: cn.neoprint.padmonitor.ui.MainActivity.getIpSer():java.lang.String");
    }

    void datafromserver() {
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient == null) {
            return;
        }
        byte[] bArr = {4};
        if (tSocketClient != null && tSocketClient.RemoteMonitor != 3) {
            this.m_RetransDataProcess.tcpuploadCMD(bArr, 1, (byte) 5);
            System.out.println("sendbp per 5s ");
        }
        System.out.println("hb per 5s ");
        if (this.m_RetransDataProcess.RemoteMonitor == 0) {
            this.remotedis.setText(getString(R.string.RecvDataFromServer));
            this.remotedisTextId = R.string.RecvDataFromServer;
            ProcessalarmInfo(R.string.wrong, 0, 0);
            ProcessalarmInfo(R.string.Reconnect, 0, 0);
        } else if (this.m_RetransDataProcess.RemoteMonitor == 1) {
            this.remotedis.setText(getString(R.string.DeviceBlueteethError));
            this.remotedisTextId = R.string.DeviceBlueteethError;
            ProcessalarmInfo(R.string.wrong, 1, 0);
        } else if (this.m_RetransDataProcess.RemoteMonitor == 2) {
            this.remotedis.setText(getString(R.string.str_RemoteOffline));
            this.remotedisTextId = R.string.str_RemoteOffline;
        } else if (this.m_RetransDataProcess.RemoteMonitor == 3) {
            this.remotedis.setText(getString(R.string.str_RemoteLogout));
            this.remotedisTextId = R.string.str_RemoteLogout;
            this.NetErrorCount = 0;
            this.HBneedrun = false;
            RemoteDevOffline();
            return;
        }
        if (this.NetErrorCount > 12) {
            stoptcpthread();
            StartTCPIPThread();
            this.remotedis.setText(getString(R.string.DevConnectServerError));
            this.remotedisTextId = R.string.DevConnectServerError;
            this.NetErrorCount = 0;
            ConnectRemoteDevice();
            System.out.println("controlError arrive MAX!");
            return;
        }
        if (!this.m_RetransDataProcess.m_RxTimeout) {
            this.m_RetransDataProcess.m_RxTimeout = true;
            this.NetErrorCount = 0;
        } else {
            this.NetErrorCount++;
            System.out.println("the count of control: " + this.NetErrorCount);
        }
    }

    void dataFromDevice() {
        if (this.NetErrorCount >= 6) {
            ReConnectToServer();
            this.remotedis.setText(getString(R.string.DevConnectServerError));
            this.remotedisTextId = R.string.DevConnectServerError;
            System.out.println("NetErrorCount arrive MAX!");
        } else if (this.m_RetransDataProcess.RemoteStatus != -1) {
            this.m_RetransDataProcess.RemoteStatus = -1;
            this.NetErrorCount = 0;
        } else {
            this.NetErrorCount++;
            System.out.println("the count of NoCorrectHB: " + this.NetErrorCount);
        }
        if (this.m_RetransDataProcess == null || this.logonresult != 0) {
            return;
        }
        if (!this.myApp.isconnect) {
            this.m_RetransDataProcess.tcpuploadCMD(new byte[]{1}, 1, (byte) 5);
            this.remotedis.setText(getString(R.string.BluetoothNotReady));
            this.remotedisTextId = R.string.BluetoothNotReady;
            System.out.println("send blueteeth break! ");
            return;
        }
        if (this.remotedisTextId == 2131886110) {
            this.remotedis.setText("");
        }
    }

    public View getLayoutView(int i) {
        return ((LayoutInflater) getSystemService("layout_inflater")).inflate(i, (ViewGroup) null);
    }

    public void clearAllData() {
        DataRepository.getInstance().getNibpDataDao().deleteAll();
        DataRepository.getInstance().getAlarmEventDao().deleteAll();
        DataRepository.getInstance().getEcgMarkDao().deleteAll();
        DataRepository.getInstance().getReportDao().deleteAll();
        FileUtils.delete(new File(ConstDefine.SD_PATH + "/WalkTest/PhysiAlarm"));
        this.mydata.WritePointIdx(3, 0);
        gzj.edit().putInt("Point5Sec", 0).commit();
        FileUtils.delete(new File(ConstDefine.SD_PATH + ConstDefine.Stream5Sec_FILE_PATH));
        this.mydata.WritePointIdx(2, 0);
        gzj.edit().putInt("Point5Min", 0).commit();
        FileUtils.delete(new File(ConstDefine.SD_PATH + "/WalkTest/StreamData_5min.dat"));
        this.mydata.WritePointIdx(1, 0);
        gzj.edit().putInt("WaveReviewPoint", 0).commit();
        FileUtils.delete(new File(ConstDefine.SD_PATH + "/WalkTest/WaveReview.dat"));
    }

    public void NIBPControl(boolean z) {
        if (!this.myApp.isconnect) {
            ShowMessage(R.string.toast_02);
            return;
        }
        if (z) {
            if (this.isstart) {
                if (this.ifuploaddata == 2) {
                    byte[] bArr = {1};
                    TSocketClient tSocketClient = this.m_RetransDataProcess;
                    if (tSocketClient != null) {
                        tSocketClient.tcpuploadCMD(bArr, 1, (byte) 20);
                    }
                } else {
                    SendDataThread sendDataThread = this.sendData;
                    if (sendDataThread != null) {
                        sendDataThread.SetNowCommand(SendDataThread.DeviceState.StartBP);
                    }
                }
                KLog.i("启动血压测量");
                this.isstart = false;
                return;
            }
            return;
        }
        if (this.ifuploaddata == 2) {
            byte[] bArr2 = {3};
            TSocketClient tSocketClient2 = this.m_RetransDataProcess;
            if (tSocketClient2 != null) {
                tSocketClient2.tcpuploadCMD(bArr2, 1, (byte) 20);
                System.out.println("监控端发送停止血压测量命令");
            }
        } else {
            SendDataThread sendDataThread2 = this.sendData;
            if (sendDataThread2 != null) {
                sendDataThread2.SetNowCommand(SendDataThread.DeviceState.StopBP);
                KLog.i("停止血压测量");
            }
        }
        stopTest();
        this.btnStartNIBP.setBackgroundResource(R.drawable.nibp);
    }

    public void initSTShow() {
        TextView textView = (TextView) findViewById(R.id.ST1text);
        this.STtext1 = textView;
        textView.setOnClickListener(this);
        TextView textView2 = (TextView) findViewById(R.id.ST2text);
        this.STtext2 = textView2;
        textView2.setOnClickListener(this);
        TextView textView3 = (TextView) findViewById(R.id.ST1value);
        this.STValue1 = textView3;
        textView3.setOnClickListener(this);
        TextView textView4 = (TextView) findViewById(R.id.ST2Value);
        this.STValue2 = textView4;
        textView4.setOnClickListener(this);
        this.STalarmbmp = (ImageView) findViewById(R.id.STalarmbmp);
        setSTChannelText();
    }

    public void initViewGroup() {
        Typeface.createFromAsset(getAssets(), "fonts/MSBlack.ttf");
        this.ecg_channel1_tx = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecg_channel1_tx);
        this.ecg_channel2_tx = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecg_channel2_tx);
        this.ecg_gain = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecg_gain);
        this.resp_gain = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.resp_gain);
        this.mon = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.mon);
        this.ecg_gain1 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_gain1);
        this.mon1 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.mon1);
        this.ecgspeed = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecgspeed);
        this.ecgspeed1 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecgspeed1);
        this.spo2speed = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.spo2speed);
        this.respspeed = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.respspeed);
        TextView textView = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.freeze_tx);
        this.txFreeze = textView;
        textView.setText("");
        TextView textView2 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.freeze_tx1);
        this.txFreeze1 = textView2;
        textView2.setText("");
        TextView textView3 = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ECGJZTip_tx);
        this.txECGJZTip = textView3;
        textView3.setText("");
        TextView textView4 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGJZTip_tx);
        this.txECGJZTip1 = textView4;
        textView4.setText("");
        this.txDemotext = (TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.DemoText);
        this.txDemotext1 = (TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.DemoText1);
        if (this.m_bDemo) {
            this.txDemotext.setText(R.string.DEMOText);
            this.txDemotext1.setText(R.string.DEMOText);
        } else {
            this.txDemotext.setText("");
            this.txDemotext1.setText("");
        }
    }

    public void initViewFillper() {
        this.ECGPVCSValue = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.PVCSValue);
        this.PVCSalarmImg = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.PVCSalarmbmp);
        this.ecgalarmbmp = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.ECGalarmbmp);
        ImageView imageView = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.ecgheartbmp);
        this.ecgbmp = imageView;
        imageView.setVisibility(4);
        TextView textView = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.bpm);
        this.bpm = textView;
        textView.setOnClickListener(this);
        this.HRunit = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.HRUnit);
        TextView textView2 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.spo2);
        this.spo2 = textView2;
        textView2.setOnClickListener(this);
        this.spo2bt = (ProgressBar) this.myViewGroupright.getChildAt(0).findViewById(R.id.Spo2bt);
        this.spo2xh = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.Spo2xh);
        this.spo2alarmbmp = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.SPO2alarmbmp);
        this.spo2xhname = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.Spo2xhname);
        TextView textView3 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.temp);
        this.temp = textView3;
        textView3.setOnClickListener(this);
        this.tempalarmbmp = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.Tempalarmbmp);
        this.tempUnit = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.TempUnit);
        TextView textView4 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.brpm);
        this.brpm = textView4;
        textView4.setOnClickListener(this);
        this.respalarmbmp = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.Respalarmbmp);
        TextView textView5 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.before_nibp_high);
        this.mmhg = textView5;
        textView5.setOnClickListener(this);
        this.mmhgLayout = (RelativeLayout) this.myViewGroupright.getChildAt(0).findViewById(R.id.before_nibp_layout);
        TextView textView6 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.before_nibp_low);
        this.map = textView6;
        textView6.setOnClickListener(this);
        TextView textView7 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.NIBPTestTime);
        this.NIBPTestTime = textView7;
        textView7.setText("");
        this.NIBPunit = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.nibpunit);
        this.nibpalarmbmp = (ImageView) this.myViewGroupright.getChildAt(0).findViewById(R.id.NIBPalarmbmp);
        RelativeLayout relativeLayout = (RelativeLayout) this.myViewGroupright.getChildAt(0).findViewById(R.id.ecg_layout);
        this.ecgLayout = relativeLayout;
        relativeLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MainActivity.this.startActivityForResult(new Intent(MainActivity.this, (Class<?>) WalkTestSettingsActivity.class), 4);
                MainActivity.this.overridePendingTransition(R.anim.zoomin, 0);
            }
        });
        this.spo2Layout = (RelativeLayout) this.myViewGroupright.getChildAt(0).findViewById(R.id.spo2_layout);
        this.respLayout = (RelativeLayout) this.myViewGroupright.getChildAt(0).findViewById(R.id.resp_layout);
        hideResp();
        TextView textView8 = (TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.kaluli);
        this.PIN_monitor = textView8;
        textView8.setText(" ");
        this.PIN_monitor.getPaint().setFakeBoldText(true);
        initSTShow();
        this.view_1.SetECGbmp(this.ecgbmp);
        this.view_ECGII.SetECGbmp(this.ecgbmp);
        setChannelText();
        setECGChannelText();
        setSpO2ChannelText();
        setRespChannelText();
        setTempChannelText();
        setNIBPChannelText();
        setSTChannelText();
        this.PIN_monitor.setText("PIN: " + this.randomnum.toString());
        RecvDataProcess recvDataProcess = this.m_RecvDataProcess;
        if (recvDataProcess != null) {
            recvDataProcess.ResetParaValue();
        }
    }

    private void hideResp() {
        if (GzjSharePref.getBoolValue(GzjSharePref.KEY_SHOW_RESP)) {
            return;
        }
        this.respLayout.setVisibility(8);
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.rl_circle);
        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) relativeLayout.getLayoutParams();
        layoutParams.weight = 8.0f;
        relativeLayout.setLayoutParams(layoutParams);
        findViewById(R.id.fl_resp).setVisibility(4);
    }

    public void InitManyECGChannel() {
        this.view_ECGII = (ECG1Channel_view) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelII);
        this.view_ECGI = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelI);
        this.view_ECGIII = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelIII);
        this.view_ECGavR = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelavR);
        this.view_ECGavL = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelavL);
        this.view_ECGavF = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelavF);
        this.view_ECGV = (ChannelView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ecg_channelV);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int i = this.nAllchannelHeight / 7;
        float f = (displayMetrics.xdpi * 213.0f) / 320.0f;
        float f2 = displayMetrics.ydpi;
        KLog.i("DisplayMetrics xdpi=" + f + ", ydpi=" + f2);
        ECG1Channel_view eCG1Channel_view = this.view_ECGII;
        eCG1Channel_view.init(eCG1Channel_view, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView = this.view_ECGI;
        channelView.init(channelView, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView2 = this.view_ECGIII;
        channelView2.init(channelView2, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView3 = this.view_ECGavR;
        channelView3.init(channelView3, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView4 = this.view_ECGavL;
        channelView4.init(channelView4, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView5 = this.view_ECGavF;
        channelView5.init(channelView5, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView6 = this.view_ECGV;
        channelView6.init(channelView6, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
    }

    public void InitWaveChannel() {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int i = this.nAllchannelHeight / 4;
        float f = (displayMetrics.xdpi * 213.0f) / 320.0f;
        float f2 = displayMetrics.ydpi;
        this.view_1 = (ECG1Channel_view) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecg_channel1);
        this.view_2 = (ChannelView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.ecg_channel2);
        this.view_3 = (ChannelView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.spo2_channel);
        this.view_4 = (ChannelView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.resp_channel);
        ECG1Channel_view eCG1Channel_view = this.view_1;
        eCG1Channel_view.init(eCG1Channel_view, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView = this.view_2;
        channelView.init(channelView, i, 4096, 2, f, f2, 250, this.nECGcolor, this.nChannelWide);
        ChannelView channelView2 = this.view_3;
        channelView2.init(channelView2, i, 255, 1, f, f2, 125, this.nSpo2color, this.nChannelWide);
        ChannelView channelView3 = this.view_4;
        channelView3.init(channelView3, i, 255, 3, f, f2, 125, this.nRespcolor, this.nChannelWide);
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4 || i == 3) {
            Intent intent = new Intent();
            Bundle bundle = new Bundle();
            bundle.putInt("popuptextview", R.string.dialog_06);
            intent.putExtras(bundle);
            intent.setClass(this, PopUpDialogActivity.class);
            startActivityForResult(intent, 15);
        }
        if (i != 91) {
            return true;
        }
        System.out.println(0);
        return true;
    }

    public void PopUpComErrorDialog() {
        new AlertDialog.Builder(this).setTitle(R.string.dialog_start).setIcon(R.drawable.icon).setMessage(R.string.toast_05).setPositiveButton(R.string.no, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
            }
        }).setNegativeButton(R.string.search, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                MainActivity.this.searchBluetooth();
            }
        }).show();
    }

    public void StartTCPIPThread() {
        TSocketClient tSocketClient;
        SendDataThread sendDataThread;
        int i;
        if (this.m_RetransDataProcess == null) {
            this.m_RetransDataProcess = new TSocketClient(this.RHOST, this.TPORT, this.handler, this.m_RecvDataProcess);
            if (this.ifuploaddata == 3) {
                this.m_RetransDataProcess.SetCenterInfo(gzj.getString("controlTxtIP", "192.168.1.1"), gzj.getInt("controlTxtPort", 9876));
            }
            this.m_RetransDataProcess.start();
            System.out.println("开启网络连接线程!");
        }
        TSocketClient tSocketClient2 = this.m_RetransDataProcess;
        if (tSocketClient2 != null && (sendDataThread = this.sendData) != null && ((i = this.ifuploaddata) == 1 || i == 3)) {
            sendDataThread.SetMyTCPSK(tSocketClient2);
        }
        int i2 = 0;
        while (this.m_RetransDataProcess.sk == null) {
            GotoSleep(5);
            i2++;
            if (i2 > 100) {
                break;
            }
        }
        SendDataThread sendDataThread2 = this.sendData;
        if (sendDataThread2 == null || (tSocketClient = this.m_RetransDataProcess) == null) {
            return;
        }
        tSocketClient.sendDataintcp = sendDataThread2;
    }

    int requestDataFromNetDevice(String str) {
        this.m_RetransDataProcess.tcpupload(str.getBytes(), str.length(), (byte) 18);
        System.out.println("发送监控端登录报文!");
        return 0;
    }

    public void searchBluetooth() {
        if (this.bBlueDialogOpen) {
            return;
        }
        Intent intent = new Intent();
        intent.setClass(this, BluetoothListActivity.class);
        startActivityForResult(intent, 3);
        this.bBlueDialogOpen = true;
        overridePendingTransition(R.anim.zoomin, 0);
    }

    public void ProcessalarmInfo(int i, int i2, int i3) {
        AlarmData GetAlarmData = this.TechAlarmList.GetAlarmData(i);
        if (GetAlarmData != null) {
            if (i2 == 0) {
                this.TechAlarmList.DeleteAlarmFromList(GetAlarmData);
            }
        } else if (i2 == 1) {
            if (i == 2131887260) {
                this.TechAlarmList.DeleteAll();
                this.ParaAlarmList.DeleteAll();
                this.HRSCAlarmList.DeleteAllHRSCAlarm();
                RecvDataProcess recvDataProcess = this.m_RecvDataProcess;
                if (recvDataProcess != null) {
                    recvDataProcess.ResetParaList();
                }
            }
            this.TechAlarmList.AddAlarmdatatoList(i, i3, 0, false);
        }
    }

    public void PlayAlarmSound(int i) {
        SoundPool soundPool;
        int i2;
        int i3;
        if (i == 0) {
            soundPool = this.m_SPHigh;
            i2 = this.m_loadIdHigh;
        } else if (i == 1) {
            soundPool = this.m_SPMiddle;
            i2 = this.m_loadIdMiddle;
        } else {
            if (i != 2) {
                soundPool = null;
                i3 = -1;
                if (soundPool != null || i3 == -1) {
                }
                int play = soundPool.play(i3, 1.0f, 1.0f, 1, 0, 1.0f);
                float f = this.m_currentAlarmVol;
                soundPool.setVolume(play, f, f);
                return;
            }
            soundPool = this.m_SPLow;
            i2 = this.m_loadIdLow;
        }
        i3 = i2;
        if (soundPool != null) {
        }
    }

    public void playNoticeSound(int i) {
        SoundPool soundPool;
        int i2;
        int i3;
        switch (i) {
            case 1:
                soundPool = this.stay1Sp;
                i2 = this.stay1Load;
                i3 = i2;
                break;
            case 2:
                soundPool = this.walkSp;
                i2 = this.walkLoad;
                i3 = i2;
                break;
            case 3:
                soundPool = this.stay2Sp;
                i2 = this.stay2Load;
                i3 = i2;
                break;
            case 4:
                soundPool = this.walk1Sp;
                i2 = this.walk1Load;
                i3 = i2;
                break;
            case 5:
                soundPool = this.walk2Sp;
                i2 = this.walk2Load;
                i3 = i2;
                break;
            case 6:
                soundPool = this.walk3Sp;
                i2 = this.walk3Load;
                i3 = i2;
                break;
            case 7:
                soundPool = this.walk4Sp;
                i2 = this.walk4Load;
                i3 = i2;
                break;
            case 8:
                soundPool = this.walk5Sp;
                i2 = this.walk5Load;
                i3 = i2;
                break;
            case 9:
                soundPool = this.walk6Sp;
                i2 = this.walk6Load;
                i3 = i2;
                break;
            default:
                soundPool = null;
                i3 = -1;
                break;
        }
        if (soundPool == null || i3 == -1) {
            return;
        }
        soundPool.setVolume(soundPool.play(i3, 10.0f, 10.0f, 1, 0, 1.0f), 10.0f, 10.0f);
    }

    public void connectdevice() {
        SendDataThread sendDataThread;
        TSocketClient tSocketClient;
        if (this.myApp.isconnect) {
            return;
        }
        GotoSleep(2000);
        if (this.ifuploaddata == 2 && this.m_RetransDataProcess != null) {
            ConnectRemoteDevice();
            return;
        }
        SendDataThread sendDataThread2 = this.sendData;
        if (sendDataThread2 != null) {
            sendDataThread2.StopMyself();
            this.sendData = null;
        }
        this.sendData = new SendDataThread(this);
        String string = gzj.getString("address", "00:80:25:A2:E0:5B");
        this.Deviceno.setText(gzj.getString("Devicename", "GW00012"));
        this.sendData.setAddress(string);
        this.sendData.datahandler = this.m_RecvDataProcess.mHandler;
        this.sendData.TCPdatahandler = this.mTCPDataSend.mHandler;
        this.sendData.start();
        int i = this.ifuploaddata;
        if ((i == 1 || i == 3) && (sendDataThread = this.sendData) != null) {
            sendDataThread.SetMyTCPSK(this.m_RetransDataProcess);
        }
        SendDataThread sendDataThread3 = this.sendData;
        if (sendDataThread3 == null || (tSocketClient = this.m_RetransDataProcess) == null) {
            return;
        }
        tSocketClient.sendDataintcp = sendDataThread3;
    }

    public void SendALLPara() {
        SendDataThread sendDataThread;
        if (this.myApp.isconnect) {
            AppGlobal appGlobal = (AppGlobal) getApplication();
            appGlobal.paraList.clear();
            appGlobal.paraList.add((byte) 2);
            appGlobal.paraList.add(Byte.valueOf((byte) this.m_nPatientType));
            appGlobal.paraList.add((byte) 3);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecgleadtype", 1)));
            appGlobal.paraList.add((byte) 4);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecgfilter", 1)));
            appGlobal.paraList.add((byte) 5);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecggain", 2)));
            appGlobal.paraList.add((byte) 5);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecggain", 2)));
            appGlobal.paraList.add((byte) 5);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecggain", 2)));
            appGlobal.paraList.add((byte) 7);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("ecgcalHR", 0)));
            appGlobal.paraList.add((byte) 8);
            appGlobal.paraList.add(Byte.valueOf((byte) gzj.getInt("respgain", 2)));
            appGlobal.paraList.add((byte) 9);
            appGlobal.paraList.add(Byte.valueOf((byte) this.m_ZhixiAlarmTime));
            if (this.ifuploaddata != 2 && (sendDataThread = this.sendData) != null) {
                sendDataThread.paraList = appGlobal.paraList;
                this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
            }
            if (gzj.getBoolean("ECGJZswitch", false) && this.sendData != null) {
                appGlobal.m_stopFunTypelow = (byte) (appGlobal.m_stopFunTypelow | 128);
                appGlobal.m_FunTypelow = (byte) (appGlobal.m_FunTypelow & Byte.MAX_VALUE);
                this.sendData.m_stopFunTypehigh = appGlobal.m_stopFunTypehigh;
                this.sendData.m_stopFunTypelow = appGlobal.m_stopFunTypelow;
                this.sendData.SetNowCommand(SendDataThread.DeviceState.Stop);
                gzj.edit().putBoolean("ECGJZswitch", false).commit();
                SetECTJXTextTip();
            }
            if (appGlobal == null || appGlobal.isM_bStartAPK() || this.sendData == null) {
                return;
            }
            appGlobal.m_stopFunTypehigh = (byte) (appGlobal.m_stopFunTypehigh | 2);
            appGlobal.m_FunTypehigh = (byte) (appGlobal.m_FunTypehigh & 253);
            this.sendData.m_stopFunTypehigh = appGlobal.m_stopFunTypehigh;
            this.sendData.m_stopFunTypelow = appGlobal.m_stopFunTypelow;
            this.sendData.SetNowCommand(SendDataThread.DeviceState.Stop);
            appGlobal.setM_bStartAPK(true);
        }
    }

    private int LoginServer(String str) {
        String str2;
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient == null) {
            return 0;
        }
        tSocketClient.devicelogonresult = -1;
        this.logonresult = -1;
        String str3 = this.CDKEY + "|" + str + "|" + this.randomnum;
        if (this.ifuploaddata == 3) {
            str2 = str3 + "|1";
        } else {
            str2 = str3 + "|0";
        }
        this.m_RetransDataProcess.m_devicelogoninfo = str2;
        this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.Start;
        return this.logonresult;
    }

    public static String frontCompWithZore(int i, int i2) {
        return String.format("%0" + i2 + "d", Integer.valueOf(i));
    }

    public void StartBlueToothThread() {
        if (this.sendData == null) {
            SendDataThread sendDataThread = new SendDataThread(this);
            this.sendData = sendDataThread;
            sendDataThread.setAddress(this.strAddress);
            this.sendData.datahandler = this.m_RecvDataProcess.mHandler;
            this.sendData.TCPdatahandler = this.mTCPDataSend.mHandler;
            this.sendData.start();
        }
    }

    public void GetSearchResult(Intent intent) {
        if (intent == null) {
            return;
        }
        StopNowConn();
        this.stopconnect = false;
        Bundle extras = intent.getExtras();
        this.strAddress = extras.getString("address");
        String string = extras.getString("Devicename");
        this.strDevicename = string;
        WriteAddressToFile(this.strAddress, string);
        this.Deviceno.setText(this.strDevicename);
        this.RHOST = extras.getString("serverip");
        this.TPORT = extras.getInt("serverport");
        int i = extras.getInt("ifuploaddata");
        this.ifuploaddata = i;
        if (i == 0) {
            StartBlueToothThread();
            return;
        }
        if (i != 1) {
            if (i == 2) {
                StartTCPIPThread();
                ConnectRemoteDevice();
                return;
            } else if (i != 3) {
                return;
            }
        }
        StartBlueToothThread();
    }

    public void GOTOStartTCPTread() {
        TSocketClient tSocketClient;
        int i = this.ifuploaddata;
        if (i == 1 || i == 3) {
            StartTCPIPThread();
            this.randomnum = frontCompWithZore((int) (Math.random() * 1000000.0d), 6);
            if (this.m_RetransDataProcess == null) {
                System.out.println("网络连接无效!");
                ReConnectToServer();
            }
            SendDataThread sendDataThread = this.sendData;
            if (sendDataThread == null || (tSocketClient = this.m_RetransDataProcess) == null) {
                return;
            }
            tSocketClient.sendDataintcp = sendDataThread;
            this.sendData.SetMyTCPRun(true);
            this.sendData.SetMyTCPSK(this.m_RetransDataProcess);
            LoginServer(this.strDevicename);
        }
    }

    public void ReConnectToServer() {
        stoptcpthread();
        this.remotedis.setText(getString(R.string.DevConnectServerError));
        this.remotedisTextId = R.string.DevConnectServerError;
        System.out.println("重新连接服务器!");
        ShowTimeThread showTimeThread = this.nShowTime;
        if (showTimeThread != null) {
            showTimeThread.m_bReconnect = true;
        }
    }

    public void ConnectToServer() {
        int i = this.ifuploaddata;
        if (i != 1) {
            if (i == 2) {
                StartTCPIPThread();
                ConnectRemoteDevice();
                return;
            } else if (i != 3) {
                return;
            }
        }
        StartTCPIPThread();
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient == null) {
            System.out.println("网络连接无效!");
            ReConnectToServer();
            return;
        }
        SendDataThread sendDataThread = this.sendData;
        if (sendDataThread == null || tSocketClient == null) {
            return;
        }
        tSocketClient.sendDataintcp = sendDataThread;
        this.sendData.SetMyTCPRun(true);
        this.sendData.SetMyTCPSK(this.m_RetransDataProcess);
        LoginServer(this.strDevicename);
    }

    public void ProcessDeviceLogInResult(int i) {
        this.logonresult = i;
        ShowTimeThread showTimeThread = this.nShowTime;
        if (showTimeThread != null && i != -1) {
            showTimeThread.m_bReconnect = false;
        }
        if (i != 0) {
            if (i == 1) {
                this.remotedis.setText(getString(R.string.DevConnectServerError) + i);
                this.remotedisTextId = R.string.DevConnectServerError;
                return;
            } else if (i == 2) {
                this.remotedis.setText(getString(R.string.DevConnectServerError) + ":" + i);
                this.remotedisTextId = R.string.DevConnectServerError;
                return;
            } else {
                this.remotedis.setText(getString(R.string.cantreachserver));
                this.remotedisTextId = R.string.cantreachserver;
                return;
            }
        }
        this.PIN_monitor.setText("PIN: " + this.randomnum.toString());
        this.remotedis.setText(getString(R.string.updata));
        this.remotedisTextId = R.string.updata;
        if (this.NetErrorCount > 12) {
            ShowMessage(R.string.str_ReconnectSucc);
            SendDataThread sendDataThread = this.sendData;
            if (sendDataThread != null) {
                sendDataThread.SetMyTCPRun(true);
            }
            System.out.println("Login Success!");
        }
        this.NetErrorCount = 0;
        this.HBhandler.removeCallbacks(this.tcpHeartbeat);
        this.HBhandler.postDelayed(this.tcpHeartbeat, 100L);
        this.HBneedrun = true;
        System.out.print("启动心跳报文检测线程");
    }

    public void StopNowConn() {
        SendDataThread sendDataThread;
        if (this.myApp.isconnect && (sendDataThread = this.sendData) != null) {
            sendDataThread.setIsstopcon(true);
        }
        this.myApp.isconnect = false;
        this.myApp.isStartWalkTest = false;
        SendDataThread sendDataThread2 = this.sendData;
        if (sendDataThread2 != null) {
            sendDataThread2.StopMyself();
            GotoSleep(200);
            this.sendData = null;
        }
        stoptcpthread();
        StartAddInvalidatadataThread();
    }

    public void stoptcpthread() {
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient != null) {
            int i = this.ifuploaddata;
            if (i == 1 || i == 3) {
                System.out.print("开始停止!");
                this.m_RetransDataProcess.RemoteMonitor = -1;
                this.m_RetransDataProcess.tcpupload(null, 0, (byte) 3);
                System.out.print("发送登出命令!");
                SendDataThread sendDataThread = this.sendData;
                if (sendDataThread != null) {
                    sendDataThread.SetMyTCPRun(false);
                }
                this.remotedis.setText(getString(R.string.Readyforupload));
                this.remotedisTextId = R.string.Readyforupload;
            } else if (i == 2) {
                tSocketClient.RemoteMonitor = -1;
                this.m_RetransDataProcess.tcpupload(null, 0, (byte) 23);
                this.m_RetransDataProcess.tcpupload(null, 0, (byte) 19);
                System.out.println("监控端登出,时间:" + String.valueOf(System.currentTimeMillis()));
                this.remotedis.setText(getString(R.string.DatasrcServer));
                this.remotedisTextId = R.string.DatasrcServer;
            }
            System.out.print("停止网络连接线程");
            this.m_RetransDataProcess.StopMyself();
            GotoSleep(200);
            this.m_RetransDataProcess = null;
            this.HBhandler.removeCallbacks(this.tcpHeartbeat);
            this.HBneedrun = false;
            return;
        }
        int i2 = this.ifuploaddata;
        if (i2 == 1 || i2 == 3) {
            SendDataThread sendDataThread2 = this.sendData;
            if (sendDataThread2 != null) {
                sendDataThread2.SetMyTCPRun(false);
            }
            this.remotedis.setText(getString(R.string.Readyforupload));
            this.remotedisTextId = R.string.Readyforupload;
            return;
        }
        if (i2 == 2) {
            System.out.println("监控端登出,时间:" + String.valueOf(System.currentTimeMillis()));
            this.remotedis.setText(getString(R.string.DatasrcServer));
            this.remotedisTextId = R.string.DatasrcServer;
        }
    }

    public void ProcessMontiorLogInResult(int i) {
        if (i == -1) {
            this.remotedis.setText(getString(R.string.DevConnectServerError));
            this.remotedisTextId = R.string.DevConnectServerError;
            ReConnectToServer();
            return;
        }
        if (i != 0) {
            if (i == 1) {
                this.remotedis.setText(getString(R.string.PINError));
                this.remotedisTextId = R.string.PINError;
                return;
            } else {
                this.remotedis.setText(getString(R.string.DevConnectServerError));
                this.remotedisTextId = R.string.DevConnectServerError;
                return;
            }
        }
        this.myApp.isconnect = true;
        this.remotedis.setText(R.string.RecvDataFromServer);
        this.remotedisTextId = R.string.RecvDataFromServer;
        this.m_RetransDataProcess.tcpupload(null, 0, (byte) 24);
        GotoSleep(200);
        this.m_RetransDataProcess.tcpuploadCMD(new byte[]{2}, 1, (byte) 20);
        this.m_RetransDataProcess.datahandler = this.m_RecvDataProcess.mHandler;
        this.m_RetransDataProcess.startprocessdata = true;
        this.HBneedrun = true;
        this.HBhandler.removeCallbacks(this.tcpHeartbeat);
        this.HBhandler.postDelayed(this.tcpHeartbeat, 100L);
        System.out.print("启动心跳报文检测线程");
    }

    public void ConnectRemoteDevice() {
        if (this.m_RetransDataProcess == null) {
            System.out.println("网络连接无效!");
            return;
        }
        String str = this.CDKEY + "|" + this.verifycode;
        this.m_RetransDataProcess.monitorlogonresult = -1;
        this.m_RetransDataProcess.m_devicelogoninfo = str;
        this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.StartServer;
    }

    public void SetBigFaceColor() {
        ((LinearLayout) this.myViewGroupright.getChildAt(0).findViewById(R.id.datas)).setBackgroundResource(R.drawable.rectangle_edge);
    }

    public void SetecgchannelColor() {
        MyViewGroup myViewGroup = this.myViewGroupleft;
        this.lv = (LinearLayout) myViewGroup.getChildAt(myViewGroup.currentScreenIndex).findViewById(R.id.channels);
        this.view_1.setBackgroundResource(R.drawable.channelbgpatient3);
        this.view_2.setBackgroundResource(R.drawable.channelbgpatient3);
        this.view_3.setBackgroundResource(R.drawable.channelbgpatient);
        this.view_4.setBackgroundResource(R.drawable.channelbgpatient1);
        this.view_ECGII.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGI.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGIII.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGavR.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGavL.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGavF.setBackgroundResource(R.drawable.channelbgpatient2);
        this.view_ECGV.setBackgroundResource(R.drawable.channelbgpatient2);
        this.lv.setBackgroundResource(R.drawable.channelbgpatient1);
        this.view_1.setpaintcolor(this.nECGcolor);
        this.view_2.setpaintcolor(this.nECGcolor);
        this.view_3.setpaintcolor(this.nSpo2color);
        this.view_4.setpaintcolor(this.nRespcolor);
        this.view_ECGII.setpaintcolor(this.nECGcolor);
        this.view_ECGI.setpaintcolor(this.nECGcolor);
        this.view_ECGIII.setpaintcolor(this.nECGcolor);
        this.view_ECGavR.setpaintcolor(this.nECGcolor);
        this.view_ECGavL.setpaintcolor(this.nECGcolor);
        this.view_ECGavF.setpaintcolor(this.nECGcolor);
        this.view_ECGV.setpaintcolor(this.nECGcolor);
        this.ecg_channel1_tx.setTextColor(this.nECGcolor);
        this.ecg_channel2_tx.setTextColor(this.nECGcolor);
        this.ecg_gain.setTextColor(this.nECGcolor);
        this.resp_gain.setTextColor(this.nRespcolor);
        this.mon.setTextColor(this.nECGcolor);
        this.ecg_gain1.setTextColor(this.nECGcolor);
        this.mon1.setTextColor(this.nECGcolor);
        this.ecgspeed.setTextColor(this.nECGcolor);
        this.ecgspeed1.setTextColor(this.nECGcolor);
        this.spo2speed.setTextColor(this.nSpo2color);
        this.respspeed.setTextColor(this.nRespcolor);
        ((TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.spo2name)).setTextColor(this.nSpo2color);
        ((TextView) this.myViewGroupleft.getChildAt(0).findViewById(R.id.Respname)).setTextColor(this.nRespcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGIIname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGIname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGIIIname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGavLname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGavRname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGavFname)).setTextColor(this.nECGcolor);
        ((TextView) this.myViewGroupleft.getChildAt(1).findViewById(R.id.ECGVname)).setTextColor(this.nECGcolor);
    }

    public void LoginOutAndRefreshFace() {
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.menubottom);
        this.myLayout.setBackgroundDrawable(this.nBackAll);
        linearLayout.setVisibility(0);
        this.btnLogout.setVisibility(4);
        this.nECGcolor = this.res.getColor(R.color.black);
        this.nSpo2color = this.res.getColor(R.color.SPo2clorPatient);
        this.nRespcolor = this.res.getColor(R.color.RespclorPatient);
        this.nTempcolor = this.res.getColor(R.color.NibpclorPatient);
        SetecgchannelColor();
        SetBigFaceColor();
    }

    private void stopTest() {
        this.isstart = true;
    }

    public void ResetAlarmStatus() {
        AlarmShowThread alarmShowThread = this.m_AlarmShowThread;
        if (alarmShowThread != null) {
            alarmShowThread.StopMute();
        }
    }

    public void StartAlarmMute() {
        AlarmShowThread alarmShowThread = this.m_AlarmShowThread;
        if (alarmShowThread != null) {
            alarmShowThread.StartMute();
        }
    }

    private void setECGChannelText() {
        this.hr_lock = gzj.getBoolean("hr_lock", true);
        boolean z = gzj.getBoolean("HRxlscswitch", false);
        this.hrsc_lock = z;
        if (!z) {
            this.HRSCAlarmList.DeleteAllHRSCAlarm();
            this.ECGPVCSValue.setText("----");
            this.PVCSalarmImg.setVisibility(0);
        } else {
            this.ECGPVCSValue.setText(getPVCSValue() + "");
            this.PVCSalarmImg.setVisibility(4);
        }
        this.hr_high = gzj.getInt(GzjSharePref.KEY_HR_ALARM_HIGH, 120);
        this.hr_low = gzj.getInt(GzjSharePref.KEY_HR_ALARM_LOW, 50);
        int i = gzj.getInt("ecgalarmlevel", 1);
        this.hr_alarmlevel = i;
        RefreshParaAlarmlevel(1, i);
        int i2 = gzj.getInt("ecgHRsource", 0);
        if (this.ecgHRsource != i2) {
            this.ecgHRsource = i2;
            if (i2 == 0) {
                this.mydata.ClearPRFlagList();
                this.bpm.setTextColor(this.nECGcolor);
                this.bpm.setText("" + ((int) this.mydata.GetParadata(1)));
            } else if (i2 == 1) {
                this.bpm.setTextColor(this.nSpo2color);
                this.bpm.setText("" + ((int) this.mydata.GetParadata(3)));
            }
        }
        if (!this.hr_lock) {
            this.ecgalarmbmp.setImageResource(R.drawable.noalarm);
            this.ecgalarmbmp.setVisibility(0);
        } else {
            this.ecgalarmbmp.setVisibility(4);
        }
    }

    private void setSpO2ChannelText() {
        this.spo2_lock = gzj.getBoolean("spo2alarmswitch", true);
        this.spo2_high = gzj.getInt("Spo2AlarmHigh", 100);
        this.spo2_low = gzj.getInt(GzjSharePref.KEY_SPO2_ALARM_LOW, 90);
        int i = gzj.getInt("SpO2alarmlevel", 1);
        this.SpO2alarmlevel = i;
        RefreshParaAlarmlevel(2, i);
        RefreshParaAlarmlevel(3, this.SpO2alarmlevel);
        this.m_PRAlarmHigh = gzj.getInt("PRAlarmHigh", 120);
        this.m_PRAlarmLow = gzj.getInt("PRAlarmLow", 50);
        if (!this.spo2_lock) {
            this.spo2alarmbmp.setVisibility(0);
            this.spo2alarmbmp.setImageResource(R.drawable.noalarm);
        } else {
            this.spo2alarmbmp.setVisibility(4);
        }
    }

    private void setRespChannelText() {
        this.resp_lock = gzj.getBoolean("respalarmswitch", true);
        this.resp_high = gzj.getInt(GzjSharePref.KEY_RESP_ALARM_HIGH, 30);
        this.resp_low = gzj.getInt(GzjSharePref.KEY_RESP_ALARM_LOW, 8);
        this.m_ZhixiAlarmTime = gzj.getInt("zhixialarm", 2) * 10;
        int i = gzj.getInt("respalarmlevel", 1);
        this.m_respalarmlevel = i;
        RefreshParaAlarmlevel(4, i);
        if (!this.resp_lock) {
            this.respalarmbmp.setImageResource(R.drawable.noalarm);
            this.respalarmbmp.setVisibility(0);
        } else {
            this.respalarmbmp.setVisibility(4);
        }
    }

    private void setTempChannelText() {
        this.temp_lock = gzj.getBoolean("tempalarmswitch", false);
        int i = gzj.getInt("tempalarmlevel", 1);
        this.m_tempalarmlevel = i;
        RefreshParaAlarmlevel(5, i);
        this.temp_high = gzj.getFloat("m_tempHigh_C", 39.0f);
        this.temp_low = gzj.getFloat("m_tempLow_C", 36.0f);
        int i2 = gzj.getInt("tempunit", 0);
        this.m_tempunit = i2;
        if (i2 == 1) {
            this.tempUnit.setText("°F");
        } else if (i2 == 0) {
            this.tempUnit.setText("°C");
        }
        if (!this.temp_lock) {
            this.tempalarmbmp.setImageResource(R.drawable.noalarm);
            this.tempalarmbmp.setVisibility(0);
        } else {
            this.tempalarmbmp.setVisibility(4);
        }
    }

    private void setNIBPChannelText() {
        boolean z = gzj.getBoolean("nibpalarmswitch", false);
        this.nibp_lock = z;
        if (!z) {
            this.ParaAlarmList.DeleteAlarmFromList(R.string.sys_low);
            this.ParaAlarmList.DeleteAlarmFromList(R.string.sys_high);
            this.ParaAlarmList.DeleteAlarmFromList(R.string.dia_low);
            this.ParaAlarmList.DeleteAlarmFromList(R.string.dia_high);
            TextView textView = this.mmhg;
            if (textView != null) {
                textView.setVisibility(0);
            }
            RecvDataProcess recvDataProcess = this.m_RecvDataProcess;
            if (recvDataProcess != null) {
                recvDataProcess.LastNIBPSYSAlarmTextId = -1;
                this.m_RecvDataProcess.LastNIBPDIAAlarmTextId = -1;
            }
        }
        int i = gzj.getInt("nibpalarmlevel", 1);
        this.m_nibpalarmlevel = i;
        RefreshParaAlarmlevel(7, i);
        RefreshParaAlarmlevel(8, this.m_nibpalarmlevel);
        int i2 = gzj.getInt("nibpunit", 0);
        this.m_nibpunit = i2;
        if (i2 == 0) {
            this.sys_high = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 160.0f);
            this.sys_low = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 90.0f);
            this.dia_high = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 90.0f);
            this.dia_low = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 50.0f);
            this.m_nibpMAPAlarmHigh = gzj.getFloat("nibpMAPAlarmHigh", 110.0f);
            this.m_nibpMAPAlarmLow = gzj.getFloat("nibpMAPAlarmLow", 60.0f);
            this.NIBPunit.setText("mmHg");
            if (this.array[3] != 0.0f) {
                this.mmhg.setText(Math.round(this.array[3]) + "/" + Math.round(this.array[5]));
                this.map.setText(Math.round(this.array[4]) + "");
            }
        } else {
            this.sys_high = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 21.0f);
            this.sys_low = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 12.0f);
            this.dia_high = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 12.0f);
            this.dia_low = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 7.0f);
            this.m_nibpMAPAlarmHigh = gzj.getFloat("nibpMAPAlarmHigh", 15.0f);
            this.m_nibpMAPAlarmLow = gzj.getFloat("nibpMAPAlarmLow", 8.0f);
            this.NIBPunit.setText("kPa");
            if (this.array[0] != 0.0f) {
                this.mmhg.setText((Math.round(this.array[0] * 10.0f) / 10.0f) + "/" + (Math.round(this.array[2] * 10.0f) / 10.0f));
                this.map.setText((Math.round(this.array[1] * 10.0f) / 10.0f) + "");
            }
        }
        RecvDataProcess recvDataProcess2 = this.m_RecvDataProcess;
        if (recvDataProcess2 != null) {
            this.NIBPTestTime.setText(recvDataProcess2.strNIBPTestTime);
        }
        if (this.nibp_lock) {
            this.nibpalarmbmp.setVisibility(4);
        } else {
            this.nibpalarmbmp.setImageResource(R.drawable.noalarm);
            this.nibpalarmbmp.setVisibility(0);
        }
    }

    private void setSTChannelText() {
        this.m_STShow = gzj.getBoolean("STShowSwitch", false);
        this.m_STAlarmSwitch = gzj.getBoolean("STAlarmSwitch", false);
        int i = gzj.getInt("stalarmlevel", 1);
        this.m_stalarmlevel = i;
        RefreshParaAlarmlevel(6, i);
        this.m_STAlarmHigh = gzj.getFloat("STAlarmHigh", 0.02f);
        this.m_STAlarmLow = gzj.getFloat("STAlarmLow", -0.02f);
        ImageView imageView = this.STalarmbmp;
        if (imageView == null) {
            return;
        }
        if (this.m_STAlarmSwitch) {
            imageView.setVisibility(4);
        } else {
            imageView.setImageResource(R.drawable.noalarm);
            this.STalarmbmp.setVisibility(0);
        }
    }

    public void SetECGChannelGain(float f) {
        String str = "x" + f;
        RefreshText(this.ecg_gain, str);
        RefreshText(this.ecg_gain1, str);
        this.view_1.setRateY(f);
        this.view_2.setRateY(f);
        this.view_ECGII.setRateY(f);
        this.view_ECGI.setRateY(f);
        this.view_ECGIII.setRateY(f);
        this.view_ECGavR.setRateY(f);
        this.view_ECGavL.setRateY(f);
        this.view_ECGavF.setRateY(f);
        this.view_ECGV.setRateY(f);
    }

    public void SetECGChannelSpeed(float f) {
        String str = f + "mm/S";
        RefreshText(this.ecgspeed, str);
        RefreshText(this.ecgspeed1, str);
        this.view_1.setRateX(f);
        this.view_2.setRateX(f);
        this.view_ECGII.setRateX(f);
        this.view_ECGI.setRateX(f);
        this.view_ECGIII.setRateX(f);
        this.view_ECGavR.setRateX(f);
        this.view_ECGavL.setRateX(f);
        this.view_ECGavF.setRateX(f);
        this.view_ECGV.setRateX(f);
    }

    private void setChannelText() {
        int i = gzj.getInt("ecgchanno1", 1);
        this.ecgchanno1 = i;
        switch (i) {
            case 0:
                this.ecg_channel1_tx.setText("I");
                break;
            case 1:
                this.ecg_channel1_tx.setText("II");
                break;
            case 2:
                this.ecg_channel1_tx.setText("III");
                break;
            case 3:
                this.ecg_channel1_tx.setText("AVL");
                break;
            case 4:
                this.ecg_channel1_tx.setText("AVR");
                break;
            case 5:
                this.ecg_channel1_tx.setText("AVF");
                break;
            case 6:
                this.ecg_channel1_tx.setText(ExifInterface.GPS_MEASUREMENT_INTERRUPTED);
                break;
        }
        int i2 = gzj.getInt("ecgchanno2", 0);
        this.ecgchanno2 = i2;
        switch (i2) {
            case 0:
                this.ecg_channel2_tx.setText("I");
                break;
            case 1:
                this.ecg_channel2_tx.setText("II");
                break;
            case 2:
                this.ecg_channel2_tx.setText("III");
                break;
            case 3:
                this.ecg_channel2_tx.setText("AVL");
                break;
            case 4:
                this.ecg_channel2_tx.setText("AVR");
                break;
            case 5:
                this.ecg_channel2_tx.setText("AVF");
                break;
            case 6:
                this.ecg_channel2_tx.setText(ExifInterface.GPS_MEASUREMENT_INTERRUPTED);
                break;
        }
        int i3 = gzj.getInt("ecggain", 2);
        if (i3 == 0) {
            SetECGChannelGain(0.25f);
        } else if (i3 == 1) {
            SetECGChannelGain(0.5f);
        } else if (i3 == 2) {
            SetECGChannelGain(1.0f);
        } else if (i3 == 3) {
            SetECGChannelGain(1.5f);
        } else if (i3 == 4) {
            SetECGChannelGain(2.0f);
        }
        int i4 = gzj.getInt("ecgspeed", 1);
        if (i4 == 0) {
            SetECGChannelSpeed(12.5f);
        } else if (i4 == 1) {
            SetECGChannelSpeed(25.0f);
        } else if (i4 == 2) {
            SetECGChannelSpeed(50.0f);
        }
        int i5 = gzj.getInt("ecgfilter", 1);
        if (i5 == 0) {
            this.mon.setText(R.string.diagnose);
            this.mon1.setText(R.string.diagnose);
        } else if (i5 == 1) {
            this.mon.setText(R.string.watch);
            this.mon1.setText(R.string.watch);
        } else if (i5 == 2) {
            this.mon.setText(R.string.operter);
            this.mon1.setText(R.string.operter);
        }
        if (this.myApp.isconnect) {
            this.Deviceno.setText(gzj.getString("Devicename", ""));
        } else {
            this.Deviceno.setText(" ");
        }
        int i6 = gzj.getInt("spo2speed", 1);
        if (i6 == 0) {
            this.spo2speed.setText("12.5mm/S");
            this.view_3.setRateX(12.5f);
        } else if (i6 == 1) {
            this.spo2speed.setText("25mm/S");
            this.view_3.setRateX(25.0f);
        }
        int i7 = gzj.getInt("respspeed", 0);
        if (i7 == 0) {
            this.respspeed.setText("6.25mm/S");
            this.view_4.setRateX(6.25f);
        } else if (i7 == 1) {
            this.respspeed.setText("12.5mm/S");
            this.view_4.setRateX(12.5f);
        } else if (i7 == 2) {
            this.respspeed.setText("25mm/S");
            this.view_4.setRateX(25.0f);
        }
        int i8 = gzj.getInt("respgain", 2);
        if (i8 == 0) {
            this.resp_gain.setText("*0.25");
            this.view_4.setRateY(0.25f);
        } else if (i8 == 1) {
            this.resp_gain.setText("*0.5");
            this.view_4.setRateY(0.5f);
        } else if (i8 == 2) {
            this.resp_gain.setText("*1");
            this.view_4.setRateY(1.0f);
        } else if (i8 == 3) {
            this.resp_gain.setText("*2");
            this.view_4.setRateY(2.0f);
        } else if (i8 == 4) {
            this.resp_gain.setText("*4");
            this.view_4.setRateY(4.0f);
        }
        SetECTJXTextTip();
    }

    public void RefreshParaAlarmlevel(int i, int i2) {
        switch (i) {
            case 1:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.hr_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.hr_high, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.ECGstop, i2);
                break;
            case 2:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.spo2_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.spo2_high, i2);
                break;
            case 3:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.PR_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.PR_high, i2);
                break;
            case 4:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.resp_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.resp_high, i2);
                break;
            case 5:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.temp_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.temp_high, i2);
                break;
            case 6:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.ST_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.ST_high, i2);
                break;
            case 7:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.sys_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.sys_high, i2);
                break;
            case 8:
                this.ParaAlarmList.RefreshAlarmlevel(R.string.dia_low, i2);
                this.ParaAlarmList.RefreshAlarmlevel(R.string.dia_high, i2);
                break;
        }
    }

    public void getExtremeValue() {
        this.m_currentAlarmVol = gzj.getFloat("AlarmCurrentVolume", 1.0f);
        this.m_AlarmPauseTime = gzj.getInt("AlarmPauseTime", 120);
        setECGChannelText();
        setSTChannelText();
        setSpO2ChannelText();
        setRespChannelText();
        setNIBPChannelText();
        setTempChannelText();
    }

    public void WriteAddressToFile(String str, String str2) {
        if (gzj.getString("address", "00").equals(str)) {
            return;
        }
        gzj.edit().putInt("nibptest", 0).commit();
        gzj.edit().putString("address", str).commit();
        gzj.edit().putString("Devicename", str2).commit();
    }

    public void checkTexts() {
        this.m_AlarmPauseTime = gzj.getInt("AlarmPauseTime", 120);
        int i = gzj.getInt("ecgfilter", 1);
        if (i == 0) {
            this.mon.setText(R.string.diagnose);
            this.mon1.setText(R.string.diagnose);
        } else if (i == 1) {
            this.mon.setText(R.string.watch);
            this.mon1.setText(R.string.watch);
        } else if (i == 2) {
            this.mon.setText(R.string.operter);
            this.mon1.setText(R.string.operter);
        }
        this.spo2xhname.setText(R.string.spo2xh);
        ((TextView) this.myViewGroupright.getChildAt(0).findViewById(R.id.Spo2xhname)).setText(R.string.spo2xh);
        int i2 = this.remotedisTextId;
        if (i2 != 0) {
            this.remotedis.setText(i2);
        }
        RecvDataProcess recvDataProcess = this.m_RecvDataProcess;
        if (recvDataProcess != null) {
            recvDataProcess.LanguRefresh();
        }
        RefreshPatientInfo();
        if (this.isfrozen) {
            this.txFreeze.setText(R.string.frozen);
            this.txFreeze1.setText(R.string.frozen);
        }
        SetECTJXTextTip();
    }

    private void RefreshText(final TextView textView, final String str) {
        textView.post(new Runnable() {
            @Override
            public void run() {
                textView.setText(str);
            }
        });
    }

    private void RefreshBMP(final ImageView imageView, final boolean z) {
        imageView.post(new Runnable() {
            @Override
            public void run() {
                if (!z) {
                    imageView.setImageResource(R.drawable.noalarm);
                    imageView.setVisibility(0);
                } else {
                    imageView.setVisibility(4);
                }
            }
        });
    }

    public void RefreshPatientInfo() {
        int i;
        TSocketClient tSocketClient;
        this.m_bedno = "bed " + gzj.getInt("Bedno", 1);
        this.m_PatientName = gzj.getString("PatientName", "Rose");
        int i2 = gzj.getInt("PatientType", 0);
        TextView textView = this.txBedno;
        if (textView != null) {
            textView.setText(this.m_bedno);
        }
        TextView textView2 = this.txPatientType;
        if (textView2 != null) {
            if (i2 == 0) {
                textView2.setText(R.string.Adult);
            } else {
                textView2.setText(R.string.Child);
            }
        }
        if (this.m_nPatientType != i2) {
            if (this.myApp.isconnect && this.sendData != null) {
                this.myApp.paraList.clear();
                this.myApp.paraList.add((byte) 2);
                this.myApp.paraList.add(Byte.valueOf((byte) i2));
                this.sendData.paraList = this.myApp.paraList;
                this.sendData.SetNowCommand(SendDataThread.DeviceState.SetSetPara);
            }
            if (this.myApp.isconnect && (((i = this.ifuploaddata) == 1 || i == 3) && (tSocketClient = this.m_RetransDataProcess) != null && tSocketClient.m_bConnected)) {
                this.myApp.OtherparaList.clear();
                this.myApp.OtherparaList.add((byte) 2);
                this.myApp.OtherparaList.add(Byte.valueOf((byte) i2));
                this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
                this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
            }
            this.m_nPatientType = i2;
            gzj.edit().putInt(GzjSharePref.KEY_HR_ALARM_HIGH, 120).commit();
            gzj.edit().putInt(GzjSharePref.KEY_HR_ALARM_LOW, 50).commit();
            setECGChannelText();
            if (this.m_nibpunit == 0) {
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 160.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 90.0f);
                gzj.edit().putFloat("nibpMAPAlarmHigh", 110.0f);
                gzj.edit().putFloat("nibpMAPAlarmLow", 60.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 90.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 50.0f);
            } else {
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 21.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 12.0f);
                gzj.edit().putFloat("nibpMAPAlarmHigh", 15.0f);
                gzj.edit().putFloat("nibpMAPAlarmLow", 8.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 12.0f);
                gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 7.0f);
            }
            setNIBPChannelText();
            gzj.edit().putInt(GzjSharePref.KEY_RESP_ALARM_HIGH, 30);
            gzj.edit().putInt(GzjSharePref.KEY_RESP_ALARM_LOW, 8);
            setRespChannelText();
        }
    }

    public void GotoSleep(int i) {
        try {
            Thread.sleep(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void ShowMessage(int i) {
        View inflate = getLayoutInflater().inflate(R.layout.mytoast, (ViewGroup) null);
        Toast toast = new Toast(getApplicationContext());
        toast.setView(inflate);
        toast.setGravity(17, -150, 0);
        ((TextView) inflate.findViewById(R.id.toastInfo)).setText(i);
        toast.show();
    }

    public void StartAddInvalidatadataThread() {
        if (this.m_AddInvalidateDataThread == null) {
            AddInvalidateDataThread addInvalidateDataThread = new AddInvalidateDataThread(this);
            this.m_AddInvalidateDataThread = addInvalidateDataThread;
            addInvalidateDataThread.start();
        }
    }

    public void SetBPPara() {
        AppGlobal appGlobal = (AppGlobal) getApplication();
        this.sendData.m_nibpisuse1 = appGlobal.m_nibpisuse1;
        this.sendData.m_nibpisuse2 = appGlobal.m_nibpisuse2;
        this.sendData.m_nibpisuse3 = appGlobal.m_nibpisuse3;
        this.sendData.m_nibpisuse4 = appGlobal.m_nibpisuse4;
        this.sendData.m_nibpautoFailreTest = appGlobal.m_nibpautoFailreTest;
        this.sendData.m_nibpFirstPress = appGlobal.m_nibpFirstPress;
        this.sendData.m_nibptimeHour1 = appGlobal.m_nibptimeHour1;
        this.sendData.m_nibptimeHour2 = appGlobal.m_nibptimeHour2;
        this.sendData.m_nibptimeHour3 = appGlobal.m_nibptimeHour3;
        this.sendData.m_nibptimeHour4 = appGlobal.m_nibptimeHour4;
        this.sendData.m_nibptimeMin1 = appGlobal.m_nibptimeMin1;
        this.sendData.m_nibptimeMin2 = appGlobal.m_nibptimeMin1;
        this.sendData.m_nibptimeMin3 = appGlobal.m_nibptimeMin2;
        this.sendData.m_nibptimeMin4 = appGlobal.m_nibptimeMin3;
        this.sendData.m_Spinnernibptime1 = appGlobal.m_Spinnernibptime1;
        this.sendData.m_Spinnernibptime2 = appGlobal.m_Spinnernibptime2;
        this.sendData.m_Spinnernibptime3 = appGlobal.m_Spinnernibptime3;
        this.sendData.m_Spinnernibptime4 = appGlobal.m_Spinnernibptime4;
    }

    public void StartParasettingActivity(int i) {
        Bundle bundle = new Bundle();
        Intent intent = new Intent();
        intent.putExtras(bundle);
        switch (i) {
            case 1:
                intent.setClass(this, ECGParaSettingActivity.class);
                startActivityForResult(intent, 4);
                break;
            case 2:
                intent.setClass(this, SPOSettingActivity.class);
                startActivityForResult(intent, 7);
                break;
            case 3:
                intent.setClass(this, RespSettingActivity.class);
                startActivityForResult(intent, 9);
                break;
            case 4:
                bundle.putInt("ifuploaddata", this.ifuploaddata);
                bundle.putBoolean("isconnect", this.myApp.isconnect);
                intent.putExtras(bundle);
                intent.setClass(this, NIBPSettingActivity.class);
                startActivityForResult(intent, 10);
                break;
            case 5:
                intent.setClass(this, TempSettingActivity.class);
                startActivityForResult(intent, 8);
                break;
            case 6:
                intent.setClass(this, STSettingActivity.class);
                startActivityForResult(intent, 6);
                break;
            case 7:
                intent.setClass(this, Menu.class);
                startActivityForResult(intent, 12);
                this.btnFunSetting.setBackgroundResource(R.drawable.menuing);
                break;
        }
        overridePendingTransition(R.anim.zoomin, 0);
    }

    public void FreezeWave() {
        if (this.myApp.isconnect || this.myApp.isStartWalkTest) {
            if (this.isfrozen) {
                this.isfrozen = false;
                this.txFreeze.setText("");
                this.txFreeze1.setText("");
            } else {
                this.isfrozen = true;
                this.txFreeze.setText(R.string.frozen);
                this.txFreeze1.setText(R.string.frozen);
            }
        }
    }

    public void SetECTJXTextTip() {
        if (this.m_bDemo) {
            this.txDemotext.setText(R.string.DEMOText);
            this.txDemotext1.setText(R.string.DEMOText);
        } else {
            this.txDemotext.setText("");
            this.txDemotext1.setText("");
        }
        if (this.myApp.isconnect) {
            if (gzj.getBoolean("ECGJZswitch", false)) {
                this.txECGJZTip.setText(R.string.ECGJZTip);
                this.txECGJZTip1.setText(R.string.ECGJZTip);
            } else {
                this.txECGJZTip.setText("");
                this.txECGJZTip1.setText("");
            }
        }
    }

    public void SendMuteParaToNet() {
        TSocketClient tSocketClient = this.m_RetransDataProcess;
        if (tSocketClient == null || !tSocketClient.m_bConnected) {
            return;
        }
        this.myApp.OtherparaList.clear();
        this.myApp.OtherparaList.add((byte) 16);
        if (isalarm) {
            this.myApp.OtherparaList.add((byte) 16);
        } else {
            this.myApp.OtherparaList.add(Byte.valueOf(ConstDefine.msg_RemoteOffLine));
        }
        this.m_RetransDataProcess.paraList = this.myApp.OtherparaList;
        this.m_RetransDataProcess.myNowCommand = TSocketClient.DeviceState.UpChangedPara;
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.connect:
                if (this.myApp.isconnect) {
                    StartDisConnect();
                    break;
                } else if (this.ifuploaddata == 2) {
                    startActivityForResult(new Intent(this, (Class<?>) VerificationCode.class), 25);
                    break;
                } else {
                    searchBluetooth();
                    break;
                }
            case R.id.manual_input_bp:
                new ManualInputNibpPopupWindow(this, new ManualInputNibpPopupWindow.ManualInputNibpConfirmClickListener() {
                    @Override
                    public void onConfirmClick(String str, String str2, String str3) {
                        KLog.i("Manual input nibp value: " + str + ", " + str2 + ", " + str3);
                        MainActivity.this.mmhg.setText(str + "/" + str2);
                        MainActivity.this.map.setText(str3);
                        MainActivity.this.stopNibp();
                        MainActivity.this.mClickHandler.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                MainActivity.this.startWalkTestReportActivity(true, "", 0);
                            }
                        }, 2000L);
                    }
                }).showPopupWindow();
                break;
            case R.id.menu:
                StartParasettingActivity(7);
                break;
            case R.id.mute:
                if (!alarming) {
                    ShowMessage(R.string.toast_noalarmvolume);
                    break;
                } else {
                    if (isalarm) {
                        isalarm = false;
                        ResetAlarmStatus();
                    } else {
                        isalarm = true;
                        StartAlarmMute();
                    }
                    SendMuteParaToNet();
                    break;
                }
            case R.id.startBP:
                StartBPTestingActivity();
                break;
            case R.id.start_bp:
                startNibp();
                break;
        }
    }

    public void startNibp() {
        startNibp(0L);
    }

    public void startNibp(long j) {
        if (AppGlobal.isAutoBp) {
            KLog.d("start nibp");
            Message message = new Message();
            message.what = 9;
            this.handler.sendMessageDelayed(message, j);
            this.m_txnibpStart.setVisibility(4);
            this.myApp.SetBPFinish(0);
            this.isNibpTesting = true;
            startNibpUi();
        }
    }

    public void stopNibp() {
        if (AppGlobal.isAutoBp) {
            KLog.d("stop nibp");
            Message message = new Message();
            message.what = 12;
            this.handler.sendMessage(message);
            this.m_txnibpStart.setVisibility(0);
            this.myApp.SetBPFinish(-1);
            this.isNibpTesting = true;
        }
    }

    public void StartBPTestingActivity() {
        Intent intent = new Intent();
        intent.setClass(this, NIBPTestting.class);
        startActivityForResult(intent, 11);
        overridePendingTransition(R.anim.zoomin, 0);
        this.btnStartNIBP.setBackgroundResource(R.drawable.nibping);
    }

    public void RemoteDevOffline() {
        this.stopconnect = true;
        this.myApp.isconnect = false;
        this.myApp.isStartWalkTest = false;
        StopNowConn();
        this.btnConnect.setImageResource(R.drawable.bluetooth_search);
        ProcessalarmInfo(R.string.wrong, 1, 0);
        GotoSleep(500);
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putInt("popuptextview", R.string.str_RemoteLogout);
        bundle.putBoolean("onlyconfirm", true);
        intent.putExtras(bundle);
        intent.setClass(this, PopUpDialogActivity.class);
        startActivity(intent);
    }

    public void StartDisConnect() {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putInt("popuptextview", R.string.dialog_Disconnect);
        intent.putExtras(bundle);
        intent.setClass(this, PopUpDialogActivity.class);
        startActivityForResult(intent, 13);
    }

    @Override
    public void onSensorChanged(SensorEvent sensorEvent) {
        if (getRequestedOrientation() != 6) {
            setRequestedOrientation(6);
        }
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        GestureDetector gestureDetector = this.mGestureDetector;
        if (gestureDetector != null) {
            gestureDetector.onTouchEvent(motionEvent);
        }
        super.dispatchTouchEvent(motionEvent);
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        GestureDetector gestureDetector = this.mGestureDetector;
        if (gestureDetector == null) {
            return false;
        }
        return gestureDetector.onTouchEvent(motionEvent);
    }

    private void monitorBatteryState() {
        this.batteryLevelRcvr = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                if (MainActivity.this.ivBTPowerImage != null && "android.intent.action.BATTERY_CHANGED".equals(intent.getAction())) {
                    int intExtra = ((intent.getIntExtra("level", 0) * 100) / intent.getIntExtra("scale", 100)) / 25;
                    if (MainActivity.this.m_RetransDataProcess != null && MainActivity.this.ifuploaddata == 3) {
                        MainActivity.this.m_RetransDataProcess.m_nPadBattery = intExtra;
                    }
                    if (intExtra == 0) {
                        MainActivity.this.ivBTPowerImage.setImageResource(R.drawable.btpower0);
                        return;
                    }
                    if (intExtra == 1) {
                        MainActivity.this.ivBTPowerImage.setImageResource(R.drawable.btpower1);
                    } else if (intExtra == 2) {
                        MainActivity.this.ivBTPowerImage.setImageResource(R.drawable.btpower2);
                    } else {
                        if (intExtra != 3) {
                            return;
                        }
                        MainActivity.this.ivBTPowerImage.setImageResource(R.drawable.btpower3);
                    }
                }
            }
        };
        IntentFilter intentFilter = new IntentFilter("android.intent.action.BATTERY_CHANGED");
        this.batteryLevelFilter = intentFilter;
        registerReceiver(this.batteryLevelRcvr, intentFilter);
    }

    public static int GetAllPara(byte[] bArr) {
        SharedPreferences sharedPreferences = gzj;
        if (sharedPreferences == null) {
            return 0;
        }
        int i = sharedPreferences.getInt("nibpFirstPress", 240);
        bArr[0] = 1;
        bArr[1] = (byte) (i & 255);
        bArr[2] = (byte) ((i & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[3] = 0;
        bArr[4] = (byte) gzj.getInt("nibptimeHour1", 8);
        bArr[5] = (byte) gzj.getInt("nibptimeMin1", 0);
        bArr[6] = (byte) gzj.getInt("Spinnernibptime1", 30);
        bArr[7] = (byte) gzj.getInt("nibptimeHour2", 20);
        bArr[8] = (byte) gzj.getInt("nibptimeMin2", 0);
        bArr[9] = (byte) gzj.getInt("Spinnernibptime2", 30);
        bArr[10] = -1;
        bArr[11] = 0;
        bArr[12] = 0;
        bArr[13] = -1;
        bArr[14] = 0;
        bArr[15] = 0;
        bArr[16] = 0;
        bArr[17] = 0;
        bArr[18] = 0;
        bArr[19] = 2;
        bArr[20] = (byte) gzj.getInt("PatientType", 0);
        bArr[21] = 3;
        bArr[22] = (byte) gzj.getInt("ecgleadtype", 1);
        bArr[23] = 4;
        bArr[24] = (byte) gzj.getInt("ecgfilter", 1);
        bArr[25] = 5;
        bArr[26] = (byte) gzj.getInt("ecggain", 2);
        bArr[27] = 6;
        bArr[28] = (byte) ((gzj.getInt("STISO", 80) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[29] = (byte) (gzj.getInt("STISO", 80) & 255);
        bArr[30] = (byte) ((gzj.getInt("STValue", 108) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[31] = (byte) (gzj.getInt("STValue", 108) & 255);
        bArr[32] = 7;
        bArr[33] = (byte) gzj.getInt("ecgcalHR", 0);
        bArr[34] = 8;
        bArr[35] = (byte) gzj.getInt("respgain", 2);
        bArr[36] = 9;
        bArr[37] = (byte) (gzj.getInt("respgain", 2) * 10);
        bArr[38] = 13;
        bArr[39] = (byte) gzj.getInt("ecgalarmlevel", 1);
        bArr[40] = 13;
        bArr[41] = (byte) (gzj.getInt("SpO2alarmlevel", 1) | 16);
        bArr[42] = 13;
        bArr[43] = (byte) (gzj.getInt("respalarmlevel", 1) | 32);
        bArr[44] = 13;
        bArr[45] = (byte) (gzj.getInt("tempalarmlevel", 1) | 48);
        bArr[46] = 13;
        bArr[47] = (byte) (gzj.getInt("nibpalarmlevel", 1) | 64);
        bArr[48] = 13;
        bArr[49] = (byte) (gzj.getInt("stalarmlevel", 1) | 80);
        bArr[50] = 14;
        bArr[51] = 0;
        int i2 = 120;
        bArr[52] = (byte) (gzj.getInt(GzjSharePref.KEY_HR_ALARM_HIGH, 120) & 255);
        bArr[53] = (byte) ((gzj.getInt(GzjSharePref.KEY_HR_ALARM_HIGH, 120) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[54] = (byte) (gzj.getInt(GzjSharePref.KEY_HR_ALARM_LOW, 50) & 255);
        bArr[55] = (byte) ((gzj.getInt(GzjSharePref.KEY_HR_ALARM_LOW, 50) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[56] = 14;
        bArr[57] = 1;
        bArr[58] = (byte) (gzj.getInt("Spo2AlarmHigh", 100) & 255);
        bArr[59] = (byte) ((gzj.getInt("Spo2AlarmHigh", 100) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[60] = (byte) (gzj.getInt(GzjSharePref.KEY_SPO2_ALARM_LOW, 90) & 255);
        bArr[61] = (byte) ((gzj.getInt(GzjSharePref.KEY_SPO2_ALARM_LOW, 90) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[62] = 14;
        bArr[63] = 2;
        bArr[64] = (byte) (gzj.getInt("PRAlarmHigh", 120) & 255);
        bArr[65] = (byte) ((gzj.getInt("PRAlarmHigh", 120) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[66] = (byte) (gzj.getInt("PRAlarmLow", 50) & 255);
        bArr[67] = (byte) ((gzj.getInt("PRAlarmLow", 50) & MotionEventCompat.ACTION_POINTER_INDEX_MASK) >> 8);
        bArr[68] = 14;
        bArr[69] = 3;
        int i3 = (int) (gzj.getFloat("m_tempHigh_C", 39.0f) * 10.0f);
        bArr[70] = (byte) (i3 & 255);
        bArr[71] = (byte) (i3 >> 8);
        int i4 = (int) (gzj.getFloat("m_tempLow_C", 36.0f) * 10.0f);
        bArr[72] = (byte) (i4 & 255);
        bArr[73] = (byte) (i4 >> 8);
        bArr[74] = 14;
        bArr[75] = 5;
        int i5 = (int) gzj.getFloat("mmHg_tempSYSHigh", 160.0f);
        bArr[76] = (byte) (i5 & 255);
        bArr[77] = (byte) (i5 >> 8);
        int i6 = (int) gzj.getFloat("mmHg_tempSYSLow", 90.0f);
        bArr[78] = (byte) (i6 & 255);
        bArr[79] = (byte) (i6 >> 8);
        bArr[80] = 14;
        bArr[81] = 6;
        int i7 = (int) gzj.getFloat("mmHg_tempDIAHigh", 90.0f);
        bArr[82] = (byte) (i7 & 255);
        bArr[83] = (byte) (i7 >> 8);
        int i8 = (int) gzj.getFloat("mmHg_tempDIALow", 50.0f);
        bArr[84] = (byte) (i8 & 255);
        bArr[85] = (byte) (i8 >> 8);
        bArr[86] = 14;
        bArr[87] = 7;
        int i9 = (int) gzj.getFloat("mmHg_tempMAPHigh", 110.0f);
        bArr[88] = (byte) (i9 & 255);
        bArr[89] = (byte) (i9 >> 8);
        int i10 = (int) gzj.getFloat("mmHg_tempMAPLow", 60.0f);
        bArr[90] = (byte) (i10 & 255);
        bArr[91] = (byte) (i10 >> 8);
        bArr[92] = 14;
        bArr[93] = 8;
        int i11 = gzj.getInt(GzjSharePref.KEY_RESP_ALARM_HIGH, 30);
        bArr[94] = (byte) (i11 & 255);
        bArr[95] = (byte) (i11 >> 8);
        int i12 = gzj.getInt(GzjSharePref.KEY_RESP_ALARM_LOW, 8);
        bArr[96] = (byte) (i12 & 255);
        bArr[97] = (byte) (i12 >> 8);
        bArr[98] = 15;
        bArr[99] = (byte) ((gzj.getBoolean("hr_lock", true) ? (byte) 1 : (byte) 0) | 0);
        bArr[100] = 15;
        bArr[101] = (byte) ((gzj.getBoolean("spo2alarmswitch", true) ? (byte) 1 : (byte) 0) | 16);
        bArr[102] = 15;
        bArr[103] = (byte) ((gzj.getBoolean("respalarmswitch", true) ? (byte) 1 : (byte) 0) | 32);
        bArr[104] = 15;
        bArr[105] = (byte) ((gzj.getBoolean("tempalarmswitch", false) ? (byte) 1 : (byte) 0) | 48);
        bArr[106] = 15;
        bArr[107] = (byte) ((gzj.getBoolean("nibpalarmswitch", false) ? (byte) 1 : (byte) 0) | 64);
        bArr[108] = 15;
        bArr[109] = (byte) ((gzj.getBoolean("HRxlscswitch", false) ? (byte) 1 : (byte) 0) | 96);
        bArr[110] = 16;
        bArr[111] = (byte) (((byte) (alarming ? 1 : 0)) | 16);
        bArr[112] = 16;
        bArr[113] = (byte) (((byte) (gzj.getInt("HRCurrentVolume", 7) != 0 ? 1 : 0)) | 0);
        bArr[114] = ConstDefine.msg_RemoteOffLine;
        bArr[115] = (byte) gzj.getInt("nibpunit", 0);
        bArr[116] = 18;
        bArr[117] = (byte) gzj.getInt("tempunit", 0);
        bArr[118] = 20;
        bArr[119] = (byte) gzj.getInt("ecgspeed", 1);
        int i13 = gzj.getInt("respspeed", 1);
        if (i13 == 0) {
            bArr[120] = 20;
            i2 = 122;
            bArr[121] = 19;
        } else if (i13 == 1) {
            bArr[120] = 20;
            i2 = 122;
            bArr[121] = 16;
        } else if (i13 == 2) {
            bArr[120] = 20;
            i2 = 122;
            bArr[121] = ConstDefine.msg_RemoteOffLine;
        }
        int i14 = gzj.getInt("nibptest", 0);
        if (i14 == 0) {
            int i15 = i2 + 1;
            bArr[i2] = 21;
            int i16 = i15 + 1;
            bArr[i15] = 1;
            return i16;
        }
        if (i14 != 1) {
            return i2;
        }
        int i17 = i2 + 1;
        bArr[i2] = 21;
        int i18 = i17 + 1;
        bArr[i17] = 0;
        return i18;
    }

    public synchronized void ModifyINIFile(int i, int i2) {
        if (i == 1) {
            gzj.edit().putInt("Spinnernibptime1", i2).commit();
            gzj.edit().putInt("Spinnernibptime2", i2).commit();
        } else if (i == 2) {
            gzj.edit().putInt("PatientType", i2).commit();
            TextView textView = this.txPatientType;
            if (textView != null) {
                if (i2 == 0) {
                    RefreshText(textView, getString(R.string.Adult));
                } else {
                    RefreshText(textView, getString(R.string.Child));
                }
            }
            RefreshText(this.txBedno, this.m_bedno);
        } else if (i == 4) {
            gzj.edit().putInt("ecgfilter", i2).commit();
            if (i2 == 0) {
                RefreshText(this.mon, getString(R.string.diagnose));
                RefreshText(this.mon1, getString(R.string.diagnose));
            } else if (i2 == 1) {
                RefreshText(this.mon, getString(R.string.watch));
                RefreshText(this.mon1, getString(R.string.watch));
            } else if (i2 == 2) {
                RefreshText(this.mon, getString(R.string.operter));
                RefreshText(this.mon1, getString(R.string.operter));
            }
        } else if (i == 5) {
            gzj.edit().putInt("ecggain", i2).commit();
            if (i2 == 0) {
                SetECGChannelGain(0.25f);
            } else if (i2 == 1) {
                SetECGChannelGain(0.5f);
            } else if (i2 == 2) {
                SetECGChannelGain(1.0f);
            } else if (i2 == 3) {
                SetECGChannelGain(1.5f);
            } else if (i2 == 4) {
                SetECGChannelGain(2.0f);
            }
        } else if (i != 40) {
            switch (i) {
                case 8:
                    gzj.edit().putInt("respgain", i2).commit();
                    if (i2 == 0) {
                        RefreshText(this.resp_gain, "*0.25");
                        this.view_4.setRateY(0.25f);
                        break;
                    } else if (i2 == 1) {
                        RefreshText(this.resp_gain, "*0.5");
                        this.view_4.setRateY(0.5f);
                        break;
                    } else if (i2 == 2) {
                        RefreshText(this.resp_gain, "*1");
                        this.view_4.setRateY(1.0f);
                        break;
                    } else if (i2 == 3) {
                        RefreshText(this.resp_gain, "*2");
                        this.view_4.setRateY(2.0f);
                        break;
                    } else if (i2 == 4) {
                        RefreshText(this.resp_gain, "*4");
                        this.view_4.setRateY(4.0f);
                        break;
                    } else {
                        break;
                    }
                case 9:
                    gzj.edit().putInt("zhixialarm", i2).commit();
                    break;
                case 10:
                    if (i2 != 0) {
                        gzj.edit().putBoolean("hr_lock", true).commit();
                        this.hr_lock = true;
                    } else {
                        gzj.edit().putBoolean("hr_lock", false).commit();
                        this.hr_lock = false;
                    }
                    RefreshBMP(this.ecgalarmbmp, this.hr_lock);
                    break;
                case 11:
                    if (i2 != 0) {
                        gzj.edit().putBoolean("spo2alarmswitch", true).commit();
                        this.spo2_lock = true;
                    } else {
                        gzj.edit().putBoolean("spo2alarmswitch", false).commit();
                        this.spo2_lock = false;
                    }
                    RefreshBMP(this.spo2alarmbmp, this.spo2_lock);
                    break;
                case 12:
                    if (i2 != 0) {
                        gzj.edit().putBoolean("respalarmswitch", true).commit();
                        this.resp_lock = true;
                    } else {
                        gzj.edit().putBoolean("respalarmswitch", false).commit();
                        this.resp_lock = false;
                    }
                    RefreshBMP(this.respalarmbmp, this.resp_lock);
                    break;
                default:
                    switch (i) {
                        case 17:
                            int i3 = (i2 & 240) >> 4;
                            int i4 = i2 & 15;
                            AudioManager audioManager = (AudioManager) getSystemService("audio");
                            if (i2 == 0) {
                                audioManager.setStreamVolume(2, 0, 4);
                                gzj.edit().putInt("HRCurrentVolume", 0).commit();
                                break;
                            } else if (i3 != 0 || i4 <= 0 || gzj.getInt("HRCurrentVolume", 7) != 0) {
                                if (i3 == 1 && i4 == 0) {
                                    gzj.edit().putFloat("AlarmCurrentVolume", 0.0f).commit();
                                    this.m_currentAlarmVol = 0.0f;
                                    RefreshAlarmVol();
                                }
                                if (i3 == 1 && i4 > 0) {
                                    gzj.edit().putFloat("AlarmCurrentVolume", 0.5f).commit();
                                    this.m_currentAlarmVol = 0.5f;
                                    RefreshAlarmVol();
                                    break;
                                }
                            } else {
                                gzj.edit().putInt("HRCurrentVolume", 7).commit();
                                audioManager.setStreamVolume(2, 7, 4);
                                break;
                            }
                            break;
                        case 18:
                            if (this.m_nibpunit != i2) {
                                gzj.edit().putInt("nibpunit", 0).commit();
                                int i5 = gzj.getInt("nibpunit", 0);
                                this.m_nibpunit = i5;
                                if (i5 == 0) {
                                    this.sys_high = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 160.0f);
                                    this.sys_low = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 90.0f);
                                    this.dia_high = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 90.0f);
                                    this.dia_low = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 50.0f);
                                    this.m_nibpMAPAlarmHigh = gzj.getFloat("nibpMAPAlarmHigh", 110.0f);
                                    this.m_nibpMAPAlarmLow = gzj.getFloat("nibpMAPAlarmLow", 60.0f);
                                    RefreshText(this.NIBPunit, "mmHg");
                                    if (this.array[3] != 0.0f) {
                                        RefreshText(this.mmhg, Math.round(this.array[3]) + "/" + Math.round(this.array[5]));
                                        RefreshText(this.map, Math.round(this.array[4]) + "");
                                        break;
                                    }
                                } else {
                                    this.sys_high = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, 21.0f);
                                    this.sys_low = gzj.getFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, 12.0f);
                                    this.dia_high = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, 12.0f);
                                    this.dia_low = gzj.getFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, 7.0f);
                                    this.m_nibpMAPAlarmHigh = gzj.getFloat("nibpMAPAlarmHigh", 15.0f);
                                    this.m_nibpMAPAlarmLow = gzj.getFloat("nibpMAPAlarmLow", 8.0f);
                                    RefreshText(this.NIBPunit, "kPa");
                                    if (this.array[0] != 0.0f) {
                                        RefreshText(this.mmhg, (Math.round(this.array[0] * 10.0f) / 10.0f) + "/" + (Math.round(this.array[2] * 10.0f) / 10.0f));
                                        RefreshText(this.map, (Math.round(this.array[1] * 10.0f) / 10.0f) + "");
                                        break;
                                    }
                                }
                            } else {
                                break;
                            }
                            break;
                        case 19:
                            if (this.m_tempunit != i2) {
                                gzj.edit().putInt("tempunit", 0).commit();
                                this.m_tempunit = i2;
                                if (i2 != 1) {
                                    if (i2 == 0) {
                                        RefreshText(this.tempUnit, "°C");
                                        break;
                                    }
                                } else {
                                    RefreshText(this.tempUnit, "°F");
                                    break;
                                }
                            } else {
                                break;
                            }
                            break;
                        case 20:
                            gzj.edit().putInt(GzjSharePref.KEY_HR_ALARM_HIGH, i2).commit();
                            gzj.edit().putInt("PRAlarmHigh", i2).commit();
                            this.hr_high = i2;
                            break;
                        case 21:
                            gzj.edit().putInt(GzjSharePref.KEY_HR_ALARM_LOW, i2).commit();
                            gzj.edit().putInt("PRAlarmLow", i2).commit();
                            this.hr_low = i2;
                            break;
                        case 22:
                            gzj.edit().putInt("Spo2AlarmHigh", i2).commit();
                            this.spo2_high = i2;
                            break;
                        case 23:
                            gzj.edit().putInt(GzjSharePref.KEY_SPO2_ALARM_LOW, i2).commit();
                            this.spo2_low = i2;
                            break;
                        case 24:
                            gzj.edit().putInt("PRAlarmHigh", i2).commit();
                            this.m_PRAlarmHigh = i2;
                            break;
                        case 25:
                            gzj.edit().putInt("PRAlarmLow", i2).commit();
                            this.m_PRAlarmLow = i2;
                            break;
                        case 26:
                            float f = i2 / 10.0f;
                            gzj.edit().putFloat("m_tempHigh_C", f).commit();
                            this.temp_high = f;
                            break;
                        case 27:
                            float f2 = i2 / 10.0f;
                            gzj.edit().putFloat("m_tempLow_C", f2).commit();
                            this.temp_low = f2;
                            break;
                        default:
                            switch (i) {
                                case 30:
                                    if (this.m_nibpunit == 0) {
                                        float f3 = i2;
                                        this.sys_high = f3;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, f3).commit();
                                        gzj.edit().putFloat("mmHg_tempSYSHigh", f3).commit();
                                        break;
                                    } else {
                                        this.sys_high = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_HIGH, this.sys_high).commit();
                                        gzj.edit().putFloat("kPa_tempSYSHigh", this.sys_high).commit();
                                        break;
                                    }
                                case 31:
                                    if (this.m_nibpunit == 0) {
                                        float f4 = i2;
                                        this.sys_low = f4;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, f4).commit();
                                        gzj.edit().putFloat("mmHg_tempSYSLow", f4).commit();
                                        break;
                                    } else {
                                        this.sys_low = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_SYS_ALARM_LOW, this.sys_low).commit();
                                        gzj.edit().putFloat("kPa_tempSYSLow", this.sys_low).commit();
                                        break;
                                    }
                                case 32:
                                    if (this.m_nibpunit == 0) {
                                        float f5 = i2;
                                        this.dia_high = f5;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, f5).commit();
                                        gzj.edit().putFloat("mmHg_tempDIAHigh", f5).commit();
                                        break;
                                    } else {
                                        this.dia_high = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_HIGH, this.dia_high).commit();
                                        gzj.edit().putFloat("kPa_tempDIAHigh", this.dia_high).commit();
                                        break;
                                    }
                                case 33:
                                    if (this.m_nibpunit == 0) {
                                        float f6 = i2;
                                        this.dia_low = f6;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, f6).commit();
                                        gzj.edit().putFloat("mmHg_tempDIALow", f6).commit();
                                        break;
                                    } else {
                                        this.dia_low = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat(GzjSharePref.KEY_NIBP_DIA_ALARM_LOW, this.dia_low).commit();
                                        gzj.edit().putFloat("kPa_tempDIALow", this.dia_low).commit();
                                        break;
                                    }
                                case 34:
                                    if (this.m_nibpunit == 0) {
                                        float f7 = i2;
                                        this.m_nibpMAPAlarmHigh = f7;
                                        gzj.edit().putFloat("nibpMAPAlarmHigh", f7).commit();
                                        gzj.edit().putFloat("mmHg_tempMAPHigh", f7).commit();
                                        break;
                                    } else {
                                        this.m_nibpMAPAlarmHigh = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat("nibpMAPAlarmHigh", this.m_nibpMAPAlarmHigh).commit();
                                        gzj.edit().putFloat("kPa_tempMAPHigh", this.m_nibpMAPAlarmHigh).commit();
                                        break;
                                    }
                                case 35:
                                    if (this.m_nibpunit == 0) {
                                        float f8 = i2;
                                        this.m_nibpMAPAlarmLow = f8;
                                        gzj.edit().putFloat("nibpMAPAlarmLow", f8).commit();
                                        gzj.edit().putFloat("mmHg_tempMAPLow", f8).commit();
                                        break;
                                    } else {
                                        this.m_nibpMAPAlarmLow = ((i2 * 0.133f) * 10.0f) / 10.0f;
                                        gzj.edit().putFloat("nibpMAPAlarmLow", this.m_nibpMAPAlarmLow).commit();
                                        gzj.edit().putFloat("kPa_tempMAPLow", this.m_nibpMAPAlarmLow).commit();
                                        break;
                                    }
                                case 36:
                                    gzj.edit().putInt(GzjSharePref.KEY_RESP_ALARM_HIGH, i2).commit();
                                    this.resp_high = i2;
                                    break;
                                case 37:
                                    gzj.edit().putInt(GzjSharePref.KEY_RESP_ALARM_LOW, i2).commit();
                                    this.resp_low = i2;
                                    break;
                            }
                    }
            }
        } else if ((i2 & 240) == 0) {
            gzj.edit().putInt("ecgspeed", i2 & 15).commit();
            int i6 = gzj.getInt("ecgspeed", 1);
            if (i6 == 0) {
                SetECGChannelSpeed(12.5f);
            } else if (i6 == 1) {
                SetECGChannelSpeed(25.0f);
            } else if (i6 == 2) {
                SetECGChannelSpeed(50.0f);
            }
        } else {
            int i7 = i2 & 15;
            if (i7 == 3) {
                gzj.edit().putInt("respspeed", 0).commit();
            } else if (i7 == 0) {
                gzj.edit().putInt("respspeed", 1).commit();
            } else if (i7 == 1) {
                gzj.edit().putInt("respspeed", 2).commit();
            }
            int i8 = gzj.getInt("respspeed", 0);
            if (i8 == 0) {
                RefreshText(this.respspeed, "6.25mm/S");
                this.view_4.setRateX(6.25f);
            } else if (i8 == 1) {
                RefreshText(this.respspeed, "12.5mm/S");
                this.view_4.setRateX(12.5f);
            } else if (i8 == 2) {
                RefreshText(this.respspeed, "25mm/S");
                this.view_4.setRateX(25.0f);
            }
        }
    }

    private void startNibpUi() {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            this.myApp.SetBPFinish(extras.getInt("NIBPFinish", -1));
            this.myApp.SetBPType(extras.getInt("NIBPType", 1));
        } else {
            this.myApp.SetBPFinish(-1);
        }
        this.myApp.SetNowNIBPPP(0);
        this.myApp.SetBPResult1("");
        this.myApp.SetBPResult2("");
        this.handler.postDelayed(this.nibpRunnable, 50L);
    }

    public void refreshBPDiscription() {
        int GetBPType = this.myApp.GetBPType();
        if (GetBPType == 1) {
            this.m_txnibpDiscription.setText(R.string.Manualtesting);
            return;
        }
        if (GetBPType == 2) {
            this.m_txnibpDiscription.setText(R.string.Autotesting);
            return;
        }
        if (GetBPType == 3) {
            this.m_txnibpDiscription.setText(R.string.STATtesting);
            return;
        }
        if (GetBPType == 4) {
            this.m_txnibpDiscription.setText(R.string.BPCheck);
        } else if (GetBPType == 5) {
            this.m_txnibpDiscription.setText(R.string.LQCheck);
        } else {
            this.m_txnibpDiscription.setText("");
        }
    }

    public void refreshBPFinish() {
        int GetBPFinish = this.myApp.GetBPFinish();
        String str = "";
        if (GetBPFinish == 10) {
            str = getString(R.string.SysError);
        } else {
            switch (GetBPFinish) {
                case 6:
                    this.handler.postDelayed(this.nibpRunnable, 50L);
                    break;
            }
            this.myApp.SetBPFinish(-1);
            this.m_txnibpDiscription.setText(str);
            this.m_bpBar.setProgress(0);
        }
        this.isNibpTesting = false;
        this.myApp.SetBPFinish(-1);
        this.m_txnibpDiscription.setText(str);
        this.m_bpBar.setProgress(0);
    }
}