|
@@ -0,0 +1,4043 @@
|
|
|
+package com.example.administrator.wingcool_gt9_apk;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.app.PendingIntent;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.Intent;
|
|
|
+import android.content.IntentFilter;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
+import android.content.res.Configuration;
|
|
|
+import android.content.res.Resources;
|
|
|
+import android.graphics.BitmapFactory;
|
|
|
+import android.graphics.Matrix;
|
|
|
+import android.hardware.usb.UsbConstants;
|
|
|
+import android.hardware.usb.UsbDevice;
|
|
|
+import android.hardware.usb.UsbDeviceConnection;
|
|
|
+import android.hardware.usb.UsbEndpoint;
|
|
|
+import android.hardware.usb.UsbInterface;
|
|
|
+import android.hardware.usb.UsbManager;
|
|
|
+import android.net.Uri;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.os.Environment;
|
|
|
+import android.os.Handler;
|
|
|
+import android.os.Message;
|
|
|
+import android.os.SystemClock;
|
|
|
+import android.support.annotation.NonNull;
|
|
|
+import android.support.v4.app.ActivityCompat;
|
|
|
+import android.support.v4.view.ViewPager;
|
|
|
+import android.support.v7.app.AppCompatActivity;
|
|
|
+import android.text.Editable;
|
|
|
+import android.text.TextWatcher;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.View;
|
|
|
+import android.view.animation.Animation;
|
|
|
+import android.view.animation.TranslateAnimation;
|
|
|
+import android.widget.AdapterView;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.EditText;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.Spinner;
|
|
|
+import android.widget.TextView;
|
|
|
+import android.widget.Toast;
|
|
|
+
|
|
|
+import java.io.BufferedReader;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.InputStreamReader;
|
|
|
+import java.io.RandomAccessFile;
|
|
|
+import java.io.Reader;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collection;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Locale;
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
+import java.util.concurrent.Executors;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+public class Config extends AppCompatActivity
|
|
|
+ implements OpenDevicesReceiver.OpenDevicesListener, View.OnClickListener , ViewPager.OnPageChangeListener, AdapterView.OnItemSelectedListener{
|
|
|
+
|
|
|
+ private static final int CONNECTED_SUCCESS = 0;
|
|
|
+ private static final int RECEIVER_MESSAGE_SUCCESS = 1;
|
|
|
+ private static final int SEND_MESSAGE_SUCCESS = 2;
|
|
|
+ private static final int DEBUG_MESSAGE_SUCCESS = 3;
|
|
|
+ private static final int DEBUG_MESSAGE_ERROR = 4;
|
|
|
+
|
|
|
+ private static final String USB_ACTION = "com.host2device";
|
|
|
+ private static final String ACTION_USB_PERMISSION = "com.host2device.USB_PERMISSION";
|
|
|
+ private ExecutorService mThreadPool;
|
|
|
+ private UsbManager mUsbManager;
|
|
|
+ private OpenDevicesReceiver cfgOpenDevicesReceiver;
|
|
|
+ private UsbDeviceConnection mUsbDeviceConnection;
|
|
|
+
|
|
|
+ private UsbEndpoint mUsbEndpointOut;
|
|
|
+ private UsbEndpoint mUsbEndpointIn;
|
|
|
+ private Button mReadCfg;
|
|
|
+ private Button mSendCfg;
|
|
|
+ private byte[] mBytes = new byte[1024];
|
|
|
+ private byte[] mSendData = new byte[1024];
|
|
|
+ private String[] mConfigShow = new String[189];
|
|
|
+
|
|
|
+ private Context mAlertContext;
|
|
|
+
|
|
|
+ String value;
|
|
|
+
|
|
|
+ private boolean isNeedFindDevice = true;
|
|
|
+
|
|
|
+ private int bottonMode = 0;
|
|
|
+
|
|
|
+ private UsbInterface mUsbInterface;
|
|
|
+ private StringBuffer mStringBuffer = new StringBuffer();
|
|
|
+ private Context mContext;
|
|
|
+
|
|
|
+ private Button search_button;
|
|
|
+ private TextView edit_search;
|
|
|
+ private EditText edit_text;
|
|
|
+
|
|
|
+ private EditText editname;
|
|
|
+ //private EditText editdetail;
|
|
|
+ private Button btnsave;
|
|
|
+ private Context mSaveCfgContext;
|
|
|
+
|
|
|
+ private TextView mShow;
|
|
|
+ private TextView tvVenderID;
|
|
|
+
|
|
|
+ //View Sample 定义
|
|
|
+ private CheckBox cbAllDrivingEn,cbDualFreq;
|
|
|
+ private EditText edtFreqAFactor,edtFreqBFactor;
|
|
|
+ private EditText edtPannelBitFreq,edtDuration; //2 bytes
|
|
|
+ private EditText edtFreqA,edtFreqB;
|
|
|
+ private EditText edtDumpShift;
|
|
|
+ private EditText edtSubFrameDrvNum;
|
|
|
+ private Spinner spinDrvOutputR,spinDACGain;
|
|
|
+ private Spinner spinPGAC,spinPGAR,spinRxVcmi,spinPGAGain;
|
|
|
+ private Spinner spinBoostTime,spinVoltage,spinAlterCount;
|
|
|
+ private CheckBox cbExtoscen;
|
|
|
+ private boolean PGAGainSelected = false; //判断是否为刚进去时触发onItemSelected的标志
|
|
|
+ private TextWatcher twBitFreq,twDuration,twFreqAFactor,twFreqBFactor,twFreqA,twFreqB;
|
|
|
+
|
|
|
+ //View Module Switch 定义
|
|
|
+ private CheckBox cbX2Y,cbSito;
|
|
|
+ private Spinner spinStretchRank,spinInterrupt;
|
|
|
+ private CheckBox cbMonitorConsistencyConflictEn,cbFirstFilterDis;
|
|
|
+ private CheckBox cbDiffDivideBy2or4,cbWaterSpeedLimitEn;
|
|
|
+ private CheckBox cbShapeEn,cbWaterProofDis;
|
|
|
+ private CheckBox cbLcdPlusMinusEn,cbESDEn;
|
|
|
+ private CheckBox cbX2X,cbY2Y;
|
|
|
+ private CheckBox cbINTWakeup;
|
|
|
+
|
|
|
+ //View Normal Setting 定义
|
|
|
+ private EditText edtConfigVersion,edtTouchNumber;
|
|
|
+ private EditText edtShakeCnt;
|
|
|
+ private EditText edtFirstFilter,edtNormalFilter;
|
|
|
+ private EditText edtNoiseReduction;
|
|
|
+ private EditText edtScreenTouchLv,edtScreenLeaveLv;
|
|
|
+ private EditText edtLowPowerControl;
|
|
|
+ private Spinner spinRefreshRate;
|
|
|
+ private EditText edtXThreshold,edtYThreshold;
|
|
|
+ private EditText edtSpaceUpDown,edtSpaceLeftRight;
|
|
|
+ private EditText edtStretchR0,edtStretchR1,edtStretchR2,edtStretchRM;
|
|
|
+ private EditText edtMiniFilter;
|
|
|
+ private EditText edtChargingLevelUp;
|
|
|
+ private EditText edtLcdPlusMinusValue,edtConThreshold;
|
|
|
+ private EditText edtShapeRestrain,edtShapeContrl;
|
|
|
+ private EditText edtWaterFrameTime,edtWaterUpdateTime;
|
|
|
+ private EditText edtSlideInEdgeConfig,edtSlideOutEdgeConfig;
|
|
|
+ private EditText edtCombineDis,edtSplitSet;
|
|
|
+ private EditText edtSitoDiffRefLevel;
|
|
|
+
|
|
|
+ //View Channel Setting 定义
|
|
|
+ private EditText edtXOutputMax,edtYOutputMax;
|
|
|
+ private EditText edtDrvGroupAnumber,edtDrvGroupBnumber;
|
|
|
+ private EditText edtSenGroupANumber,edtSenGroupBNumber;
|
|
|
+ private EditText edtSensorCH0,edtSensorCH1,edtSensorCH2,edtSensorCH3,edtSensorCH4,edtSensorCH5,edtSensorCH6,edtSensorCH7,edtSensorCH8,edtSensorCH9;
|
|
|
+ private EditText edtSensorCH10,edtSensorCH11,edtSensorCH12,edtSensorCH13,edtSensorCH14,edtSensorCH15,edtSensorCH16,edtSensorCH17,edtSensorCH18,edtSensorCH19;
|
|
|
+ private EditText edtSensorCH20,edtSensorCH21,edtSensorCH22,edtSensorCH23,edtSensorCH24,edtSensorCH25,edtSensorCH26,edtSensorCH27,edtSensorCH28,edtSensorCH29;
|
|
|
+ private EditText edtSensorStart,edtSensorEnd;
|
|
|
+ private Button btnSensorRev,btnAllSensorChannels;
|
|
|
+ private EditText edtDriverCH0,edtDriverCH1,edtDriverCH2,edtDriverCH3,edtDriverCH4,edtDriverCH5,edtDriverCH6,edtDriverCH7,edtDriverCH8,edtDriverCH9;
|
|
|
+ private EditText edtDriverCH10,edtDriverCH11,edtDriverCH12,edtDriverCH13,edtDriverCH14,edtDriverCH15,edtDriverCH16,edtDriverCH17,edtDriverCH18,edtDriverCH19;
|
|
|
+ private EditText edtDriverCH20,edtDriverCH21,edtDriverCH22,edtDriverCH23,edtDriverCH24,edtDriverCH25,edtDriverCH26,edtDriverCH27,edtDriverCH28,edtDriverCH29;
|
|
|
+ private EditText edtDriverCH30,edtDriverCH31,edtDriverCH32,edtDriverCH33,edtDriverCH34,edtDriverCH35,edtDriverCH36,edtDriverCH37,edtDriverCH38,edtDriverCH39;
|
|
|
+ private EditText edtDriverCH40,edtDriverCH41;
|
|
|
+ private EditText edtDriverStart,edtDriverEnd;
|
|
|
+ private Button btnDriverRev,btnAllDriverChannels;
|
|
|
+ private byte bSensorNumber,bDriverNumber;
|
|
|
+
|
|
|
+ //View Pen Setting 定义
|
|
|
+ private CheckBox cbPenEn,cbOnlyFingerEn;
|
|
|
+ private EditText edtPenLowSize,edtPenHighSize;
|
|
|
+ private EditText edtRectsumPLowL,edtRectsumPHighL;
|
|
|
+ private EditText edtRectsumFLowL;
|
|
|
+ private EditText edtPRectMaxDiffLimit,edtPRectAreaLimit;
|
|
|
+ private EditText edtFLeavelevel,edtPTouchHighlevel;
|
|
|
+ private Spinner spinFingerRestrainPen;
|
|
|
+
|
|
|
+ //View Plam Restrain 定义
|
|
|
+ private CheckBox cbAllPlamRestrain;
|
|
|
+ private EditText edtLargeTouch;
|
|
|
+ private EditText edtExpanNumOutX,edtExpanNumOutY;
|
|
|
+ private EditText edtExpanNumInX,edtExpanNumInY;
|
|
|
+ private EditText edtSingleRectTopSignNum,edtAllRectTopSignSum;
|
|
|
+ private CheckBox cbWaterLargeRestrainEn;
|
|
|
+
|
|
|
+ //View Key Setting 定义
|
|
|
+ private CheckBox cbTouchKey;
|
|
|
+ private EditText edtKeyArea;
|
|
|
+ private EditText edtKey1,edtKey2,edtKey3,edtKey4;
|
|
|
+ private EditText edtKeyTouchLevel,edtKeyLeaveLevel;
|
|
|
+ private EditText edtKeySens1and2,edtKeySens3and4;
|
|
|
+ private EditText edtKeyRestrain,edtKeyRestrainTime;
|
|
|
+
|
|
|
+ //View Hopping Setting 定义
|
|
|
+ private CheckBox cbHoppingEn;
|
|
|
+ private CheckBox cbRangeExt;
|
|
|
+ private EditText edtFreqStart,edtFreqEnd;
|
|
|
+ private EditText edtDetectStayTimes,edtDetectConfirmTimes;
|
|
|
+ private CheckBox cbDisForceRef,cbDelayHopping;
|
|
|
+ private EditText edtFastHopLimit,edtHopThreshold,edtNoiseMinTh,edtSensorGroup;
|
|
|
+ private EditText edtSeg1Normalize,edtSeg1Factor;
|
|
|
+ private EditText edtMainClockAjdust;
|
|
|
+ private EditText edtSeg2Normalize,edtSeg2Factor;
|
|
|
+ private EditText edtSeg3Normalize,edtSeg3Factor;
|
|
|
+ private EditText edtSeg4Normalize,edtSeg4Factor;
|
|
|
+ private EditText edtSeg5Normalize,edtSeg5Factor;
|
|
|
+ private EditText edtSeg6Normalize;
|
|
|
+ private EditText edtHopFreqAddr;
|
|
|
+ private EditText edtHopDetectTimes;
|
|
|
+
|
|
|
+ //View Cfg Ram 定义
|
|
|
+ private EditText mCfg8047,mCfg8048,mCfg8049,mCfg804A,mCfg804B,mCfg804C,mCfg804D,mCfg804E,mCfg804F;
|
|
|
+
|
|
|
+ private EditText mCfg8050,mCfg8051,mCfg8052,mCfg8053,mCfg8054,mCfg8055,mCfg8056,mCfg8057;
|
|
|
+ private EditText mCfg8058,mCfg8059,mCfg805A,mCfg805B,mCfg805C,mCfg805D,mCfg805E,mCfg805F;
|
|
|
+
|
|
|
+ private EditText mCfg8060,mCfg8061,mCfg8062,mCfg8063,mCfg8064,mCfg8065,mCfg8066,mCfg8067;
|
|
|
+ private EditText mCfg8068,mCfg8069,mCfg806A,mCfg806B,mCfg806C,mCfg806D,mCfg806E,mCfg806F;
|
|
|
+
|
|
|
+ private EditText mCfg8070,mCfg8071,mCfg8072,mCfg8073,mCfg8074,mCfg8075,mCfg8076,mCfg8077;
|
|
|
+ private EditText mCfg8078,mCfg8079,mCfg807A,mCfg807B,mCfg807C,mCfg807D,mCfg807E,mCfg807F;
|
|
|
+
|
|
|
+ private EditText mCfg8080,mCfg8081,mCfg8082,mCfg8083,mCfg8084,mCfg8085,mCfg8086,mCfg8087;
|
|
|
+ private EditText mCfg8088,mCfg8089,mCfg808A,mCfg808B,mCfg808C,mCfg808D,mCfg808E,mCfg808F;
|
|
|
+
|
|
|
+ private EditText mCfg8090,mCfg8091,mCfg8092,mCfg8093,mCfg8094,mCfg8095,mCfg8096,mCfg8097;
|
|
|
+ private EditText mCfg8098,mCfg8099,mCfg809A,mCfg809B,mCfg809C,mCfg809D,mCfg809E,mCfg809F;
|
|
|
+
|
|
|
+ private EditText mCfg80A0,mCfg80A1,mCfg80A2,mCfg80A3,mCfg80A4,mCfg80A5,mCfg80A6,mCfg80A7;
|
|
|
+ private EditText mCfg80A8,mCfg80A9,mCfg80AA,mCfg80AB,mCfg80AC,mCfg80AD,mCfg80AE,mCfg80AF;
|
|
|
+
|
|
|
+ private EditText mCfg80B0,mCfg80B1,mCfg80B2,mCfg80B3,mCfg80B4,mCfg80B5,mCfg80B6,mCfg80B7;
|
|
|
+ private EditText mCfg80B8,mCfg80B9,mCfg80BA,mCfg80BB,mCfg80BC,mCfg80BD,mCfg80BE,mCfg80BF;
|
|
|
+
|
|
|
+ private EditText mCfg80C0,mCfg80C1,mCfg80C2,mCfg80C3,mCfg80C4,mCfg80C5,mCfg80C6,mCfg80C7;
|
|
|
+ private EditText mCfg80C8,mCfg80C9,mCfg80CA,mCfg80CB,mCfg80CC,mCfg80CD,mCfg80CE,mCfg80CF;
|
|
|
+
|
|
|
+ private EditText mCfg80D0,mCfg80D1,mCfg80D2,mCfg80D3,mCfg80D4,mCfg80D5,mCfg80D6,mCfg80D7;
|
|
|
+ private EditText mCfg80D8,mCfg80D9,mCfg80DA,mCfg80DB,mCfg80DC,mCfg80DD,mCfg80DE,mCfg80DF;
|
|
|
+
|
|
|
+ private EditText mCfg80E0,mCfg80E1,mCfg80E2,mCfg80E3,mCfg80E4,mCfg80E5,mCfg80E6,mCfg80E7;
|
|
|
+ private EditText mCfg80E8,mCfg80E9,mCfg80EA,mCfg80EB,mCfg80EC,mCfg80ED,mCfg80EE,mCfg80EF;
|
|
|
+
|
|
|
+ private EditText mCfg80F0,mCfg80F1,mCfg80F2,mCfg80F3,mCfg80F4,mCfg80F5,mCfg80F6,mCfg80F7;
|
|
|
+ private EditText mCfg80F8,mCfg80F9,mCfg80FA,mCfg80FB,mCfg80FC,mCfg80FD,mCfg80FE,mCfg80FF;
|
|
|
+ private EditText mCfg8100;
|
|
|
+
|
|
|
+ private ViewPager vpagerCfg;
|
|
|
+ private ImageView img_cursor;
|
|
|
+ private TextView tvSample;
|
|
|
+ private TextView tvModuleSwitch;
|
|
|
+ private TextView tvNormalSetting;
|
|
|
+ private TextView tvChannelSetting;
|
|
|
+ private TextView tvPenSetting;
|
|
|
+ private TextView tvPlamRestrain;
|
|
|
+ private TextView tvKeySetting;
|
|
|
+ private TextView tvHoppingSetting;
|
|
|
+ private TextView tvCfgRam;
|
|
|
+
|
|
|
+ private ArrayList<View> listViews;
|
|
|
+ View viewsample;
|
|
|
+ View viewmoduleswitch;
|
|
|
+ View viewnormalsetting;
|
|
|
+ View viewchannelsetting;
|
|
|
+ View viewpensetting;
|
|
|
+ View viewplamrestrain;
|
|
|
+ View viewkeysetting;
|
|
|
+ View viewhoppingsetting;
|
|
|
+ View viewcfgram;
|
|
|
+ private int offset = 0;//移动条图片的偏移量
|
|
|
+ private int currIndex = 0;//当前页面的编号
|
|
|
+ private int bmpWidth;// 移动条图片的长度
|
|
|
+ private int one = 0; //移动条滑动一页的距离
|
|
|
+ private int two = 0; //滑动条移动两页的距离
|
|
|
+ private int three = 0; //滑动条移动三页的距离
|
|
|
+ private int four = 0; //滑动条移动四页的距离
|
|
|
+ private int five = 0; //滑动条移动五页的距离
|
|
|
+ private int six = 0; //滑动条移动六页的距离
|
|
|
+ private int seven = 0; //滑动条移动七页的距离
|
|
|
+ private int eight = 0; //滑动条移动八页的距离
|
|
|
+ private int nine = 0; //滑动条移动九页的距离
|
|
|
+ private int iChooseVPager = 0; //当前停在哪个vpager
|
|
|
+
|
|
|
+ private byte mSendGetGt9ConfigData[]={
|
|
|
+ 0x03,0x00,0x0f,(byte)0x80,0x47,0x00,0x3f,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ };
|
|
|
+
|
|
|
+ Handler mHandler = new Handler() {
|
|
|
+ @Override
|
|
|
+ public void handleMessage(Message msg) {
|
|
|
+
|
|
|
+ StringBuilder stringBuilder = new StringBuilder("");
|
|
|
+ StringBuffer resultSb = new StringBuffer();
|
|
|
+ // for (int i = 1; i < mBytes.length; i++) {
|
|
|
+ int checksum = 0 ;
|
|
|
+ switch (msg.what) {
|
|
|
+ case CONNECTED_SUCCESS://车机和手机连接成功
|
|
|
+ //mError.setText("");
|
|
|
+ mReadCfg.setEnabled(true);
|
|
|
+ mSendCfg.setEnabled(true);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case RECEIVER_MESSAGE_SUCCESS://成功接受到数据
|
|
|
+ //mSendCfg.setEnabled(true);
|
|
|
+ //String hv = null;
|
|
|
+
|
|
|
+ for (int i = 0; i < 189; i++) {
|
|
|
+
|
|
|
+ if (i == 0 || i == 64 || i == 128)
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ int v = mBytes[i] & 0xFF;
|
|
|
+ checksum =checksum+ v;
|
|
|
+ String hv = Integer.toHexString(v);
|
|
|
+ stringBuilder.append(hv);
|
|
|
+ stringBuilder.append(",");
|
|
|
+ }
|
|
|
+ if(checksum % 256 == 0) //校验和正确
|
|
|
+ {
|
|
|
+ mShow.setText("Cfg Checksum is correct!");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ mShow.setText("Cfg Checksum is error!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //String d_value =Arrays.toString(mBytes);
|
|
|
+ //String d_value =Arrays.hv.toString();
|
|
|
+ //mMessage.setText( stringBuilder.toString() );//输出显示
|
|
|
+ //edit_search.setText(uri.getPath().toString());
|
|
|
+ // mLog.setText(mStringBuffer.toString());
|
|
|
+ break;
|
|
|
+
|
|
|
+ case SEND_MESSAGE_SUCCESS://成功发送数据
|
|
|
+ //mMessage.setText("");
|
|
|
+ break;
|
|
|
+
|
|
|
+ case DEBUG_MESSAGE_SUCCESS://成功发送数据
|
|
|
+ //StringBuilder stringBuilder = new StringBuilder("");
|
|
|
+ // StringBuffer resultSb = new StringBuffer();
|
|
|
+
|
|
|
+ checksum = 0 ;
|
|
|
+ for (int i = 0; i < 216; i++) {
|
|
|
+
|
|
|
+ int v = mSendData[i] & 0xFF;
|
|
|
+ checksum =checksum+ v;
|
|
|
+ //byte v = mSendData[i];
|
|
|
+ String hv = Integer.toHexString(v);
|
|
|
+ //String hv = Byte.toString(v);
|
|
|
+ stringBuilder.append(hv);
|
|
|
+ stringBuilder.append(",");
|
|
|
+ }
|
|
|
+ //mShow.setText(stringBuilder.toString());
|
|
|
+ //mShow.setText(value);
|
|
|
+ break;
|
|
|
+ case DEBUG_MESSAGE_ERROR://成功发送数据
|
|
|
+ //mShow.setText("ERROR");
|
|
|
+ //mError.setText("ERROR");
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.activity_config);
|
|
|
+ mAlertContext = Config.this;
|
|
|
+ ConstantsActivity.activityList.add(this);
|
|
|
+ //switchLanguage(ConstantsActivity.langae);
|
|
|
+ init();
|
|
|
+ }
|
|
|
+
|
|
|
+ //核心设置的代码
|
|
|
+ protected void switchLanguage(String language) {
|
|
|
+ Resources resources = getResources();
|
|
|
+ Configuration config = resources.getConfiguration();
|
|
|
+ DisplayMetrics dm = resources.getDisplayMetrics();
|
|
|
+ switch (language) {
|
|
|
+ case "zh":
|
|
|
+ config.locale = Locale.CHINESE;
|
|
|
+ resources.updateConfiguration(config, dm);
|
|
|
+ break;
|
|
|
+ case "en":
|
|
|
+ config.locale = Locale.ENGLISH;
|
|
|
+ resources.updateConfiguration(config, dm);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ config.locale = Locale.US;
|
|
|
+ resources.updateConfiguration(config, dm);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void init() {
|
|
|
+ initView();
|
|
|
+ initViewPager();
|
|
|
+ initSampleSpin();
|
|
|
+ initModuleSwitchSpin();
|
|
|
+ initNormalSettingSpin();
|
|
|
+ initChannelSettingSpin();
|
|
|
+ initPenSettingSpin();
|
|
|
+ initPlamRestrainSpin();
|
|
|
+ initKeySettingSpin();
|
|
|
+ initHoppingSettingSpin();
|
|
|
+ initCfgShow();
|
|
|
+ initListener();
|
|
|
+ initData();
|
|
|
+ openDevices();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initView() {
|
|
|
+ mReadCfg = (Button) findViewById(R.id.readcfg);
|
|
|
+ mSendCfg = (Button) findViewById(R.id.sendcfg);
|
|
|
+ mShow = (TextView) findViewById(R.id.show);
|
|
|
+
|
|
|
+ search_button = (Button) findViewById(R.id.searchbutton);
|
|
|
+ edit_search = (TextView) findViewById(R.id.editsearch);
|
|
|
+ edit_text = (EditText) findViewById(R.id.editsearch);
|
|
|
+
|
|
|
+ search_button.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ //ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
+ // .Manifest.permission.READ_EXTERNAL_STORAGE}, 2);
|
|
|
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
|
+ intent.setType("*/*");//设置类型,我这里是任意类型,任意后缀的可以这样写。
|
|
|
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
|
+ startActivityForResult(intent, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //editdetail = (EditText) findViewById(R.id.message);
|
|
|
+ editname = (EditText) findViewById(R.id.editname);
|
|
|
+ btnsave = (Button) findViewById(R.id.savecfg);
|
|
|
+ //btnread = (Button) findViewById(R.id.btnread);
|
|
|
+ tvVenderID = (TextView) findViewById(R.id.venderid);
|
|
|
+
|
|
|
+ btnsave.setOnClickListener(this);
|
|
|
+
|
|
|
+ mSaveCfgContext = getApplicationContext();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initViewPager() {
|
|
|
+ vpagerCfg = (ViewPager) findViewById(R.id.vpagercfg);
|
|
|
+
|
|
|
+ tvSample = (TextView) findViewById(R.id.tvsample);
|
|
|
+ tvModuleSwitch = (TextView) findViewById(R.id.tvmoduleswitch);
|
|
|
+ tvNormalSetting = (TextView) findViewById(R.id.tvnormal);
|
|
|
+ tvChannelSetting = (TextView) findViewById(R.id.tvchannel);
|
|
|
+ tvPenSetting = (TextView) findViewById(R.id.tvpen);
|
|
|
+ tvPlamRestrain = (TextView) findViewById(R.id.tvplamrestrain);
|
|
|
+ tvKeySetting = (TextView) findViewById(R.id.tvkey);
|
|
|
+ tvHoppingSetting = (TextView) findViewById(R.id.tvhopping);
|
|
|
+ tvCfgRam = (TextView) findViewById(R.id.tvcfgram);
|
|
|
+
|
|
|
+ img_cursor = (ImageView) findViewById(R.id.img_cursor);
|
|
|
+
|
|
|
+ //下划线动画的相关设置:
|
|
|
+ bmpWidth = BitmapFactory.decodeResource(getResources(), R.mipmap.line).getWidth();// 获取图片宽度
|
|
|
+ DisplayMetrics dm = new DisplayMetrics();
|
|
|
+ getWindowManager().getDefaultDisplay().getMetrics(dm);
|
|
|
+ int screenW = dm.widthPixels;// 获取分辨率宽度
|
|
|
+ //offset = (screenW / 3 - bmpWidth) / 2;// 计算偏移量
|
|
|
+ offset = (screenW / 9 - bmpWidth) / 2;// 计算偏移量
|
|
|
+ Matrix matrix = new Matrix();
|
|
|
+ matrix.postTranslate(offset, 0);
|
|
|
+ img_cursor.setImageMatrix(matrix);// 设置动画初始位置
|
|
|
+ //移动的距离
|
|
|
+ one = offset * 2 + bmpWidth;// 移动一页的偏移量,比如1->2,或者2->3
|
|
|
+ two = one * 2;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ three = one * 3;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ four = one * 4;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ five = one * 5;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ six = one * 6;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ seven = one * 7;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ eight = one * 8;// 移动两页的偏移量,比如1直接跳3
|
|
|
+ nine = one * 9;// 移动两页的偏移量,比如1直接跳3
|
|
|
+
|
|
|
+ //往ViewPager填充View,同时设置点击事件与页面切换事件
|
|
|
+ listViews = new ArrayList<View>();
|
|
|
+
|
|
|
+ //LayoutInflater mInflater = getLayoutInflater();
|
|
|
+ viewsample = View.inflate(this,R.layout.view_sample, null);
|
|
|
+ viewmoduleswitch = View.inflate(this,R.layout.view_module_switch, null);
|
|
|
+ viewnormalsetting = View.inflate(this,R.layout.view_normal_setting, null);
|
|
|
+ viewchannelsetting = View.inflate(this,R.layout.view_channel_setting, null);
|
|
|
+ viewpensetting = View.inflate(this,R.layout.view_pen_setting, null);
|
|
|
+ viewplamrestrain = View.inflate(this,R.layout.view_plam_restrain, null);
|
|
|
+ viewkeysetting = View.inflate(this,R.layout.view_key_setting, null);
|
|
|
+ viewhoppingsetting = View.inflate(this,R.layout.view_hopping_setting, null);
|
|
|
+ viewcfgram = View.inflate(this,R.layout.view_cfg_ram, null);
|
|
|
+
|
|
|
+ //listViews.add(mInflater.inflate(R.layout.view_one, null, false));
|
|
|
+ //listViews.add(mInflater.inflate(R.layout.view_two, null, false));
|
|
|
+ //listViews.add(mInflater.inflate(R.layout.view_three, null, false));
|
|
|
+
|
|
|
+ listViews.add(viewsample);
|
|
|
+ listViews.add(viewmoduleswitch);
|
|
|
+ listViews.add(viewnormalsetting);
|
|
|
+ listViews.add(viewchannelsetting);
|
|
|
+ listViews.add(viewpensetting);
|
|
|
+ listViews.add(viewplamrestrain);
|
|
|
+ listViews.add(viewkeysetting);
|
|
|
+ listViews.add(viewhoppingsetting);
|
|
|
+ listViews.add(viewcfgram);
|
|
|
+ vpagerCfg.setAdapter(new MyPagerAdapter(listViews));
|
|
|
+ vpagerCfg.setCurrentItem(0); //设置ViewPager当前页,从0开始算
|
|
|
+
|
|
|
+ tvSample.setOnClickListener(this);
|
|
|
+ tvModuleSwitch.setOnClickListener(this);
|
|
|
+ tvNormalSetting.setOnClickListener(this);
|
|
|
+ tvChannelSetting.setOnClickListener(this);
|
|
|
+ tvPenSetting.setOnClickListener(this);
|
|
|
+ tvPlamRestrain.setOnClickListener(this);
|
|
|
+ tvKeySetting.setOnClickListener(this);
|
|
|
+ tvHoppingSetting.setOnClickListener(this);
|
|
|
+ tvCfgRam.setOnClickListener(this);
|
|
|
+
|
|
|
+ vpagerCfg.addOnPageChangeListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================各view中的元素初始化开始===============================================//
|
|
|
+ private void initSampleSpin() {
|
|
|
+ cbAllDrivingEn = viewsample.findViewById(R.id.alldrivingen);
|
|
|
+ cbDualFreq = viewsample.findViewById(R.id.dualfreq);
|
|
|
+ edtFreqAFactor = viewsample.findViewById(R.id.freqafactor);
|
|
|
+ edtFreqBFactor = viewsample.findViewById(R.id.freqbfactor);
|
|
|
+ edtPannelBitFreq = viewsample.findViewById(R.id.bitfreq);
|
|
|
+ edtDuration = viewsample.findViewById(R.id.duration);
|
|
|
+ edtFreqA = viewsample.findViewById(R.id.freqa);
|
|
|
+ edtFreqB = viewsample.findViewById(R.id.freqb);
|
|
|
+ twBitFreq = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float fduration = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ edtDuration.removeTextChangedListener(twDuration);
|
|
|
+ try {
|
|
|
+ ibitfreq = Integer.parseInt(s.toString(),10);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ibitfreq = 1;
|
|
|
+ }
|
|
|
+ fduration = (float) (1000000.0 / ibitfreq);
|
|
|
+ CharSequence csduration = Float.toString(fduration);
|
|
|
+ //删除.后面超过两位的数字
|
|
|
+ if (csduration.toString().contains(".")) {
|
|
|
+ if (csduration.length() - 1 - csduration.toString().indexOf(".") > 2) {
|
|
|
+ csduration = csduration.toString().subSequence(0,
|
|
|
+ csduration.toString().indexOf(".") + 3);
|
|
|
+ edtDuration.setText(csduration);
|
|
|
+ //edtDuration.setSelection(csduration.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果.在起始位置,则起始位置自动补0
|
|
|
+ if (csduration.toString().trim().substring(0).equals(".")) {
|
|
|
+ csduration = "0" + csduration;
|
|
|
+ edtDuration.setText(csduration);
|
|
|
+ //edtDuration.setSelection(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果起始位置为0并且第二位跟的不是".",则无法后续输入
|
|
|
+ if (csduration.toString().startsWith("0")
|
|
|
+ && csduration.toString().trim().length() > 1) {
|
|
|
+ if (!csduration.toString().substring(1, 2).equals(".")) {
|
|
|
+ edtDuration.setText(csduration.subSequence(0, 1));
|
|
|
+ //edtDuration.setSelection(1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ edtDuration.setText(csduration.toString());
|
|
|
+ ffactortemp = (float)(ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int)ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int)ffactortemp;
|
|
|
+ ifreq = Integer.parseInt(edtFreqAFactor.getText().toString(),10) * ibitfreq;
|
|
|
+ edtFreqA.setText(Integer.toString(ifreq));
|
|
|
+ ifreq = Integer.parseInt(edtFreqBFactor.getText().toString(),10) * ibitfreq;
|
|
|
+ edtFreqB.setText(Integer.toString(ifreq));
|
|
|
+
|
|
|
+ edtPannelBitFreq.setSelection(s.length());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ edtDuration.addTextChangedListener(twDuration);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ twDuration = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float fduration = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ if (bottonMode == 0) {
|
|
|
+ edtPannelBitFreq.removeTextChangedListener(twBitFreq);
|
|
|
+ try {
|
|
|
+ //删除.后面超过两位的数字
|
|
|
+ if (s.toString().contains(".")) {
|
|
|
+ if (s.length() - 1 - s.toString().indexOf(".") > 2) {
|
|
|
+ s = s.toString().subSequence(0, s.toString().indexOf(".") + 3);
|
|
|
+ edtDuration.setText(s);
|
|
|
+ edtDuration.setSelection(s.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果.在起始位置,则起始位置自动补0
|
|
|
+ if (s.toString().trim().substring(0).equals(".")) {
|
|
|
+ s = "0" + s;
|
|
|
+ edtDuration.setText(s);
|
|
|
+ edtDuration.setSelection(2);
|
|
|
+ }
|
|
|
+
|
|
|
+ //如果起始位置为0并且第二位跟的不是".",则无法后续输入
|
|
|
+ if (s.toString().startsWith("0")
|
|
|
+ && s.toString().trim().length() > 1) {
|
|
|
+ if (!s.toString().substring(1, 2).equals(".")) {
|
|
|
+ edtDuration.setText(s.subSequence(0, 1));
|
|
|
+ edtDuration.setSelection(1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ fduration = Float.parseFloat(s.toString());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ fduration = 1;
|
|
|
+ }
|
|
|
+ ibitfreq = (int) (1000000 / fduration);
|
|
|
+ edtPannelBitFreq.setText(Integer.toString(ibitfreq));
|
|
|
+ ffactortemp = (float) (ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int) ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int) ffactortemp;
|
|
|
+ ifreq = Integer.parseInt(edtFreqAFactor.getText().toString(), 10) * ibitfreq;
|
|
|
+ edtFreqA.setText(Integer.toString(ifreq));
|
|
|
+ ifreq = Integer.parseInt(edtFreqBFactor.getText().toString(), 10) * ibitfreq;
|
|
|
+ edtFreqB.setText(Integer.toString(ifreq));
|
|
|
+ }
|
|
|
+ bottonMode = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ /*
|
|
|
+ String temp = s.toString();
|
|
|
+ //int posDot = temp.indexOf(".");
|
|
|
+ if (temp.indexOf(".") > 0){//(posDot > 0){
|
|
|
+ int posDot = s.length() - 1 - temp.indexOf(".");
|
|
|
+ if (posDot > 2){
|
|
|
+ s.delete(temp.indexOf(".") + 3, temp.length());
|
|
|
+ edtDuration.setText(s.toString());
|
|
|
+ edtDuration.setSelection(s.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
+ edtPannelBitFreq.addTextChangedListener(twBitFreq);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ edtPannelBitFreq.addTextChangedListener(twBitFreq);
|
|
|
+ edtDuration.addTextChangedListener(twDuration);
|
|
|
+
|
|
|
+ twFreqAFactor = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ //edtFreqA.removeTextChangedListener(twFreqA);
|
|
|
+ try {
|
|
|
+ ifactortemp = Integer.parseInt(s.toString(),10);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ifactortemp = 0;
|
|
|
+ }
|
|
|
+ ibitfreq = Integer.parseInt(edtPannelBitFreq.getText().toString(),10);
|
|
|
+ ffactortemp = (float)(ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int)ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int)ffactortemp;
|
|
|
+ ifreq = ifactortemp * ibitfreq;
|
|
|
+ edtFreqA.setText(Integer.toString(ifreq));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ //edtFreqA.addTextChangedListener(twFreqA);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ /*
|
|
|
+ twFreqA = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float fduration = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ edtFreqAFactor.removeTextChangedListener(twFreqAFactor);
|
|
|
+ try {
|
|
|
+ ifreq = Integer.parseInt(s.toString());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ifreq = 0;
|
|
|
+ }
|
|
|
+ ibitfreq = Integer.parseInt(edtPannelBitFreq.getText().toString());
|
|
|
+ ffactortemp = (float)(ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int)ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int)ffactortemp;
|
|
|
+ if (ibitfreq == 0){
|
|
|
+ ibitfreq = 1;
|
|
|
+ }
|
|
|
+ edtFreqAFactor.setText(Integer.toString(ifreq / ibitfreq));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ edtFreqAFactor.addTextChangedListener(twFreqAFactor);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ */
|
|
|
+ edtFreqAFactor.addTextChangedListener(twFreqAFactor);
|
|
|
+ //edtFreqA.addTextChangedListener(twFreqA);
|
|
|
+
|
|
|
+ twFreqBFactor = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ //edtFreqB.removeTextChangedListener(twFreqB);
|
|
|
+ try {
|
|
|
+ ifactortemp = Integer.parseInt(s.toString(),10);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ifactortemp = 0;
|
|
|
+ }
|
|
|
+ ibitfreq = Integer.parseInt(edtPannelBitFreq.getText().toString(),10);
|
|
|
+ ffactortemp = (float)(ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int)ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int)ffactortemp;
|
|
|
+ ifreq = ifactortemp * ibitfreq;
|
|
|
+ edtFreqB.setText(Integer.toString(ifreq));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ //edtFreqB.addTextChangedListener(twFreqB);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ /*
|
|
|
+ twFreqB = new TextWatcher(){
|
|
|
+ int ibitfreq = 0;
|
|
|
+ float ffactortemp;
|
|
|
+ int ifactortemp;
|
|
|
+ int ifreq;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before,int count) {
|
|
|
+ edtFreqBFactor.removeTextChangedListener(twFreqBFactor);
|
|
|
+ try {
|
|
|
+ ifreq = Integer.parseInt(s.toString());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ifreq = 0;
|
|
|
+ }
|
|
|
+ ibitfreq = Integer.parseInt(edtPannelBitFreq.getText().toString());
|
|
|
+ ffactortemp = (float)(ibitfreq / 57.2205);
|
|
|
+ ifactortemp = (int)ffactortemp;
|
|
|
+ ffactortemp = (float) (ifactortemp * 57.2205);
|
|
|
+ ibitfreq = (int)ffactortemp;
|
|
|
+ if (ibitfreq == 0){
|
|
|
+ ibitfreq = 1;
|
|
|
+ }
|
|
|
+ edtFreqBFactor.setText(Integer.toString(ifreq / ibitfreq));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count,int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ edtFreqBFactor.addTextChangedListener(twFreqBFactor);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ */
|
|
|
+ edtFreqBFactor.addTextChangedListener(twFreqBFactor);
|
|
|
+ //edtFreqB.addTextChangedListener(twFreqB);
|
|
|
+
|
|
|
+ edtDumpShift = viewsample.findViewById(R.id.dumpshift);
|
|
|
+ edtSubFrameDrvNum = viewsample.findViewById(R.id.subframedrvnum);
|
|
|
+ spinDrvOutputR = viewsample.findViewById(R.id.drvoutputr);
|
|
|
+ spinDACGain = viewsample.findViewById(R.id.dacgain);
|
|
|
+ spinPGAC = viewsample.findViewById(R.id.pgac);
|
|
|
+ spinPGAR = viewsample.findViewById(R.id.pgar);
|
|
|
+ spinRxVcmi = viewsample.findViewById(R.id.rxvcmi);
|
|
|
+ spinPGAGain = viewsample.findViewById(R.id.pgagainspin);
|
|
|
+ spinPGAGain.setOnItemSelectedListener(this);
|
|
|
+ spinBoostTime = viewsample.findViewById(R.id.boosttime);
|
|
|
+ spinVoltage = viewsample.findViewById(R.id.voltage);
|
|
|
+ spinAlterCount = viewsample.findViewById(R.id.altercount);
|
|
|
+ cbExtoscen = viewsample.findViewById(R.id.extoscen);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initModuleSwitchSpin() {
|
|
|
+ cbX2Y = viewmoduleswitch.findViewById(R.id.x2y);
|
|
|
+ cbSito = viewmoduleswitch.findViewById(R.id.sito);
|
|
|
+ spinStretchRank = viewmoduleswitch.findViewById(R.id.stretchrank);
|
|
|
+ spinInterrupt = viewmoduleswitch.findViewById(R.id.interrupt);
|
|
|
+ cbMonitorConsistencyConflictEn = viewmoduleswitch.findViewById(R.id.mccen);
|
|
|
+ cbFirstFilterDis = viewmoduleswitch.findViewById(R.id.firstfilterdis);
|
|
|
+ cbDiffDivideBy2or4 = viewmoduleswitch.findViewById(R.id.diffdivideby2or4);
|
|
|
+ cbWaterSpeedLimitEn = viewmoduleswitch.findViewById(R.id.waterspeedlimiten);
|
|
|
+ cbShapeEn = viewmoduleswitch.findViewById(R.id.shapeen);
|
|
|
+ cbWaterProofDis = viewmoduleswitch.findViewById(R.id.waterproofdis);
|
|
|
+ cbLcdPlusMinusEn = viewmoduleswitch.findViewById(R.id.lcdplusminusen);
|
|
|
+ cbESDEn = viewmoduleswitch.findViewById(R.id.esden);
|
|
|
+ cbX2X = viewmoduleswitch.findViewById(R.id.x2x);
|
|
|
+ cbY2Y = viewmoduleswitch.findViewById(R.id.y2y);
|
|
|
+ cbINTWakeup = viewmoduleswitch.findViewById(R.id.intwakeup);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initNormalSettingSpin(){
|
|
|
+ edtConfigVersion = viewnormalsetting.findViewById(R.id.configversion);
|
|
|
+ edtTouchNumber = viewnormalsetting.findViewById(R.id.touchnumber);
|
|
|
+ edtShakeCnt = viewnormalsetting.findViewById(R.id.shakecnt);
|
|
|
+ edtFirstFilter = viewnormalsetting.findViewById(R.id.firstfilter);
|
|
|
+ edtNormalFilter = viewnormalsetting.findViewById(R.id.normalfilter);
|
|
|
+ edtNoiseReduction = viewnormalsetting.findViewById(R.id.noisereduction);
|
|
|
+ edtScreenTouchLv = viewnormalsetting.findViewById(R.id.touchlevel);
|
|
|
+ edtScreenLeaveLv = viewnormalsetting.findViewById(R.id.leavelevel);
|
|
|
+ edtLowPowerControl = viewnormalsetting.findViewById(R.id.lowpowercontrol);
|
|
|
+ spinRefreshRate = viewnormalsetting.findViewById(R.id.refreshrate);
|
|
|
+ edtXThreshold = viewnormalsetting.findViewById(R.id.xthreshold);
|
|
|
+ edtYThreshold = viewnormalsetting.findViewById(R.id.ythreshold);
|
|
|
+ edtSpaceUpDown = viewnormalsetting.findViewById(R.id.spaceupdown);
|
|
|
+ edtSpaceLeftRight = viewnormalsetting.findViewById(R.id.spaceleftright);
|
|
|
+ edtStretchR0 = viewnormalsetting.findViewById(R.id.stretchr0);
|
|
|
+ edtStretchR1 = viewnormalsetting.findViewById(R.id.stretchr1);
|
|
|
+ edtStretchR2 = viewnormalsetting.findViewById(R.id.stretchr2);
|
|
|
+ edtStretchRM = viewnormalsetting.findViewById(R.id.stretchrm);
|
|
|
+ edtMiniFilter = viewnormalsetting.findViewById(R.id.minifilter);
|
|
|
+ edtChargingLevelUp = viewnormalsetting.findViewById(R.id.charginglevelup);
|
|
|
+ edtLcdPlusMinusValue = viewnormalsetting.findViewById(R.id.lcdplusminusvalue);
|
|
|
+ edtConThreshold = viewnormalsetting.findViewById(R.id.conthreshold);
|
|
|
+ edtShapeRestrain = viewnormalsetting.findViewById(R.id.shaperestrain);
|
|
|
+ edtShapeContrl = viewnormalsetting.findViewById(R.id.shapecontrl);
|
|
|
+ edtWaterFrameTime = viewnormalsetting.findViewById(R.id.waterframetime);
|
|
|
+ edtWaterUpdateTime = viewnormalsetting.findViewById(R.id.waterupdatetime);
|
|
|
+ edtSlideInEdgeConfig = viewnormalsetting.findViewById(R.id.slideinedgeconfig);
|
|
|
+ edtSlideOutEdgeConfig = viewnormalsetting.findViewById(R.id.slideoutedgeconfig);
|
|
|
+ edtCombineDis = viewnormalsetting.findViewById(R.id.combinedis);
|
|
|
+ edtSplitSet = viewnormalsetting.findViewById(R.id.splitset);
|
|
|
+ edtSitoDiffRefLevel = viewnormalsetting.findViewById(R.id.sitodiffreflevel);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initChannelSettingSpin(){
|
|
|
+ edtXOutputMax = viewchannelsetting.findViewById(R.id.xoutputmax);
|
|
|
+ edtYOutputMax = viewchannelsetting.findViewById(R.id.youtputmax);
|
|
|
+ edtDrvGroupAnumber = viewchannelsetting.findViewById(R.id.drvgroupanum);
|
|
|
+ edtDrvGroupBnumber = viewchannelsetting.findViewById(R.id.drvgroupbnum);
|
|
|
+ edtSenGroupANumber = viewchannelsetting.findViewById(R.id.sengroupanum);
|
|
|
+ edtSenGroupBNumber = viewchannelsetting.findViewById(R.id.sengroupbnum);
|
|
|
+ edtSensorCH0 = viewchannelsetting.findViewById(R.id.sensorch0);
|
|
|
+ edtSensorCH1 = viewchannelsetting.findViewById(R.id.sensorch1);
|
|
|
+ edtSensorCH2 = viewchannelsetting.findViewById(R.id.sensorch2);
|
|
|
+ edtSensorCH3 = viewchannelsetting.findViewById(R.id.sensorch3);
|
|
|
+ edtSensorCH4 = viewchannelsetting.findViewById(R.id.sensorch4);
|
|
|
+ edtSensorCH5 = viewchannelsetting.findViewById(R.id.sensorch5);
|
|
|
+ edtSensorCH6 = viewchannelsetting.findViewById(R.id.sensorch6);
|
|
|
+ edtSensorCH7 = viewchannelsetting.findViewById(R.id.sensorch7);
|
|
|
+ edtSensorCH8 = viewchannelsetting.findViewById(R.id.sensorch8);
|
|
|
+ edtSensorCH9 = viewchannelsetting.findViewById(R.id.sensorch9);
|
|
|
+ edtSensorCH10 = viewchannelsetting.findViewById(R.id.sensorch10);
|
|
|
+ edtSensorCH11 = viewchannelsetting.findViewById(R.id.sensorch11);
|
|
|
+ edtSensorCH12 = viewchannelsetting.findViewById(R.id.sensorch12);
|
|
|
+ edtSensorCH13 = viewchannelsetting.findViewById(R.id.sensorch13);
|
|
|
+ edtSensorCH14 = viewchannelsetting.findViewById(R.id.sensorch14);
|
|
|
+ edtSensorCH15 = viewchannelsetting.findViewById(R.id.sensorch15);
|
|
|
+ edtSensorCH16 = viewchannelsetting.findViewById(R.id.sensorch16);
|
|
|
+ edtSensorCH17 = viewchannelsetting.findViewById(R.id.sensorch17);
|
|
|
+ edtSensorCH18 = viewchannelsetting.findViewById(R.id.sensorch18);
|
|
|
+ edtSensorCH19 = viewchannelsetting.findViewById(R.id.sensorch19);
|
|
|
+ edtSensorCH20 = viewchannelsetting.findViewById(R.id.sensorch20);
|
|
|
+ edtSensorCH21 = viewchannelsetting.findViewById(R.id.sensorch21);
|
|
|
+ edtSensorCH22 = viewchannelsetting.findViewById(R.id.sensorch22);
|
|
|
+ edtSensorCH23 = viewchannelsetting.findViewById(R.id.sensorch23);
|
|
|
+ edtSensorCH24 = viewchannelsetting.findViewById(R.id.sensorch24);
|
|
|
+ edtSensorCH25 = viewchannelsetting.findViewById(R.id.sensorch25);
|
|
|
+ edtSensorCH26 = viewchannelsetting.findViewById(R.id.sensorch26);
|
|
|
+ edtSensorCH27 = viewchannelsetting.findViewById(R.id.sensorch27);
|
|
|
+ edtSensorCH28 = viewchannelsetting.findViewById(R.id.sensorch28);
|
|
|
+ edtSensorCH29 = viewchannelsetting.findViewById(R.id.sensorch29);
|
|
|
+ edtSensorStart = viewchannelsetting.findViewById(R.id.sensorstart);
|
|
|
+ edtSensorEnd = viewchannelsetting.findViewById(R.id.sensorend);
|
|
|
+ btnSensorRev = viewchannelsetting.findViewById(R.id.btnsensorrev);
|
|
|
+ btnSensorRev.setOnClickListener(this);
|
|
|
+ btnAllSensorChannels = viewchannelsetting.findViewById(R.id.allsensorchannels);
|
|
|
+ btnAllSensorChannels.setOnClickListener(this);
|
|
|
+
|
|
|
+ edtDriverCH0 = viewchannelsetting.findViewById(R.id.driverch0);
|
|
|
+ edtDriverCH1 = viewchannelsetting.findViewById(R.id.driverch1);
|
|
|
+ edtDriverCH2 = viewchannelsetting.findViewById(R.id.driverch2);
|
|
|
+ edtDriverCH3 = viewchannelsetting.findViewById(R.id.driverch3);
|
|
|
+ edtDriverCH4 = viewchannelsetting.findViewById(R.id.driverch4);
|
|
|
+ edtDriverCH5 = viewchannelsetting.findViewById(R.id.driverch5);
|
|
|
+ edtDriverCH6 = viewchannelsetting.findViewById(R.id.driverch6);
|
|
|
+ edtDriverCH7 = viewchannelsetting.findViewById(R.id.driverch7);
|
|
|
+ edtDriverCH8 = viewchannelsetting.findViewById(R.id.driverch8);
|
|
|
+ edtDriverCH9 = viewchannelsetting.findViewById(R.id.driverch9);
|
|
|
+ edtDriverCH10 = viewchannelsetting.findViewById(R.id.driverch10);
|
|
|
+ edtDriverCH11 = viewchannelsetting.findViewById(R.id.driverch11);
|
|
|
+ edtDriverCH12 = viewchannelsetting.findViewById(R.id.driverch12);
|
|
|
+ edtDriverCH13 = viewchannelsetting.findViewById(R.id.driverch13);
|
|
|
+ edtDriverCH14 = viewchannelsetting.findViewById(R.id.driverch14);
|
|
|
+ edtDriverCH15 = viewchannelsetting.findViewById(R.id.driverch15);
|
|
|
+ edtDriverCH16 = viewchannelsetting.findViewById(R.id.driverch16);
|
|
|
+ edtDriverCH17 = viewchannelsetting.findViewById(R.id.driverch17);
|
|
|
+ edtDriverCH18 = viewchannelsetting.findViewById(R.id.driverch18);
|
|
|
+ edtDriverCH19 = viewchannelsetting.findViewById(R.id.driverch19);
|
|
|
+ edtDriverCH20 = viewchannelsetting.findViewById(R.id.driverch20);
|
|
|
+ edtDriverCH21 = viewchannelsetting.findViewById(R.id.driverch21);
|
|
|
+ edtDriverCH22 = viewchannelsetting.findViewById(R.id.driverch22);
|
|
|
+ edtDriverCH23 = viewchannelsetting.findViewById(R.id.driverch23);
|
|
|
+ edtDriverCH24 = viewchannelsetting.findViewById(R.id.driverch24);
|
|
|
+ edtDriverCH25 = viewchannelsetting.findViewById(R.id.driverch25);
|
|
|
+ edtDriverCH26 = viewchannelsetting.findViewById(R.id.driverch26);
|
|
|
+ edtDriverCH27 = viewchannelsetting.findViewById(R.id.driverch27);
|
|
|
+ edtDriverCH28 = viewchannelsetting.findViewById(R.id.driverch28);
|
|
|
+ edtDriverCH29 = viewchannelsetting.findViewById(R.id.driverch29);
|
|
|
+ edtDriverCH30 = viewchannelsetting.findViewById(R.id.driverch30);
|
|
|
+ edtDriverCH31 = viewchannelsetting.findViewById(R.id.driverch31);
|
|
|
+ edtDriverCH32 = viewchannelsetting.findViewById(R.id.driverch32);
|
|
|
+ edtDriverCH33 = viewchannelsetting.findViewById(R.id.driverch33);
|
|
|
+ edtDriverCH34 = viewchannelsetting.findViewById(R.id.driverch34);
|
|
|
+ edtDriverCH35 = viewchannelsetting.findViewById(R.id.driverch35);
|
|
|
+ edtDriverCH36 = viewchannelsetting.findViewById(R.id.driverch36);
|
|
|
+ edtDriverCH37 = viewchannelsetting.findViewById(R.id.driverch37);
|
|
|
+ edtDriverCH38 = viewchannelsetting.findViewById(R.id.driverch38);
|
|
|
+ edtDriverCH39 = viewchannelsetting.findViewById(R.id.driverch39);
|
|
|
+ edtDriverCH40 = viewchannelsetting.findViewById(R.id.driverch40);
|
|
|
+ edtDriverCH41 = viewchannelsetting.findViewById(R.id.driverch41);
|
|
|
+ edtDriverStart = viewchannelsetting.findViewById(R.id.driverstart);
|
|
|
+ edtDriverEnd = viewchannelsetting.findViewById(R.id.driverend);
|
|
|
+ btnDriverRev = viewchannelsetting.findViewById(R.id.btndriverrev);
|
|
|
+ btnDriverRev.setOnClickListener(this);
|
|
|
+ btnAllDriverChannels = viewchannelsetting.findViewById(R.id.alldriverchannels);
|
|
|
+ btnAllDriverChannels.setOnClickListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initPenSettingSpin(){
|
|
|
+ cbPenEn = viewpensetting.findViewById(R.id.penen);
|
|
|
+ cbOnlyFingerEn = viewpensetting.findViewById(R.id.onlyfingeren);
|
|
|
+ edtPenLowSize = viewpensetting.findViewById(R.id.penlowsize);
|
|
|
+ edtPenHighSize = viewpensetting.findViewById(R.id.penhighsize);
|
|
|
+ edtRectsumPLowL = viewpensetting.findViewById(R.id.rectsumplowl);
|
|
|
+ edtRectsumPHighL = viewpensetting.findViewById(R.id.rectsumphighl);
|
|
|
+ edtRectsumFLowL = viewpensetting.findViewById(R.id.rectsumflowl);
|
|
|
+ edtPRectMaxDiffLimit = viewpensetting.findViewById(R.id.prectmaxdifflimit);
|
|
|
+ edtPRectAreaLimit = viewpensetting.findViewById(R.id.prectarealimit);
|
|
|
+ edtFLeavelevel = viewpensetting.findViewById(R.id.fleavelevel);
|
|
|
+ edtPTouchHighlevel = viewpensetting.findViewById(R.id.ptouchhighlevel);
|
|
|
+ spinFingerRestrainPen = viewpensetting.findViewById(R.id.fingerrestrainpen);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initPlamRestrainSpin(){
|
|
|
+ cbAllPlamRestrain = viewplamrestrain.findViewById(R.id.allplamrestrain);
|
|
|
+ edtLargeTouch = viewplamrestrain.findViewById(R.id.largetouch);
|
|
|
+ edtExpanNumOutX = viewplamrestrain.findViewById(R.id.expannumoutx);
|
|
|
+ edtExpanNumOutY = viewplamrestrain.findViewById(R.id.expannumouty);
|
|
|
+ edtExpanNumInX = viewplamrestrain.findViewById(R.id.expannuminx);
|
|
|
+ edtExpanNumInY = viewplamrestrain.findViewById(R.id.expannuminy);
|
|
|
+ edtSingleRectTopSignNum = viewplamrestrain.findViewById(R.id.singlerecttopsignnum);
|
|
|
+ edtAllRectTopSignSum = viewplamrestrain.findViewById(R.id.allrecttopsignsum);
|
|
|
+ cbWaterLargeRestrainEn = viewplamrestrain.findViewById(R.id.waterlargerestrainen);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initKeySettingSpin(){
|
|
|
+ cbTouchKey = viewkeysetting.findViewById(R.id.touchkey);
|
|
|
+ edtKeyArea = viewkeysetting.findViewById(R.id.keyarea);
|
|
|
+ edtKey1 = viewkeysetting.findViewById(R.id.key1);
|
|
|
+ edtKey2 = viewkeysetting.findViewById(R.id.key2);
|
|
|
+ edtKey3 = viewkeysetting.findViewById(R.id.key3);
|
|
|
+ edtKey4 = viewkeysetting.findViewById(R.id.key4);
|
|
|
+ edtKeyTouchLevel = viewkeysetting.findViewById(R.id.keytouchlevel);
|
|
|
+ edtKeyLeaveLevel = viewkeysetting.findViewById(R.id.keyleavelevel);
|
|
|
+ edtKeySens1and2 = viewkeysetting.findViewById(R.id.keysens1and2);
|
|
|
+ edtKeySens3and4 = viewkeysetting.findViewById(R.id.keysens3and4);
|
|
|
+ edtKeyRestrain = viewkeysetting.findViewById(R.id.keyrestrain);
|
|
|
+ edtKeyRestrainTime = viewkeysetting.findViewById(R.id.keyrestraintime);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initHoppingSettingSpin(){
|
|
|
+ cbHoppingEn = viewhoppingsetting.findViewById(R.id.hoppingen);
|
|
|
+ cbRangeExt = viewhoppingsetting.findViewById(R.id.rangeext);
|
|
|
+ edtFreqStart = viewhoppingsetting.findViewById(R.id.freqstart);
|
|
|
+ edtFreqEnd = viewhoppingsetting.findViewById(R.id.freqend);
|
|
|
+ edtDetectStayTimes = viewhoppingsetting.findViewById(R.id.detectstaytimes);
|
|
|
+ edtDetectConfirmTimes = viewhoppingsetting.findViewById(R.id.detectconfirmtimes);
|
|
|
+ cbDisForceRef = viewhoppingsetting.findViewById(R.id.disforceref);
|
|
|
+ cbDelayHopping = viewhoppingsetting.findViewById(R.id.delayhopping);
|
|
|
+ edtFastHopLimit = viewhoppingsetting.findViewById(R.id.fasthoplimit);
|
|
|
+ edtHopThreshold = viewhoppingsetting.findViewById(R.id.hopthreshold);
|
|
|
+ edtNoiseMinTh = viewhoppingsetting.findViewById(R.id.noiseminth);
|
|
|
+ edtSensorGroup = viewhoppingsetting.findViewById(R.id.sensorgroup);
|
|
|
+ edtSeg1Normalize = viewhoppingsetting.findViewById(R.id.seg1normalize);
|
|
|
+ edtSeg1Factor = viewhoppingsetting.findViewById(R.id.seg1factor);
|
|
|
+ edtMainClockAjdust = viewhoppingsetting.findViewById(R.id.mainclockajdust);
|
|
|
+ edtSeg2Normalize = viewhoppingsetting.findViewById(R.id.seg2normalize);
|
|
|
+ edtSeg2Factor = viewhoppingsetting.findViewById(R.id.seg2factor);
|
|
|
+ edtSeg3Normalize = viewhoppingsetting.findViewById(R.id.seg3normalize);
|
|
|
+ edtSeg3Factor = viewhoppingsetting.findViewById(R.id.seg3factor);
|
|
|
+ edtSeg4Normalize = viewhoppingsetting.findViewById(R.id.seg4normalize);
|
|
|
+ edtSeg4Factor = viewhoppingsetting.findViewById(R.id.seg4factor);
|
|
|
+ edtSeg5Normalize = viewhoppingsetting.findViewById(R.id.seg5normalize);
|
|
|
+ edtSeg5Factor = viewhoppingsetting.findViewById(R.id.seg5factor);
|
|
|
+ edtSeg6Normalize = viewhoppingsetting.findViewById(R.id.seg6normalize);
|
|
|
+ edtHopFreqAddr = viewhoppingsetting.findViewById(R.id.hopfreqaddr);
|
|
|
+ edtHopDetectTimes = viewhoppingsetting.findViewById(R.id.hopdetecttimes);
|
|
|
+ }
|
|
|
+
|
|
|
+ //Cfg Ram 定义
|
|
|
+ private void initCfgShow() {
|
|
|
+ mCfg8047 = viewcfgram.findViewById(R.id.cfg8047);
|
|
|
+ mCfg8048 = viewcfgram.findViewById(R.id.cfg8048);
|
|
|
+ mCfg8049 = viewcfgram.findViewById(R.id.cfg8049);
|
|
|
+ mCfg804A = viewcfgram.findViewById(R.id.cfg804A);
|
|
|
+ mCfg804B = viewcfgram.findViewById(R.id.cfg804B);
|
|
|
+ mCfg804C = viewcfgram.findViewById(R.id.cfg804C);
|
|
|
+ mCfg804D = viewcfgram.findViewById(R.id.cfg804D);
|
|
|
+ mCfg804E = viewcfgram.findViewById(R.id.cfg804E);
|
|
|
+ mCfg804F = viewcfgram.findViewById(R.id.cfg804F);
|
|
|
+
|
|
|
+ mCfg8050 = viewcfgram.findViewById(R.id.cfg8050);
|
|
|
+ mCfg8051 = viewcfgram.findViewById(R.id.cfg8051);
|
|
|
+ mCfg8052 = viewcfgram.findViewById(R.id.cfg8052);
|
|
|
+ mCfg8053 = viewcfgram.findViewById(R.id.cfg8053);
|
|
|
+ mCfg8054 = viewcfgram.findViewById(R.id.cfg8054);
|
|
|
+ mCfg8055 = viewcfgram.findViewById(R.id.cfg8055);
|
|
|
+ mCfg8056 = viewcfgram.findViewById(R.id.cfg8056);
|
|
|
+ mCfg8057 = viewcfgram.findViewById(R.id.cfg8057);
|
|
|
+ mCfg8058 = viewcfgram.findViewById(R.id.cfg8058);
|
|
|
+ mCfg8059 = viewcfgram.findViewById(R.id.cfg8059);
|
|
|
+ mCfg805A = viewcfgram.findViewById(R.id.cfg805A);
|
|
|
+ mCfg805B = viewcfgram.findViewById(R.id.cfg805B);
|
|
|
+ mCfg805C = viewcfgram.findViewById(R.id.cfg805C);
|
|
|
+ mCfg805D = viewcfgram.findViewById(R.id.cfg805D);
|
|
|
+ mCfg805E = viewcfgram.findViewById(R.id.cfg805E);
|
|
|
+ mCfg805F = viewcfgram.findViewById(R.id.cfg805F);
|
|
|
+
|
|
|
+ mCfg8060 = viewcfgram.findViewById(R.id.cfg8060);
|
|
|
+ mCfg8061 = viewcfgram.findViewById(R.id.cfg8061);
|
|
|
+ mCfg8062 = viewcfgram.findViewById(R.id.cfg8062);
|
|
|
+ mCfg8063 = viewcfgram.findViewById(R.id.cfg8063);
|
|
|
+ mCfg8064 = viewcfgram.findViewById(R.id.cfg8064);
|
|
|
+ mCfg8065 = viewcfgram.findViewById(R.id.cfg8065);
|
|
|
+ mCfg8066 = viewcfgram.findViewById(R.id.cfg8066);
|
|
|
+ mCfg8067 = viewcfgram.findViewById(R.id.cfg8067);
|
|
|
+ mCfg8068 = viewcfgram.findViewById(R.id.cfg8068);
|
|
|
+ mCfg8069 = viewcfgram.findViewById(R.id.cfg8069);
|
|
|
+ mCfg806A = viewcfgram.findViewById(R.id.cfg806A);
|
|
|
+ mCfg806B = viewcfgram.findViewById(R.id.cfg806B);
|
|
|
+ mCfg806C = viewcfgram.findViewById(R.id.cfg806C);
|
|
|
+ mCfg806D = viewcfgram.findViewById(R.id.cfg806D);
|
|
|
+ mCfg806E = viewcfgram.findViewById(R.id.cfg806E);
|
|
|
+ mCfg806F = viewcfgram.findViewById(R.id.cfg806F);
|
|
|
+
|
|
|
+ mCfg8070 = viewcfgram.findViewById(R.id.cfg8070);
|
|
|
+ mCfg8071 = viewcfgram.findViewById(R.id.cfg8071);
|
|
|
+ mCfg8072 = viewcfgram.findViewById(R.id.cfg8072);
|
|
|
+ mCfg8073 = viewcfgram.findViewById(R.id.cfg8073);
|
|
|
+ mCfg8074 = viewcfgram.findViewById(R.id.cfg8074);
|
|
|
+ mCfg8075 = viewcfgram.findViewById(R.id.cfg8075);
|
|
|
+ mCfg8076 = viewcfgram.findViewById(R.id.cfg8076);
|
|
|
+ mCfg8077 = viewcfgram.findViewById(R.id.cfg8077);
|
|
|
+ mCfg8078 = viewcfgram.findViewById(R.id.cfg8078);
|
|
|
+ mCfg8079 = viewcfgram.findViewById(R.id.cfg8079);
|
|
|
+ mCfg807A = viewcfgram.findViewById(R.id.cfg807A);
|
|
|
+ mCfg807B = viewcfgram.findViewById(R.id.cfg807B);
|
|
|
+ mCfg807C = viewcfgram.findViewById(R.id.cfg807C);
|
|
|
+ mCfg807D = viewcfgram.findViewById(R.id.cfg807D);
|
|
|
+ mCfg807E = viewcfgram.findViewById(R.id.cfg807E);
|
|
|
+ mCfg807F = viewcfgram.findViewById(R.id.cfg807F);
|
|
|
+
|
|
|
+ mCfg8080 = viewcfgram.findViewById(R.id.cfg8080);
|
|
|
+ mCfg8081 = viewcfgram.findViewById(R.id.cfg8081);
|
|
|
+ mCfg8082 = viewcfgram.findViewById(R.id.cfg8082);
|
|
|
+ mCfg8083 = viewcfgram.findViewById(R.id.cfg8083);
|
|
|
+ mCfg8084 = viewcfgram.findViewById(R.id.cfg8084);
|
|
|
+ mCfg8085 = viewcfgram.findViewById(R.id.cfg8085);
|
|
|
+ mCfg8086 = viewcfgram.findViewById(R.id.cfg8086);
|
|
|
+ mCfg8087 = viewcfgram.findViewById(R.id.cfg8087);
|
|
|
+ mCfg8088 = viewcfgram.findViewById(R.id.cfg8088);
|
|
|
+ mCfg8089 = viewcfgram.findViewById(R.id.cfg8089);
|
|
|
+ mCfg808A = viewcfgram.findViewById(R.id.cfg808A);
|
|
|
+ mCfg808B = viewcfgram.findViewById(R.id.cfg808B);
|
|
|
+ mCfg808C = viewcfgram.findViewById(R.id.cfg808C);
|
|
|
+ mCfg808D = viewcfgram.findViewById(R.id.cfg808D);
|
|
|
+ mCfg808E = viewcfgram.findViewById(R.id.cfg808E);
|
|
|
+ mCfg808F = viewcfgram.findViewById(R.id.cfg808F);
|
|
|
+
|
|
|
+ mCfg8090 = viewcfgram.findViewById(R.id.cfg8090);
|
|
|
+ mCfg8091 = viewcfgram.findViewById(R.id.cfg8091);
|
|
|
+ mCfg8092 = viewcfgram.findViewById(R.id.cfg8092);
|
|
|
+ mCfg8093 = viewcfgram.findViewById(R.id.cfg8093);
|
|
|
+ mCfg8094 = viewcfgram.findViewById(R.id.cfg8094);
|
|
|
+ mCfg8095 = viewcfgram.findViewById(R.id.cfg8095);
|
|
|
+ mCfg8096 = viewcfgram.findViewById(R.id.cfg8096);
|
|
|
+ mCfg8097 = viewcfgram.findViewById(R.id.cfg8097);
|
|
|
+ mCfg8098 = viewcfgram.findViewById(R.id.cfg8098);
|
|
|
+ mCfg8099 = viewcfgram.findViewById(R.id.cfg8099);
|
|
|
+ mCfg809A = viewcfgram.findViewById(R.id.cfg809A);
|
|
|
+ mCfg809B = viewcfgram.findViewById(R.id.cfg809B);
|
|
|
+ mCfg809C = viewcfgram.findViewById(R.id.cfg809C);
|
|
|
+ mCfg809D = viewcfgram.findViewById(R.id.cfg809D);
|
|
|
+ mCfg809E = viewcfgram.findViewById(R.id.cfg809E);
|
|
|
+ mCfg809F = viewcfgram.findViewById(R.id.cfg809F);
|
|
|
+
|
|
|
+ mCfg80A0 = viewcfgram.findViewById(R.id.cfg80A0);
|
|
|
+ mCfg80A1 = viewcfgram.findViewById(R.id.cfg80A1);
|
|
|
+ mCfg80A2 = viewcfgram.findViewById(R.id.cfg80A2);
|
|
|
+ mCfg80A3 = viewcfgram.findViewById(R.id.cfg80A3);
|
|
|
+ mCfg80A4 = viewcfgram.findViewById(R.id.cfg80A4);
|
|
|
+ mCfg80A5 = viewcfgram.findViewById(R.id.cfg80A5);
|
|
|
+ mCfg80A6 = viewcfgram.findViewById(R.id.cfg80A6);
|
|
|
+ mCfg80A7 = viewcfgram.findViewById(R.id.cfg80A7);
|
|
|
+ mCfg80A8 = viewcfgram.findViewById(R.id.cfg80A8);
|
|
|
+ mCfg80A9 = viewcfgram.findViewById(R.id.cfg80A9);
|
|
|
+ mCfg80AA = viewcfgram.findViewById(R.id.cfg80AA);
|
|
|
+ mCfg80AB = viewcfgram.findViewById(R.id.cfg80AB);
|
|
|
+ mCfg80AC = viewcfgram.findViewById(R.id.cfg80AC);
|
|
|
+ mCfg80AD = viewcfgram.findViewById(R.id.cfg80AD);
|
|
|
+ mCfg80AE = viewcfgram.findViewById(R.id.cfg80AE);
|
|
|
+ mCfg80AF = viewcfgram.findViewById(R.id.cfg80AF);
|
|
|
+
|
|
|
+ mCfg80B0 = viewcfgram.findViewById(R.id.cfg80B0);
|
|
|
+ mCfg80B1 = viewcfgram.findViewById(R.id.cfg80B1);
|
|
|
+ mCfg80B2 = viewcfgram.findViewById(R.id.cfg80B2);
|
|
|
+ mCfg80B3 = viewcfgram.findViewById(R.id.cfg80B3);
|
|
|
+ mCfg80B4 = viewcfgram.findViewById(R.id.cfg80B4);
|
|
|
+ mCfg80B5 = viewcfgram.findViewById(R.id.cfg80B5);
|
|
|
+ mCfg80B6 = viewcfgram.findViewById(R.id.cfg80B6);
|
|
|
+ mCfg80B7 = viewcfgram.findViewById(R.id.cfg80B7);
|
|
|
+ mCfg80B8 = viewcfgram.findViewById(R.id.cfg80B8);
|
|
|
+ mCfg80B9 = viewcfgram.findViewById(R.id.cfg80B9);
|
|
|
+ mCfg80BA = viewcfgram.findViewById(R.id.cfg80BA);
|
|
|
+ mCfg80BB = viewcfgram.findViewById(R.id.cfg80BB);
|
|
|
+ mCfg80BC = viewcfgram.findViewById(R.id.cfg80BC);
|
|
|
+ mCfg80BD = viewcfgram.findViewById(R.id.cfg80BD);
|
|
|
+ mCfg80BE = viewcfgram.findViewById(R.id.cfg80BE);
|
|
|
+ mCfg80BF = viewcfgram.findViewById(R.id.cfg80BF);
|
|
|
+
|
|
|
+ mCfg80C0 = viewcfgram.findViewById(R.id.cfg80C0);
|
|
|
+ mCfg80C1 = viewcfgram.findViewById(R.id.cfg80C1);
|
|
|
+ mCfg80C2 = viewcfgram.findViewById(R.id.cfg80C2);
|
|
|
+ mCfg80C3 = viewcfgram.findViewById(R.id.cfg80C3);
|
|
|
+ mCfg80C4 = viewcfgram.findViewById(R.id.cfg80C4);
|
|
|
+ mCfg80C5 = viewcfgram.findViewById(R.id.cfg80C5);
|
|
|
+ mCfg80C6 = viewcfgram.findViewById(R.id.cfg80C6);
|
|
|
+ mCfg80C7 = viewcfgram.findViewById(R.id.cfg80C7);
|
|
|
+ mCfg80C8 = viewcfgram.findViewById(R.id.cfg80C8);
|
|
|
+ mCfg80C9 = viewcfgram.findViewById(R.id.cfg80C9);
|
|
|
+ mCfg80CA = viewcfgram.findViewById(R.id.cfg80CA);
|
|
|
+ mCfg80CB = viewcfgram.findViewById(R.id.cfg80CB);
|
|
|
+ mCfg80CC = viewcfgram.findViewById(R.id.cfg80CC);
|
|
|
+ mCfg80CD = viewcfgram.findViewById(R.id.cfg80CD);
|
|
|
+ mCfg80CE = viewcfgram.findViewById(R.id.cfg80CE);
|
|
|
+ mCfg80CF = viewcfgram.findViewById(R.id.cfg80CF);
|
|
|
+
|
|
|
+ mCfg80D0 = viewcfgram.findViewById(R.id.cfg80D0);
|
|
|
+ mCfg80D1 = viewcfgram.findViewById(R.id.cfg80D1);
|
|
|
+ mCfg80D2 = viewcfgram.findViewById(R.id.cfg80D2);
|
|
|
+ mCfg80D3 = viewcfgram.findViewById(R.id.cfg80D3);
|
|
|
+ mCfg80D4 = viewcfgram.findViewById(R.id.cfg80D4);
|
|
|
+ mCfg80D5 = viewcfgram.findViewById(R.id.cfg80D5);
|
|
|
+ mCfg80D6 = viewcfgram.findViewById(R.id.cfg80D6);
|
|
|
+ mCfg80D7 = viewcfgram.findViewById(R.id.cfg80D7);
|
|
|
+ mCfg80D8 = viewcfgram.findViewById(R.id.cfg80D8);
|
|
|
+ mCfg80D9 = viewcfgram.findViewById(R.id.cfg80D9);
|
|
|
+ mCfg80DA = viewcfgram.findViewById(R.id.cfg80DA);
|
|
|
+ mCfg80DB = viewcfgram.findViewById(R.id.cfg80DB);
|
|
|
+ mCfg80DC = viewcfgram.findViewById(R.id.cfg80DC);
|
|
|
+ mCfg80DD = viewcfgram.findViewById(R.id.cfg80DD);
|
|
|
+ mCfg80DE = viewcfgram.findViewById(R.id.cfg80DE);
|
|
|
+ mCfg80DF = viewcfgram.findViewById(R.id.cfg80DF);
|
|
|
+
|
|
|
+ mCfg80E0 = viewcfgram.findViewById(R.id.cfg80E0);
|
|
|
+ mCfg80E1 = viewcfgram.findViewById(R.id.cfg80E1);
|
|
|
+ mCfg80E2 = viewcfgram.findViewById(R.id.cfg80E2);
|
|
|
+ mCfg80E3 = viewcfgram.findViewById(R.id.cfg80E3);
|
|
|
+ mCfg80E4 = viewcfgram.findViewById(R.id.cfg80E4);
|
|
|
+ mCfg80E5 = viewcfgram.findViewById(R.id.cfg80E5);
|
|
|
+ mCfg80E6 = viewcfgram.findViewById(R.id.cfg80E6);
|
|
|
+ mCfg80E7 = viewcfgram.findViewById(R.id.cfg80E7);
|
|
|
+ mCfg80E8 = viewcfgram.findViewById(R.id.cfg80E8);
|
|
|
+ mCfg80E9 = viewcfgram.findViewById(R.id.cfg80E9);
|
|
|
+ mCfg80EA = viewcfgram.findViewById(R.id.cfg80EA);
|
|
|
+ mCfg80EB = viewcfgram.findViewById(R.id.cfg80EB);
|
|
|
+ mCfg80EC = viewcfgram.findViewById(R.id.cfg80EC);
|
|
|
+ mCfg80ED = viewcfgram.findViewById(R.id.cfg80ED);
|
|
|
+ mCfg80EE = viewcfgram.findViewById(R.id.cfg80EE);
|
|
|
+ mCfg80EF = viewcfgram.findViewById(R.id.cfg80EF);
|
|
|
+
|
|
|
+ mCfg80F0 = viewcfgram.findViewById(R.id.cfg80F0);
|
|
|
+ mCfg80F1 = viewcfgram.findViewById(R.id.cfg80F1);
|
|
|
+ mCfg80F2 = viewcfgram.findViewById(R.id.cfg80F2);
|
|
|
+ mCfg80F3 = viewcfgram.findViewById(R.id.cfg80F3);
|
|
|
+ mCfg80F4 = viewcfgram.findViewById(R.id.cfg80F4);
|
|
|
+ mCfg80F5 = viewcfgram.findViewById(R.id.cfg80F5);
|
|
|
+ mCfg80F6 = viewcfgram.findViewById(R.id.cfg80F6);
|
|
|
+ mCfg80F7 = viewcfgram.findViewById(R.id.cfg80F7);
|
|
|
+ mCfg80F8 = viewcfgram.findViewById(R.id.cfg80F8);
|
|
|
+ mCfg80F9 = viewcfgram.findViewById(R.id.cfg80F9);
|
|
|
+ mCfg80FA = viewcfgram.findViewById(R.id.cfg80FA);
|
|
|
+ mCfg80FB = viewcfgram.findViewById(R.id.cfg80FB);
|
|
|
+ mCfg80FC = viewcfgram.findViewById(R.id.cfg80FC);
|
|
|
+ mCfg80FD = viewcfgram.findViewById(R.id.cfg80FD);
|
|
|
+ mCfg80FE = viewcfgram.findViewById(R.id.cfg80FE);
|
|
|
+ mCfg80FF = viewcfgram.findViewById(R.id.cfg80FF);
|
|
|
+
|
|
|
+ mCfg8100 = viewcfgram.findViewById(R.id.cfg8100);
|
|
|
+ }
|
|
|
+ //===============================各view中的元素初始化结束===============================================//
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ switch (parent.getId()){
|
|
|
+ case R.id.pgagainspin:
|
|
|
+ if(PGAGainSelected){
|
|
|
+ Toast.makeText(mContext,"您的选择是:" + parent.getItemAtPosition(position).toString(),
|
|
|
+ Toast.LENGTH_SHORT).show();
|
|
|
+ }else PGAGainSelected = true;
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onNothingSelected(AdapterView<?> parent) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<String> loadFile(String fileName){
|
|
|
+ List<String> lists = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ File file = new File(fileName);
|
|
|
+ InputStream instream = new FileInputStream(file);
|
|
|
+ if (instream != null) {
|
|
|
+ InputStreamReader inputreader
|
|
|
+ = new InputStreamReader(instream, "UTF-8");//UTF-8
|
|
|
+ BufferedReader buffreader = new BufferedReader(inputreader);
|
|
|
+ String line = "";
|
|
|
+ while ((line = buffreader.readLine()) != null) {
|
|
|
+ lists.add(line);
|
|
|
+ }
|
|
|
+ instream.close();
|
|
|
+ //editdetail.setText(buffreader.toString()); //buffer.toString())就是读出的内容字符
|
|
|
+ //mShow.setText(inputreader.toString());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ //Log.e(TAG, "****Load " + fileName + " Error****");
|
|
|
+ }
|
|
|
+ return lists;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void onActivityResult ( int requestCode, int resultCode, Intent data){
|
|
|
+ if (resultCode == Activity.RESULT_OK) {
|
|
|
+ if (requestCode == 1) {
|
|
|
+ Uri uri = data.getData();
|
|
|
+ //Toast.makeText(this, "文件路径:" + uri.getPath().toString(), Toast.LENGTH_SHORT).show();
|
|
|
+ edit_search.setText(uri.getPath().toString());
|
|
|
+ //loadFile(uri.getPath().toString());
|
|
|
+ ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
+ .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 2);
|
|
|
+
|
|
|
+ StringBuffer buffer = new StringBuffer();
|
|
|
+ try {
|
|
|
+ FileInputStream fis = new FileInputStream(uri.getPath().toString());
|
|
|
+ InputStreamReader isr = new InputStreamReader(fis,"UTF-8");//文件编码Unicode,UTF-8,ASCII,GB2312,Big5
|
|
|
+ Reader in = new BufferedReader(isr);
|
|
|
+ int ch;
|
|
|
+ while ((ch = in.read()) > -1) {
|
|
|
+ buffer.append((char)ch);
|
|
|
+ }
|
|
|
+ in.close();
|
|
|
+ String configString;
|
|
|
+ configString = buffer.toString();
|
|
|
+ //mShow.setText(configString.toString());
|
|
|
+
|
|
|
+ //value = value.trim(); //去除空格
|
|
|
+ configString = configString.replaceAll("0x", ""); //0x转换为没有
|
|
|
+ //editdetail.setText(configString.toString()); //buffer.toString())就是读出的内容字符
|
|
|
+
|
|
|
+ String[] stringCfgArr = configString.split(",");
|
|
|
+ //byte bcfgarr[] = new byte[188];
|
|
|
+
|
|
|
+ //for (byte i = 0; i < 186; i++){
|
|
|
+ // mBytes[i] = (byte) Integer.parseInt(stringCfgArr[i]);
|
|
|
+ //}
|
|
|
+
|
|
|
+ int showid = 0;
|
|
|
+
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+ mBytes[showid] = (byte) Integer.parseInt(stringCfgArr[showid], 16);
|
|
|
+ showid++;
|
|
|
+
|
|
|
+ ReadCfgSample(mBytes);
|
|
|
+ ReadCfgModuleSwitch(mBytes);
|
|
|
+ ReadCfgNormalSetting(mBytes);
|
|
|
+ ReadCfgChannelSetting(mBytes);
|
|
|
+ ReadCfgPenSetting(mBytes);
|
|
|
+ ReadCfgPlamRestrain(mBytes);
|
|
|
+ ReadCfgKeySetting(mBytes);
|
|
|
+ ReadCfgHoppingSetting(mBytes);
|
|
|
+ ReadCfgRam(stringCfgArr);
|
|
|
+ } catch (IOException e) {
|
|
|
+ //editdetail.setText("文件不存在!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ File file = new File(uri.getPath());
|
|
|
+ String str = null;
|
|
|
+ try {
|
|
|
+ InputStream is = new FileInputStream(file);
|
|
|
+ InputStreamReader input = new InputStreamReader(is, "UTF-8");
|
|
|
+ BufferedReader reader = new BufferedReader(input);
|
|
|
+ while ((str = reader.readLine()) != null) {
|
|
|
+ editdetail.setText(str);
|
|
|
+ //editdetail.append("\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ */
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initListener() {
|
|
|
+ mReadCfg.setOnClickListener(this);
|
|
|
+ mSendCfg.setOnClickListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+ mContext = getApplicationContext();
|
|
|
+ mReadCfg.setEnabled(false); //
|
|
|
+
|
|
|
+ mSendCfg.setEnabled(false);
|
|
|
+
|
|
|
+ mThreadPool = Executors.newFixedThreadPool(5);
|
|
|
+
|
|
|
+ mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开设备 , 让车机和手机端连起来
|
|
|
+ */
|
|
|
+ private void openDevices() {
|
|
|
+
|
|
|
+ //列举设备(手机)
|
|
|
+ cfgOpenDevicesReceiver = new OpenDevicesReceiver(this);
|
|
|
+ mThreadPool.execute(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ SystemClock.sleep(1000);
|
|
|
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_USB_PERMISSION), 0);
|
|
|
+ IntentFilter intentFilter = new IntentFilter(USB_ACTION);
|
|
|
+
|
|
|
+ registerReceiver(cfgOpenDevicesReceiver, intentFilter);
|
|
|
+ while(isNeedFindDevice) {
|
|
|
+ SystemClock.sleep(100);
|
|
|
+ HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
|
|
|
+ if (deviceList != null) {
|
|
|
+ for (UsbDevice usbDevice : deviceList.values()) {
|
|
|
+ int productId = usbDevice.getProductId();
|
|
|
+ int vendorId = usbDevice.getVendorId();
|
|
|
+ if ((productId == 0x0818 && vendorId == 0x27C0)
|
|
|
+ ||(productId == 0x0001 && vendorId == 0x222A)) //奕力的PID和VID
|
|
|
+ {
|
|
|
+ //这里说明下,这里的377 , 7205是我这台机子上独有,因为我这上面有多台设备,所以我在这里
|
|
|
+ //判断了下.只有一台设备的无需这一步.
|
|
|
+ //mUsbManager.requestPermission(usbDevice, pendingIntent);
|
|
|
+ //SystemClock.sleep(100);
|
|
|
+ if (mUsbManager.hasPermission(usbDevice)) {
|
|
|
+ initDevice();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ mUsbManager.requestPermission(usbDevice, pendingIntent);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //mError.setText("请连接USB");
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ } //ThreadPool
|
|
|
+ }); //ThreadPool
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化设备(手机) , 当手机进入Accessory模式后 , 手机的PID会变为Google定义的2个常量值其中的一个 ,
|
|
|
+ */
|
|
|
+ private void initDevice() {
|
|
|
+
|
|
|
+ HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
|
|
|
+ Collection<UsbDevice> values = deviceList.values();
|
|
|
+ if (!values.isEmpty()) {
|
|
|
+ for (UsbDevice usbDevice : values) {
|
|
|
+ int productId = usbDevice.getProductId();
|
|
|
+ if (productId == 0x0818 || productId == 0x0001) { //0x0001是奕力的PID
|
|
|
+ if (mUsbManager.hasPermission(usbDevice)) {
|
|
|
+
|
|
|
+ mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);
|
|
|
+ if (mUsbDeviceConnection != null) {
|
|
|
+
|
|
|
+ int interfaceCount = usbDevice.getInterfaceCount();
|
|
|
+ // for (int interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++)
|
|
|
+ {
|
|
|
+ // UsbInterface usbInterface = usbDevice.getInterface(interfaceIndex);
|
|
|
+ UsbInterface usbInterface = usbDevice.getInterface(1);
|
|
|
+
|
|
|
+ if(UsbConstants.USB_CLASS_HID != usbInterface.getInterfaceClass())
|
|
|
+ {
|
|
|
+ // continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < usbInterface.getEndpointCount(); i++) {
|
|
|
+ UsbEndpoint ep = usbInterface.getEndpoint(i);
|
|
|
+
|
|
|
+ if (ep.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
|
|
|
+ if (ep.getDirection() == UsbConstants.USB_DIR_OUT) {
|
|
|
+ //mUsbEndpointIn = ep;
|
|
|
+ mUsbEndpointOut = ep;
|
|
|
+ } else {
|
|
|
+ //mUsbEndpointOut = ep;
|
|
|
+ mUsbEndpointIn = ep;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ // mHandler.sendEmptyMessage(CONNECTED_SUCCESS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((null == mUsbEndpointIn) || (null == mUsbEndpointOut)) {
|
|
|
+ int i = mUsbDeviceConnection.controlTransfer(0x00, 0x09,
|
|
|
+ 0x002, 0, null, 0, 100);
|
|
|
+ SystemClock.sleep(1000);
|
|
|
+ if(i>=0){
|
|
|
+ //mHandler.sendEmptyMessage(DEBUG_MESSAGE_SUCCESS);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ //mHandler.sendEmptyMessage(DEBUG_MESSAGE_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ isNeedFindDevice = false;
|
|
|
+ mUsbInterface = usbInterface;
|
|
|
+ mUsbDeviceConnection = mUsbManager.openDevice(usbDevice);
|
|
|
+ if(null != mUsbEndpointIn){
|
|
|
+ mHandler.sendEmptyMessage(CONNECTED_SUCCESS);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(""), 0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // finish();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //=====================================读取CFG到各个View开始===================================//
|
|
|
+ public void ReadCfgSample(byte[] mBytes){
|
|
|
+ int temp;
|
|
|
+
|
|
|
+ cbAllDrivingEn.setChecked(false);
|
|
|
+ if ((mBytes[27] & 0x80) == 0x80){
|
|
|
+ cbAllDrivingEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbDualFreq.setChecked(false);
|
|
|
+ if ((mBytes[28] & 0x20) == 0x20){
|
|
|
+ cbDualFreq.setChecked(true);
|
|
|
+ }
|
|
|
+ edtFreqAFactor.setText(Integer.toString(mBytes[30] & 0xFF));
|
|
|
+ edtFreqBFactor.setText(Integer.toString(mBytes[31] & 0xFF));
|
|
|
+
|
|
|
+ temp = (int)((mBytes[32] & 0xFF) + mBytes[33] * 256);
|
|
|
+ edtPannelBitFreq.setText(Integer.toString(temp & 0xFFFF));
|
|
|
+
|
|
|
+ //edtDuration
|
|
|
+ spinDACGain.setSelection(mBytes[36] & 0x07);
|
|
|
+ spinDrvOutputR.setSelection((mBytes[36] & 0x18) >> 3);
|
|
|
+ spinPGAGain.setSelection(mBytes[37] & 0x07);
|
|
|
+ spinRxVcmi.setSelection((mBytes[37] & 0x18) >> 3);
|
|
|
+ spinPGAR.setSelection((mBytes[37] & 0x60) >> 5);
|
|
|
+ spinPGAC.setSelection((mBytes[37] & 0x80) >> 7);
|
|
|
+ edtDumpShift.setText(Integer.toString(mBytes[38] & 0x0F));
|
|
|
+ edtSubFrameDrvNum.setText(Integer.toString((mBytes[39] & 0x7C) >> 2));
|
|
|
+ spinVoltage.setSelection(mBytes[92] & 0x07);
|
|
|
+ spinBoostTime.setSelection((mBytes[92] & 0x70) >> 4);
|
|
|
+ cbExtoscen.setChecked(false);
|
|
|
+ if ((mBytes[93] & 0x80) == 0x80){
|
|
|
+ cbExtoscen.setChecked(true);
|
|
|
+ }
|
|
|
+ spinAlterCount.setSelection(mBytes[94] & 0x03);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgModuleSwitch(byte[] mBytes){
|
|
|
+ cbSito.setChecked(false);
|
|
|
+ if ((mBytes[6] & 0x04) == 0x04){
|
|
|
+ cbSito.setChecked(true);
|
|
|
+ }
|
|
|
+ cbX2Y.setChecked(false);
|
|
|
+ if ((mBytes[6] & 0x08) == 0x08){
|
|
|
+ cbX2Y.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ spinInterrupt.setSelection(mBytes[6] & 0x03);
|
|
|
+ spinStretchRank.setSelection((mBytes[6] & 0x30) >> 4);
|
|
|
+
|
|
|
+ cbDiffDivideBy2or4.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x04) == 0x04){
|
|
|
+ cbDiffDivideBy2or4.setChecked(true);
|
|
|
+ }
|
|
|
+ cbFirstFilterDis.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x20) == 0x20){
|
|
|
+ cbFirstFilterDis.setChecked(true);
|
|
|
+ }
|
|
|
+ cbMonitorConsistencyConflictEn.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x40) == 0x40){
|
|
|
+ cbMonitorConsistencyConflictEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbWaterSpeedLimitEn.setChecked(false);
|
|
|
+ if ((mBytes[91] & 0x01) == 0x01){
|
|
|
+ cbWaterSpeedLimitEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbShapeEn.setChecked(false);
|
|
|
+ if ((mBytes[91] & 0x04) == 0x04){
|
|
|
+ cbShapeEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbWaterProofDis.setChecked(false);
|
|
|
+ if ((mBytes[91] & 0x08) == 0x08){
|
|
|
+ cbWaterProofDis.setChecked(true);
|
|
|
+ }
|
|
|
+ cbLcdPlusMinusEn.setChecked(false);
|
|
|
+ if ((mBytes[91] & 0x10) == 0x10){
|
|
|
+ cbLcdPlusMinusEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbX2X.setChecked(false);
|
|
|
+ if ((mBytes[104] & 0x01) == 0x01){
|
|
|
+ cbX2X.setChecked(true);
|
|
|
+ }
|
|
|
+ cbY2Y.setChecked(false);
|
|
|
+ if ((mBytes[104] & 0x02) == 0x02){
|
|
|
+ cbY2Y.setChecked(true);
|
|
|
+ }
|
|
|
+ cbESDEn.setChecked(false);
|
|
|
+ if ((mBytes[104] & 0x10) == 0x10){
|
|
|
+ cbESDEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbINTWakeup.setChecked(false);
|
|
|
+ if ((mBytes[104] & 0x20) == 0x20){
|
|
|
+ cbINTWakeup.setChecked(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgNormalSetting(byte[] mBytes){
|
|
|
+ String hv;
|
|
|
+ edtConfigVersion.setText(Integer.toString(mBytes[0] & 0xFF));
|
|
|
+ edtTouchNumber.setText(Integer.toString(mBytes[5] & 0x0F));
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[8] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtShakeCnt.setText(hv);
|
|
|
+
|
|
|
+ edtNormalFilter.setText(Integer.toString(mBytes[9] & 0x3F));
|
|
|
+ edtFirstFilter.setText(Integer.toString((mBytes[9] & 0xFF) >> 6));
|
|
|
+ edtNoiseReduction.setText(Integer.toString(mBytes[11] & 0x0F));
|
|
|
+ edtScreenTouchLv.setText(Integer.toString(mBytes[12] & 0xFF));
|
|
|
+ edtScreenLeaveLv.setText(Integer.toString(mBytes[13] & 0xFF));
|
|
|
+ edtLowPowerControl.setText(Integer.toString(mBytes[14] & 0x0F));
|
|
|
+ spinRefreshRate.setSelection(mBytes[15] & 0x0F);
|
|
|
+ edtXThreshold.setText(Integer.toString(mBytes[16] & 0xFF));
|
|
|
+ edtYThreshold.setText(Integer.toString(mBytes[17] & 0xFF));
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[20] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtSpaceUpDown.setText(hv);
|
|
|
+ hv = Integer.toHexString(mBytes[21] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtSpaceLeftRight.setText(hv);
|
|
|
+
|
|
|
+ edtMiniFilter.setText(Integer.toString(mBytes[22] & 0x0F));
|
|
|
+ edtStretchR0.setText(Integer.toString(mBytes[23] & 0xFF));
|
|
|
+ edtStretchR1.setText(Integer.toString(mBytes[24] & 0xFF));
|
|
|
+ edtStretchR2.setText(Integer.toString(mBytes[25] & 0xFF));
|
|
|
+ edtStretchRM.setText(Integer.toString(mBytes[26] & 0xFF));
|
|
|
+ edtChargingLevelUp.setText(Integer.toString(mBytes[49] & 0xFF));
|
|
|
+ edtLcdPlusMinusValue.setText(Integer.toString(mBytes[58] & 0xFF));
|
|
|
+ edtShapeRestrain.setText(Integer.toString(mBytes[87] & 0x7F));
|
|
|
+ edtConThreshold.setText(Integer.toString(mBytes[88] & 0xFF));
|
|
|
+ edtWaterFrameTime.setText(Integer.toString(mBytes[89] & 0xFF));
|
|
|
+ edtWaterUpdateTime.setText(Integer.toString(mBytes[90] & 0xFF));
|
|
|
+ edtSlideInEdgeConfig.setText(Integer.toString(mBytes[96] & 0xFF));
|
|
|
+ edtSlideOutEdgeConfig.setText(Integer.toString(mBytes[97] & 0xFF));
|
|
|
+ edtShapeContrl.setText(Integer.toString(mBytes[105] & 0x1F));
|
|
|
+ edtCombineDis.setText(Integer.toString(mBytes[106] & 0x0F));
|
|
|
+ edtSplitSet.setText(Integer.toString(mBytes[107] & 0xFF));
|
|
|
+ edtSitoDiffRefLevel.setText(Integer.toString(mBytes[110] & 0xFF));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgChannelSetting(byte[] mBytes){
|
|
|
+ int temp;
|
|
|
+
|
|
|
+ temp = (int)((mBytes[1] & 0xFF) + mBytes[2] * 256);
|
|
|
+ edtXOutputMax.setText(Integer.toString(temp & 0xFFFF));
|
|
|
+ temp = (int)((mBytes[3] & 0xFF) + mBytes[4] * 256);
|
|
|
+ edtYOutputMax.setText(Integer.toString(temp & 0xFFFF));
|
|
|
+
|
|
|
+ edtDrvGroupAnumber.setText(Integer.toString(mBytes[27] & 0x1F));
|
|
|
+ edtDrvGroupBnumber.setText(Integer.toString(mBytes[28] & 0x1F));
|
|
|
+ bDriverNumber = (byte)((mBytes[27] & 0x1F) + (mBytes[28] & 0x1F));
|
|
|
+
|
|
|
+ edtSenGroupANumber.setText(Integer.toString(mBytes[29] & 0x0F));
|
|
|
+ edtSenGroupBNumber.setText(Integer.toString((mBytes[29] & 0xF0) >> 4));
|
|
|
+ bSensorNumber = (byte)((mBytes[29] & 0x0F) + ((mBytes[29] & 0xF0) >> 4));
|
|
|
+
|
|
|
+ edtSensorCH0.setText(Integer.toString(mBytes[112] & 0xFF));
|
|
|
+ edtSensorCH1.setText(Integer.toString(mBytes[113] & 0xFF));
|
|
|
+ edtSensorCH2.setText(Integer.toString(mBytes[114] & 0xFF));
|
|
|
+ edtSensorCH3.setText(Integer.toString(mBytes[115] & 0xFF));
|
|
|
+ edtSensorCH4.setText(Integer.toString(mBytes[116] & 0xFF));
|
|
|
+ edtSensorCH5.setText(Integer.toString(mBytes[117] & 0xFF));
|
|
|
+ edtSensorCH6.setText(Integer.toString(mBytes[118] & 0xFF));
|
|
|
+ edtSensorCH7.setText(Integer.toString(mBytes[119] & 0xFF));
|
|
|
+ edtSensorCH8.setText(Integer.toString(mBytes[120] & 0xFF));
|
|
|
+ edtSensorCH9.setText(Integer.toString(mBytes[121] & 0xFF));
|
|
|
+ edtSensorCH10.setText(Integer.toString(mBytes[122] & 0xFF));
|
|
|
+ edtSensorCH11.setText(Integer.toString(mBytes[123] & 0xFF));
|
|
|
+ edtSensorCH12.setText(Integer.toString(mBytes[124] & 0xFF));
|
|
|
+ edtSensorCH13.setText(Integer.toString(mBytes[125] & 0xFF));
|
|
|
+ edtSensorCH14.setText(Integer.toString(mBytes[126] & 0xFF));
|
|
|
+ edtSensorCH15.setText(Integer.toString(mBytes[127] & 0xFF));
|
|
|
+ edtSensorCH16.setText(Integer.toString(mBytes[128] & 0xFF));
|
|
|
+ edtSensorCH17.setText(Integer.toString(mBytes[129] & 0xFF));
|
|
|
+ edtSensorCH18.setText(Integer.toString(mBytes[130] & 0xFF));
|
|
|
+ edtSensorCH19.setText(Integer.toString(mBytes[131] & 0xFF));
|
|
|
+ edtSensorCH20.setText(Integer.toString(mBytes[132] & 0xFF));
|
|
|
+ edtSensorCH21.setText(Integer.toString(mBytes[133] & 0xFF));
|
|
|
+ edtSensorCH22.setText(Integer.toString(mBytes[134] & 0xFF));
|
|
|
+ edtSensorCH23.setText(Integer.toString(mBytes[135] & 0xFF));
|
|
|
+ edtSensorCH24.setText(Integer.toString(mBytes[136] & 0xFF));
|
|
|
+ edtSensorCH25.setText(Integer.toString(mBytes[137] & 0xFF));
|
|
|
+ edtSensorCH26.setText(Integer.toString(mBytes[138] & 0xFF));
|
|
|
+ edtSensorCH27.setText(Integer.toString(mBytes[139] & 0xFF));
|
|
|
+ edtSensorCH28.setText(Integer.toString(mBytes[140] & 0xFF));
|
|
|
+ edtSensorCH29.setText(Integer.toString(mBytes[141] & 0xFF));
|
|
|
+
|
|
|
+ edtDriverCH0.setText(Integer.toString(mBytes[142] & 0xFF));
|
|
|
+ edtDriverCH1.setText(Integer.toString(mBytes[143] & 0xFF));
|
|
|
+ edtDriverCH2.setText(Integer.toString(mBytes[144] & 0xFF));
|
|
|
+ edtDriverCH3.setText(Integer.toString(mBytes[145] & 0xFF));
|
|
|
+ edtDriverCH4.setText(Integer.toString(mBytes[146] & 0xFF));
|
|
|
+ edtDriverCH5.setText(Integer.toString(mBytes[147] & 0xFF));
|
|
|
+ edtDriverCH6.setText(Integer.toString(mBytes[148] & 0xFF));
|
|
|
+ edtDriverCH7.setText(Integer.toString(mBytes[149] & 0xFF));
|
|
|
+ edtDriverCH8.setText(Integer.toString(mBytes[150] & 0xFF));
|
|
|
+ edtDriverCH9.setText(Integer.toString(mBytes[151] & 0xFF));
|
|
|
+ edtDriverCH10.setText(Integer.toString(mBytes[152] & 0xFF));
|
|
|
+ edtDriverCH11.setText(Integer.toString(mBytes[153] & 0xFF));
|
|
|
+ edtDriverCH12.setText(Integer.toString(mBytes[154] & 0xFF));
|
|
|
+ edtDriverCH13.setText(Integer.toString(mBytes[155] & 0xFF));
|
|
|
+ edtDriverCH14.setText(Integer.toString(mBytes[156] & 0xFF));
|
|
|
+ edtDriverCH15.setText(Integer.toString(mBytes[157] & 0xFF));
|
|
|
+ edtDriverCH16.setText(Integer.toString(mBytes[158] & 0xFF));
|
|
|
+ edtDriverCH17.setText(Integer.toString(mBytes[159] & 0xFF));
|
|
|
+ edtDriverCH18.setText(Integer.toString(mBytes[160] & 0xFF));
|
|
|
+ edtDriverCH19.setText(Integer.toString(mBytes[161] & 0xFF));
|
|
|
+ edtDriverCH20.setText(Integer.toString(mBytes[162] & 0xFF));
|
|
|
+ edtDriverCH21.setText(Integer.toString(mBytes[163] & 0xFF));
|
|
|
+ edtDriverCH22.setText(Integer.toString(mBytes[164] & 0xFF));
|
|
|
+ edtDriverCH23.setText(Integer.toString(mBytes[165] & 0xFF));
|
|
|
+ edtDriverCH24.setText(Integer.toString(mBytes[166] & 0xFF));
|
|
|
+ edtDriverCH25.setText(Integer.toString(mBytes[167] & 0xFF));
|
|
|
+ edtDriverCH26.setText(Integer.toString(mBytes[168] & 0xFF));
|
|
|
+ edtDriverCH27.setText(Integer.toString(mBytes[169] & 0xFF));
|
|
|
+ edtDriverCH28.setText(Integer.toString(mBytes[170] & 0xFF));
|
|
|
+ edtDriverCH29.setText(Integer.toString(mBytes[171] & 0xFF));
|
|
|
+ edtDriverCH30.setText(Integer.toString(mBytes[172] & 0xFF));
|
|
|
+ edtDriverCH31.setText(Integer.toString(mBytes[173] & 0xFF));
|
|
|
+ edtDriverCH32.setText(Integer.toString(mBytes[174] & 0xFF));
|
|
|
+ edtDriverCH33.setText(Integer.toString(mBytes[175] & 0xFF));
|
|
|
+ edtDriverCH34.setText(Integer.toString(mBytes[176] & 0xFF));
|
|
|
+ edtDriverCH35.setText(Integer.toString(mBytes[177] & 0xFF));
|
|
|
+ edtDriverCH36.setText(Integer.toString(mBytes[178] & 0xFF));
|
|
|
+ edtDriverCH37.setText(Integer.toString(mBytes[179] & 0xFF));
|
|
|
+ edtDriverCH38.setText(Integer.toString(mBytes[180] & 0xFF));
|
|
|
+ edtDriverCH39.setText(Integer.toString(mBytes[181] & 0xFF));
|
|
|
+ edtDriverCH40.setText(Integer.toString(mBytes[182] & 0xFF));
|
|
|
+ edtDriverCH41.setText(Integer.toString(mBytes[183] & 0xFF));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgPenSetting(byte[] mBytes){
|
|
|
+ cbPenEn.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x02) == 2){
|
|
|
+ cbPenEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbOnlyFingerEn.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x08) == 8){
|
|
|
+ cbOnlyFingerEn.setChecked(true);
|
|
|
+ }
|
|
|
+ edtPenLowSize.setText(Integer.toString(mBytes[40] & 0xFF));
|
|
|
+ edtPenHighSize.setText(Integer.toString(mBytes[41] & 0xFF));
|
|
|
+ edtRectsumPLowL.setText(Integer.toString(mBytes[42] & 0xFF));
|
|
|
+ edtRectsumPHighL.setText(Integer.toString(mBytes[43] & 0xFF));
|
|
|
+ edtRectsumFLowL.setText(Integer.toString(mBytes[44] & 0xFF));
|
|
|
+ edtPRectMaxDiffLimit.setText(Integer.toString(mBytes[45] & 0xFF));
|
|
|
+ edtPRectAreaLimit.setText(Integer.toString(mBytes[46] & 0xFF));
|
|
|
+ spinFingerRestrainPen.setSelection((mBytes[104] & 0xC0) >> 6);
|
|
|
+ edtFLeavelevel.setText(Integer.toString(mBytes[108] & 0xFF));
|
|
|
+ edtPTouchHighlevel.setText(Integer.toString(mBytes[111] & 0xFF));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgPlamRestrain(byte[] mBytes){
|
|
|
+ cbAllPlamRestrain.setChecked(false);
|
|
|
+ if ((mBytes[6] & 0x40) == 0x40){
|
|
|
+ cbAllPlamRestrain.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ edtLargeTouch.setText(Integer.toString(mBytes[10] & 0xFF));
|
|
|
+ edtExpanNumOutX.setText(Integer.toString((mBytes[34] & 0xF0) >> 4));
|
|
|
+ edtExpanNumOutY.setText(Integer.toString(mBytes[34] & 0x0F));
|
|
|
+ edtExpanNumInX.setText(Integer.toString((mBytes[35] & 0xF0) >> 4));
|
|
|
+ edtExpanNumInY.setText(Integer.toString(mBytes[35] & 0x0F));
|
|
|
+ edtSingleRectTopSignNum.setText(Integer.toString(mBytes[47] & 0xFF));
|
|
|
+ edtAllRectTopSignSum.setText(Integer.toString(mBytes[48] & 0xFF));
|
|
|
+
|
|
|
+ cbWaterLargeRestrainEn.setChecked(false);
|
|
|
+ if ((mBytes[91] & 0x02) == 0x02){
|
|
|
+ cbWaterLargeRestrainEn.setChecked(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgKeySetting(byte[] mBytes){
|
|
|
+ String hv;
|
|
|
+
|
|
|
+ cbTouchKey.setChecked(false);
|
|
|
+ if ((mBytes[7] & 0x01) == 1){
|
|
|
+ cbTouchKey.setChecked(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[80] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeyArea.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[76] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKey1.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[77] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKey2.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[78] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKey3.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[79] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKey4.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[81] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeyTouchLevel.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[82] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeyLeaveLevel.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[83] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeySens1and2.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[84] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeySens3and4.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[85] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeyRestrain.setText(hv);
|
|
|
+
|
|
|
+ hv = Integer.toHexString(mBytes[86] & 0x0F);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ edtKeyRestrainTime.setText(hv);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgHoppingSetting(byte[] mBytes){
|
|
|
+ edtFreqStart.setText(Integer.toString(mBytes[51] & 0xFF));
|
|
|
+ edtFreqEnd.setText(Integer.toString(mBytes[52] & 0xFF));
|
|
|
+ edtDetectStayTimes.setText(Integer.toString((mBytes[53] & 0xC0) >> 6));
|
|
|
+ edtDetectConfirmTimes.setText(Integer.toString(mBytes[53] & 0x3F));
|
|
|
+
|
|
|
+ cbHoppingEn.setChecked(false);
|
|
|
+ if ((mBytes[54] & 0x80) == 0x80){
|
|
|
+ cbHoppingEn.setChecked(true);
|
|
|
+ }
|
|
|
+ cbRangeExt.setChecked(false);
|
|
|
+ if ((mBytes[54] & 0x40) == 0x40){
|
|
|
+ cbRangeExt.setChecked(true);
|
|
|
+ }
|
|
|
+ cbDisForceRef.setChecked(false);
|
|
|
+ if ((mBytes[54] & 0x20) == 0x20){
|
|
|
+ cbDisForceRef.setChecked(true);
|
|
|
+ }
|
|
|
+ cbDelayHopping.setChecked(false);
|
|
|
+ if ((mBytes[54] & 0x10) == 0x10){
|
|
|
+ cbDelayHopping.setChecked(true);
|
|
|
+ }
|
|
|
+ edtFastHopLimit.setText(Integer.toString((mBytes[55] & 0xF0) >> 4));
|
|
|
+ edtHopThreshold.setText(Integer.toString(mBytes[55] & 0x0F));
|
|
|
+ edtNoiseMinTh.setText(Integer.toString(mBytes[57] & 0xFF));
|
|
|
+ edtSensorGroup.setText(Integer.toString(mBytes[59] & 0xFF));
|
|
|
+ edtSeg1Normalize.setText(Integer.toString(mBytes[60] & 0xFF));
|
|
|
+ edtSeg1Factor.setText(Integer.toString(mBytes[61] & 0xFF));
|
|
|
+ edtMainClockAjdust.setText(Integer.toString(mBytes[62] & 0xFF));
|
|
|
+ edtSeg2Normalize.setText(Integer.toString(mBytes[63] & 0xFF));
|
|
|
+ edtSeg2Factor.setText(Integer.toString(mBytes[64] & 0xFF));
|
|
|
+ edtSeg3Normalize.setText(Integer.toString(mBytes[66] & 0xFF));
|
|
|
+ edtSeg3Factor.setText(Integer.toString(mBytes[67] & 0xFF));
|
|
|
+ edtSeg4Normalize.setText(Integer.toString(mBytes[69] & 0xFF));
|
|
|
+ edtSeg4Factor.setText(Integer.toString(mBytes[70] & 0xFF));
|
|
|
+ edtSeg5Normalize.setText(Integer.toString(mBytes[72] & 0xFF));
|
|
|
+ edtSeg5Factor.setText(Integer.toString(mBytes[73] & 0xFF));
|
|
|
+ edtSeg6Normalize.setText(Integer.toString(mBytes[75] & 0xFF));
|
|
|
+ //edtHopFreqAddr.setText("C6E6");
|
|
|
+ edtHopDetectTimes.setText(Integer.toString((mBytes[105] & 0xE0) >> 5));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void ReadCfgRam(String[] mConfigShow){
|
|
|
+ int showid = 0;
|
|
|
+
|
|
|
+ mCfg8047.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8048.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8049.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg804F.setText(mConfigShow[showid++]);//9
|
|
|
+
|
|
|
+ mCfg8050.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8051.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8052.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8053.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8054.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8055.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8056.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8057.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8058.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8059.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg805F.setText(mConfigShow[showid++]);//25
|
|
|
+
|
|
|
+ mCfg8060.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8061.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8062.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8063.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8064.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8065.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8066.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8067.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8068.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8069.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg806F.setText(mConfigShow[showid++]);//41
|
|
|
+
|
|
|
+ mCfg8070.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8071.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8072.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8073.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8074.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8075.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8076.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8077.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8078.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8079.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg807F.setText(mConfigShow[showid++]);//57
|
|
|
+
|
|
|
+ mCfg8080.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8081.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8082.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8083.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8084.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8085.setText(mConfigShow[showid++]);//63
|
|
|
+ //showid++;
|
|
|
+ mCfg8086.setText(mConfigShow[showid++]);//65
|
|
|
+ mCfg8087.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8088.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8089.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg808F.setText(mConfigShow[showid++]);//74
|
|
|
+
|
|
|
+ mCfg8090.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8091.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8092.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8093.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8094.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8095.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8096.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8097.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8098.setText(mConfigShow[showid++]);
|
|
|
+ mCfg8099.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809A.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809B.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809C.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809D.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809E.setText(mConfigShow[showid++]);
|
|
|
+ mCfg809F.setText(mConfigShow[showid++]);//90
|
|
|
+
|
|
|
+ mCfg80A0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A4.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A5.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80A9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AD.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80AF.setText(mConfigShow[showid++]);//106
|
|
|
+
|
|
|
+ mCfg80B0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B4.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B5.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80B9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BD.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80BF.setText(mConfigShow[showid++]);//122
|
|
|
+
|
|
|
+ mCfg80C0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C4.setText(mConfigShow[showid++]);//127
|
|
|
+ //showid++;
|
|
|
+ mCfg80C5.setText(mConfigShow[showid++]);//129
|
|
|
+ mCfg80C6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80C9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CD.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80CF.setText(mConfigShow[showid++]);//139
|
|
|
+
|
|
|
+ mCfg80D0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D4.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D5.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80D9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DD.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80DF.setText(mConfigShow[showid++]);//155
|
|
|
+
|
|
|
+ mCfg80E0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E4.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E5.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80E9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80EA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80EB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80EC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80ED.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80EE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80EF.setText(mConfigShow[showid++]);//171
|
|
|
+
|
|
|
+ mCfg80F0.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F1.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F2.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F3.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F4.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F5.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F6.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F7.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F8.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80F9.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FA.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FB.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FC.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FD.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FE.setText(mConfigShow[showid++]);
|
|
|
+ mCfg80FF.setText(mConfigShow[showid++]);//187
|
|
|
+
|
|
|
+ mCfg8100.setText(mConfigShow[185]);
|
|
|
+ }
|
|
|
+ //=====================================读取CFG到各个View结束===================================//
|
|
|
+
|
|
|
+ //======================================合并配置开始===========================================//
|
|
|
+ public void CombineCfg(){
|
|
|
+
|
|
|
+ for (int i = 0; i < 186; i++){
|
|
|
+ mBytes[i] = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ mBytes[0] = (byte)Integer.parseInt(edtConfigVersion.getText().toString(),10);
|
|
|
+ mBytes[1] = (byte)(Integer.parseInt(edtXOutputMax.getText().toString(),10) & 0x00ff);
|
|
|
+ mBytes[2] = (byte)(Integer.parseInt(edtXOutputMax.getText().toString(),10) >> 8);
|
|
|
+ mBytes[3] = (byte)(Integer.parseInt(edtYOutputMax.getText().toString(),10) & 0x00ff);
|
|
|
+ mBytes[4] = (byte)(Integer.parseInt(edtYOutputMax.getText().toString(),10) >> 8);
|
|
|
+ mBytes[5] = (byte)(Integer.parseInt(edtTouchNumber.getText().toString(),10) & 0x0f);
|
|
|
+ //mBytes[6]
|
|
|
+ mBytes[6] = (byte)spinInterrupt.getSelectedItemPosition();
|
|
|
+ if (cbSito.isChecked()){
|
|
|
+ mBytes[6] += 4;
|
|
|
+ }
|
|
|
+ if (cbX2Y.isChecked()){
|
|
|
+ mBytes[6] += 8;
|
|
|
+ }
|
|
|
+ mBytes[6] += (byte)(spinStretchRank.getSelectedItemPosition() * 16);
|
|
|
+ if (cbAllPlamRestrain.isChecked()){
|
|
|
+ mBytes[6] += 64;
|
|
|
+ }
|
|
|
+ //mBytes[7]
|
|
|
+ if (cbTouchKey.isChecked()){
|
|
|
+ mBytes[7] = 1;
|
|
|
+ }
|
|
|
+ if (cbPenEn.isChecked()){
|
|
|
+ mBytes[7] += 2;
|
|
|
+ }
|
|
|
+ if (cbDiffDivideBy2or4.isChecked()){
|
|
|
+ mBytes[7] += 4;
|
|
|
+ }
|
|
|
+ if (cbOnlyFingerEn.isChecked()){
|
|
|
+ mBytes[7] += 8;
|
|
|
+ }
|
|
|
+ if (cbFirstFilterDis.isChecked()){
|
|
|
+ mBytes[7] += 32;
|
|
|
+ }
|
|
|
+ if (cbMonitorConsistencyConflictEn.isChecked()){
|
|
|
+ mBytes[7] += 64;
|
|
|
+ }
|
|
|
+ mBytes[8] = (byte)Integer.parseInt(edtShakeCnt.getText().toString(),16);
|
|
|
+ mBytes[9] = (byte)(Integer.parseInt(edtNormalFilter.getText().toString(),10) +
|
|
|
+ Integer.parseInt(edtFirstFilter.getText().toString(),10) * 64);
|
|
|
+ mBytes[10] = (byte)Integer.parseInt(edtLargeTouch.getText().toString(),10);
|
|
|
+ mBytes[11] = (byte)(Integer.parseInt(edtNoiseReduction.getText().toString(),10) & 0x0f);
|
|
|
+ mBytes[12] = (byte)Integer.parseInt(edtScreenTouchLv.getText().toString(),10);
|
|
|
+ mBytes[13] = (byte)Integer.parseInt(edtScreenLeaveLv.getText().toString(),10);
|
|
|
+ mBytes[14] = (byte)(Integer.parseInt(edtLowPowerControl.getText().toString(),10) & 0x0f);
|
|
|
+ mBytes[15] = (byte)(spinRefreshRate.getSelectedItemPosition());
|
|
|
+ mBytes[16] = (byte)Integer.parseInt(edtXThreshold.getText().toString(),10);
|
|
|
+ mBytes[17] = (byte)Integer.parseInt(edtYThreshold.getText().toString(),10);
|
|
|
+ //mBytes[18]
|
|
|
+ //mBytes[19]
|
|
|
+ mBytes[20] = (byte)Integer.parseInt(edtSpaceUpDown.getText().toString(),16);
|
|
|
+ mBytes[21] = (byte)Integer.parseInt(edtSpaceLeftRight.getText().toString(),16);
|
|
|
+ mBytes[22] = (byte)(Integer.parseInt(edtMiniFilter.getText().toString(),10) & 0x0f);
|
|
|
+ mBytes[23] = (byte)Integer.parseInt(edtStretchR0.getText().toString(),10);
|
|
|
+ mBytes[24] = (byte)Integer.parseInt(edtStretchR1.getText().toString(),10);
|
|
|
+ mBytes[25] = (byte)Integer.parseInt(edtStretchR2.getText().toString(),10);
|
|
|
+ mBytes[26] = (byte)Integer.parseInt(edtStretchRM.getText().toString(),10);
|
|
|
+ //mBytes[27]
|
|
|
+ mBytes[27] = (byte)Integer.parseInt(edtDrvGroupAnumber.getText().toString(),10);
|
|
|
+ if (cbAllDrivingEn.isChecked()){
|
|
|
+ mBytes[27] += 128;
|
|
|
+ }
|
|
|
+ //mBytes[28]
|
|
|
+ mBytes[28] = (byte)Integer.parseInt(edtDrvGroupBnumber.getText().toString(),10);
|
|
|
+ if (cbDualFreq.isChecked()){
|
|
|
+ mBytes[28] += 32;
|
|
|
+ }
|
|
|
+ mBytes[29] = (byte)(Integer.parseInt(edtSenGroupANumber.getText().toString(),10) +
|
|
|
+ Integer.parseInt(edtSenGroupBNumber.getText().toString(),10) * 16);
|
|
|
+ mBytes[30] = (byte)Integer.parseInt(edtFreqAFactor.getText().toString(),10);
|
|
|
+ mBytes[31] = (byte)Integer.parseInt(edtFreqBFactor.getText().toString(),10);
|
|
|
+ mBytes[32] = (byte)(Integer.parseInt(edtPannelBitFreq.getText().toString(),10) & 0x00ff);
|
|
|
+ mBytes[33] = (byte)(Integer.parseInt(edtPannelBitFreq.getText().toString(),10) >> 8);
|
|
|
+ mBytes[34] = (byte)((Integer.parseInt(edtExpanNumOutY.getText().toString(),10) & 0x0f) +
|
|
|
+ Integer.parseInt(edtExpanNumOutX.getText().toString(),10) * 16);
|
|
|
+ mBytes[35] = (byte)((Integer.parseInt(edtExpanNumInY.getText().toString(),10) & 0x0f) +
|
|
|
+ Integer.parseInt(edtExpanNumInX.getText().toString(),10) * 16);
|
|
|
+ mBytes[36] = (byte)(spinDACGain.getSelectedItemPosition() +
|
|
|
+ spinDrvOutputR.getSelectedItemPosition() * 8);
|
|
|
+ mBytes[37] = (byte)(spinPGAGain.getSelectedItemPosition() +
|
|
|
+ spinRxVcmi.getSelectedItemPosition() * 8 +
|
|
|
+ spinPGAR.getSelectedItemPosition() * 32 +
|
|
|
+ spinPGAC.getSelectedItemPosition() * 128);
|
|
|
+ mBytes[38] = (byte)(Integer.parseInt(edtDumpShift.getText().toString(),10) & 0x0f);
|
|
|
+ mBytes[39] = (byte)(Integer.parseInt(edtSubFrameDrvNum.getText().toString(),10) << 2);
|
|
|
+ mBytes[40] = (byte)Integer.parseInt(edtPenLowSize.getText().toString(),10);
|
|
|
+ mBytes[41] = (byte)Integer.parseInt(edtPenHighSize.getText().toString(),10);
|
|
|
+ mBytes[42] = (byte)Integer.parseInt(edtRectsumPLowL.getText().toString(),10);
|
|
|
+ mBytes[43] = (byte)Integer.parseInt(edtRectsumPHighL.getText().toString(),10);
|
|
|
+ mBytes[44] = (byte)Integer.parseInt(edtRectsumFLowL.getText().toString(),10);
|
|
|
+ mBytes[45] = (byte)Integer.parseInt(edtPRectMaxDiffLimit.getText().toString(),10);
|
|
|
+ mBytes[46] = (byte)Integer.parseInt(edtPRectAreaLimit.getText().toString(),10);
|
|
|
+ mBytes[47] = (byte)Integer.parseInt(edtSingleRectTopSignNum.getText().toString(),10);
|
|
|
+ mBytes[48] = (byte)Integer.parseInt(edtAllRectTopSignSum.getText().toString(),10);
|
|
|
+ mBytes[49] = (byte)Integer.parseInt(edtChargingLevelUp.getText().toString(),10);
|
|
|
+ //mBytes[50]
|
|
|
+ mBytes[51] = (byte)Integer.parseInt(edtFreqStart.getText().toString(),10);
|
|
|
+ mBytes[52] = (byte)Integer.parseInt(edtFreqEnd.getText().toString(),10);
|
|
|
+ mBytes[53] = (byte)(Integer.parseInt(edtDetectConfirmTimes.getText().toString(),10) +
|
|
|
+ Integer.parseInt(edtDetectStayTimes.getText().toString(),10) * 64);
|
|
|
+ //mBytes[54]
|
|
|
+ if (cbDelayHopping.isChecked()){
|
|
|
+ mBytes[54] = 16;
|
|
|
+ }
|
|
|
+ if (cbDisForceRef.isChecked()){
|
|
|
+ mBytes[54] += 32;
|
|
|
+ }
|
|
|
+ if (cbRangeExt.isChecked()){
|
|
|
+ mBytes[54] += 64;
|
|
|
+ }
|
|
|
+ if (cbHoppingEn.isChecked()){
|
|
|
+ mBytes[54] += 128;
|
|
|
+ }
|
|
|
+ mBytes[55] = (byte)(Integer.parseInt(edtHopThreshold.getText().toString(),10) +
|
|
|
+ Integer.parseInt(edtFastHopLimit.getText().toString(),10) * 16);
|
|
|
+ //mBytes[56]
|
|
|
+ mBytes[57] = (byte)Integer.parseInt(edtNoiseMinTh.getText().toString(),10);
|
|
|
+ mBytes[58] = (byte)Integer.parseInt(edtLcdPlusMinusValue.getText().toString(),10);
|
|
|
+ mBytes[59] = (byte)Integer.parseInt(edtSensorGroup.getText().toString(),10);
|
|
|
+ mBytes[60] = (byte)Integer.parseInt(edtSeg1Normalize.getText().toString(),10);
|
|
|
+ mBytes[61] = (byte)Integer.parseInt(edtSeg1Factor.getText().toString(),10);
|
|
|
+ mBytes[62] = (byte)Integer.parseInt(edtMainClockAjdust.getText().toString(),10);
|
|
|
+ mBytes[63] = (byte)Integer.parseInt(edtSeg2Normalize.getText().toString(),10);
|
|
|
+ mBytes[64] = (byte)Integer.parseInt(edtSeg2Factor.getText().toString(),10);
|
|
|
+ //mBytes[65]
|
|
|
+ mBytes[66] = (byte)Integer.parseInt(edtSeg3Normalize.getText().toString(),10);
|
|
|
+ mBytes[67] = (byte)Integer.parseInt(edtSeg3Factor.getText().toString(),10);
|
|
|
+ //mBytes[68]
|
|
|
+ mBytes[69] = (byte)Integer.parseInt(edtSeg4Normalize.getText().toString(),10);
|
|
|
+ mBytes[70] = (byte)Integer.parseInt(edtSeg4Factor.getText().toString(),10);
|
|
|
+ //mBytes[71]
|
|
|
+ mBytes[72] = (byte)Integer.parseInt(edtSeg5Normalize.getText().toString(),10);
|
|
|
+ mBytes[73] = (byte)Integer.parseInt(edtSeg5Factor.getText().toString(),10);
|
|
|
+ //mBytes[74]
|
|
|
+ mBytes[75] = (byte)Integer.parseInt(edtSeg6Normalize.getText().toString(),10);
|
|
|
+ mBytes[76] = (byte)Integer.parseInt(edtKey1.getText().toString(),16);
|
|
|
+ mBytes[77] = (byte)Integer.parseInt(edtKey2.getText().toString(),16);
|
|
|
+ mBytes[78] = (byte)Integer.parseInt(edtKey3.getText().toString(),16);
|
|
|
+ mBytes[79] = (byte)Integer.parseInt(edtKey4.getText().toString(),16);
|
|
|
+ mBytes[80] = (byte)Integer.parseInt(edtKeyArea.getText().toString(),16);
|
|
|
+ mBytes[81] = (byte)Integer.parseInt(edtKeyTouchLevel.getText().toString(),16);
|
|
|
+ mBytes[82] = (byte)Integer.parseInt(edtKeyLeaveLevel.getText().toString(),16);
|
|
|
+ mBytes[83] = (byte)Integer.parseInt(edtKeySens1and2.getText().toString(),16);
|
|
|
+ mBytes[84] = (byte)Integer.parseInt(edtKeySens3and4.getText().toString(),16);
|
|
|
+ mBytes[85] = (byte)Integer.parseInt(edtKeyRestrain.getText().toString(),16);
|
|
|
+ mBytes[86] = (byte)(Integer.parseInt(edtKeyRestrainTime.getText().toString(),16) & 0x0f);
|
|
|
+ mBytes[87] = (byte)(Integer.parseInt(edtShapeRestrain.getText().toString(),10) & 0x7f);
|
|
|
+ mBytes[88] = (byte)Integer.parseInt(edtConThreshold.getText().toString(),10);
|
|
|
+ mBytes[89] = (byte)Integer.parseInt(edtWaterFrameTime.getText().toString(),10);
|
|
|
+ mBytes[90] = (byte)Integer.parseInt(edtWaterUpdateTime.getText().toString(),10);
|
|
|
+ //mBytes[91]
|
|
|
+ if (cbWaterSpeedLimitEn.isChecked()){
|
|
|
+ mBytes[91] = 1;
|
|
|
+ }
|
|
|
+ if (cbWaterLargeRestrainEn.isChecked()){
|
|
|
+ mBytes[91] += 2;
|
|
|
+ }
|
|
|
+ if (cbShapeEn.isChecked()){
|
|
|
+ mBytes[91] += 4;
|
|
|
+ }
|
|
|
+ if (cbWaterProofDis.isChecked()){
|
|
|
+ mBytes[91] += 8;
|
|
|
+ }
|
|
|
+ if (cbLcdPlusMinusEn.isChecked()){
|
|
|
+ mBytes[91] += 16;
|
|
|
+ }
|
|
|
+ //mBytes[92]
|
|
|
+ mBytes[92] = (byte)(spinVoltage.getSelectedItemPosition() +
|
|
|
+ spinBoostTime.getSelectedItemPosition() * 16);
|
|
|
+ if (cbExtoscen.isChecked()){
|
|
|
+ mBytes[93] = (byte)128;
|
|
|
+ }
|
|
|
+ mBytes[94] = (byte)spinAlterCount.getSelectedItemPosition();
|
|
|
+ //mBytes[95]
|
|
|
+ mBytes[96] = (byte)Integer.parseInt(edtSlideInEdgeConfig.getText().toString(),10);
|
|
|
+ mBytes[97] = (byte)Integer.parseInt(edtSlideOutEdgeConfig.getText().toString(),10);
|
|
|
+ //mBytes[98]
|
|
|
+ //mBytes[99]
|
|
|
+ //mBytes[100]
|
|
|
+ //mBytes[101]
|
|
|
+ //mBytes[102]
|
|
|
+ //mBytes[103]
|
|
|
+ //mBytes[104]
|
|
|
+ if (cbX2X.isChecked()){
|
|
|
+ mBytes[104] = 1;
|
|
|
+ }
|
|
|
+ if (cbY2Y.isChecked()){
|
|
|
+ mBytes[104] += 2;
|
|
|
+ }
|
|
|
+ if (cbESDEn.isChecked()){
|
|
|
+ mBytes[104] += 16;
|
|
|
+ }
|
|
|
+ if (cbINTWakeup.isChecked()){
|
|
|
+ mBytes[104] += 32;
|
|
|
+ }
|
|
|
+ mBytes[104] += (byte)(spinFingerRestrainPen.getSelectedItemPosition() * 64);
|
|
|
+ mBytes[105] = (byte)(Integer.parseInt(edtShapeContrl.getText().toString(),10) +
|
|
|
+ Integer.parseInt(edtHopDetectTimes.getText().toString(),10) * 32);
|
|
|
+ mBytes[106] = (byte)(Integer.parseInt(edtCombineDis.getText().toString(),16) & 0x0f);
|
|
|
+ mBytes[107] = (byte)Integer.parseInt(edtSplitSet.getText().toString(),16);
|
|
|
+ mBytes[108] = (byte)Integer.parseInt(edtFLeavelevel.getText().toString(),10);
|
|
|
+ //mBytes[109]
|
|
|
+ mBytes[110] = (byte)Integer.parseInt(edtSitoDiffRefLevel.getText().toString(),10);
|
|
|
+ mBytes[111] = (byte)Integer.parseInt(edtPTouchHighlevel.getText().toString(),10);
|
|
|
+ mBytes[112] = (byte)Integer.parseInt(edtSensorCH0.getText().toString(),10);
|
|
|
+ mBytes[113] = (byte)Integer.parseInt(edtSensorCH1.getText().toString(),10);
|
|
|
+ mBytes[114] = (byte)Integer.parseInt(edtSensorCH2.getText().toString(),10);
|
|
|
+ mBytes[115] = (byte)Integer.parseInt(edtSensorCH3.getText().toString(),10);
|
|
|
+ mBytes[116] = (byte)Integer.parseInt(edtSensorCH4.getText().toString(),10);
|
|
|
+ mBytes[117] = (byte)Integer.parseInt(edtSensorCH5.getText().toString(),10);
|
|
|
+ mBytes[118] = (byte)Integer.parseInt(edtSensorCH6.getText().toString(),10);
|
|
|
+ mBytes[119] = (byte)Integer.parseInt(edtSensorCH7.getText().toString(),10);
|
|
|
+ mBytes[120] = (byte)Integer.parseInt(edtSensorCH8.getText().toString(),10);
|
|
|
+ mBytes[121] = (byte)Integer.parseInt(edtSensorCH9.getText().toString(),10);
|
|
|
+ mBytes[122] = (byte)Integer.parseInt(edtSensorCH10.getText().toString(),10);
|
|
|
+ mBytes[123] = (byte)Integer.parseInt(edtSensorCH11.getText().toString(),10);
|
|
|
+ mBytes[124] = (byte)Integer.parseInt(edtSensorCH12.getText().toString(),10);
|
|
|
+ mBytes[125] = (byte)Integer.parseInt(edtSensorCH13.getText().toString(),10);
|
|
|
+ mBytes[126] = (byte)Integer.parseInt(edtSensorCH14.getText().toString(),10);
|
|
|
+ mBytes[127] = (byte)Integer.parseInt(edtSensorCH15.getText().toString(),10);
|
|
|
+ mBytes[128] = (byte)Integer.parseInt(edtSensorCH16.getText().toString(),10);
|
|
|
+ mBytes[129] = (byte)Integer.parseInt(edtSensorCH17.getText().toString(),10);
|
|
|
+ mBytes[130] = (byte)Integer.parseInt(edtSensorCH18.getText().toString(),10);
|
|
|
+ mBytes[131] = (byte)Integer.parseInt(edtSensorCH19.getText().toString(),10);
|
|
|
+ mBytes[132] = (byte)Integer.parseInt(edtSensorCH20.getText().toString(),10);
|
|
|
+ mBytes[133] = (byte)Integer.parseInt(edtSensorCH21.getText().toString(),10);
|
|
|
+ mBytes[134] = (byte)Integer.parseInt(edtSensorCH22.getText().toString(),10);
|
|
|
+ mBytes[135] = (byte)Integer.parseInt(edtSensorCH23.getText().toString(),10);
|
|
|
+ mBytes[136] = (byte)Integer.parseInt(edtSensorCH24.getText().toString(),10);
|
|
|
+ mBytes[137] = (byte)Integer.parseInt(edtSensorCH25.getText().toString(),10);
|
|
|
+ mBytes[138] = (byte)Integer.parseInt(edtSensorCH26.getText().toString(),10);
|
|
|
+ mBytes[139] = (byte)Integer.parseInt(edtSensorCH27.getText().toString(),10);
|
|
|
+ mBytes[140] = (byte)Integer.parseInt(edtSensorCH28.getText().toString(),10);
|
|
|
+ mBytes[141] = (byte)Integer.parseInt(edtSensorCH29.getText().toString(),10);
|
|
|
+ mBytes[142] = (byte)Integer.parseInt(edtDriverCH0.getText().toString(),10);
|
|
|
+ mBytes[143] = (byte)Integer.parseInt(edtDriverCH1.getText().toString(),10);
|
|
|
+ mBytes[144] = (byte)Integer.parseInt(edtDriverCH2.getText().toString(),10);
|
|
|
+ mBytes[145] = (byte)Integer.parseInt(edtDriverCH3.getText().toString(),10);
|
|
|
+ mBytes[146] = (byte)Integer.parseInt(edtDriverCH4.getText().toString(),10);
|
|
|
+ mBytes[147] = (byte)Integer.parseInt(edtDriverCH5.getText().toString(),10);
|
|
|
+ mBytes[148] = (byte)Integer.parseInt(edtDriverCH6.getText().toString(),10);
|
|
|
+ mBytes[149] = (byte)Integer.parseInt(edtDriverCH7.getText().toString(),10);
|
|
|
+ mBytes[150] = (byte)Integer.parseInt(edtDriverCH8.getText().toString(),10);
|
|
|
+ mBytes[151] = (byte)Integer.parseInt(edtDriverCH9.getText().toString(),10);
|
|
|
+ mBytes[152] = (byte)Integer.parseInt(edtDriverCH10.getText().toString(),10);
|
|
|
+ mBytes[153] = (byte)Integer.parseInt(edtDriverCH11.getText().toString(),10);
|
|
|
+ mBytes[154] = (byte)Integer.parseInt(edtDriverCH12.getText().toString(),10);
|
|
|
+ mBytes[155] = (byte)Integer.parseInt(edtDriverCH13.getText().toString(),10);
|
|
|
+ mBytes[156] = (byte)Integer.parseInt(edtDriverCH14.getText().toString(),10);
|
|
|
+ mBytes[157] = (byte)Integer.parseInt(edtDriverCH15.getText().toString(),10);
|
|
|
+ mBytes[158] = (byte)Integer.parseInt(edtDriverCH16.getText().toString(),10);
|
|
|
+ mBytes[159] = (byte)Integer.parseInt(edtDriverCH17.getText().toString(),10);
|
|
|
+ mBytes[160] = (byte)Integer.parseInt(edtDriverCH18.getText().toString(),10);
|
|
|
+ mBytes[161] = (byte)Integer.parseInt(edtDriverCH19.getText().toString(),10);
|
|
|
+ mBytes[162] = (byte)Integer.parseInt(edtDriverCH20.getText().toString(),10);
|
|
|
+ mBytes[163] = (byte)Integer.parseInt(edtDriverCH21.getText().toString(),10);
|
|
|
+ mBytes[164] = (byte)Integer.parseInt(edtDriverCH22.getText().toString(),10);
|
|
|
+ mBytes[165] = (byte)Integer.parseInt(edtDriverCH23.getText().toString(),10);
|
|
|
+ mBytes[166] = (byte)Integer.parseInt(edtDriverCH24.getText().toString(),10);
|
|
|
+ mBytes[167] = (byte)Integer.parseInt(edtDriverCH25.getText().toString(),10);
|
|
|
+ mBytes[168] = (byte)Integer.parseInt(edtDriverCH26.getText().toString(),10);
|
|
|
+ mBytes[169] = (byte)Integer.parseInt(edtDriverCH27.getText().toString(),10);
|
|
|
+ mBytes[170] = (byte)Integer.parseInt(edtDriverCH28.getText().toString(),10);
|
|
|
+ mBytes[171] = (byte)Integer.parseInt(edtDriverCH29.getText().toString(),10);
|
|
|
+ mBytes[172] = (byte)Integer.parseInt(edtDriverCH30.getText().toString(),10);
|
|
|
+ mBytes[173] = (byte)Integer.parseInt(edtDriverCH31.getText().toString(),10);
|
|
|
+ mBytes[174] = (byte)Integer.parseInt(edtDriverCH32.getText().toString(),10);
|
|
|
+ mBytes[175] = (byte)Integer.parseInt(edtDriverCH33.getText().toString(),10);
|
|
|
+ mBytes[176] = (byte)Integer.parseInt(edtDriverCH34.getText().toString(),10);
|
|
|
+ mBytes[177] = (byte)Integer.parseInt(edtDriverCH35.getText().toString(),10);
|
|
|
+ mBytes[178] = (byte)Integer.parseInt(edtDriverCH36.getText().toString(),10);
|
|
|
+ mBytes[179] = (byte)Integer.parseInt(edtDriverCH37.getText().toString(),10);
|
|
|
+ mBytes[180] = (byte)Integer.parseInt(edtDriverCH38.getText().toString(),10);
|
|
|
+ mBytes[181] = (byte)Integer.parseInt(edtDriverCH39.getText().toString(),10);
|
|
|
+ mBytes[182] = (byte)Integer.parseInt(edtDriverCH40.getText().toString(),10);
|
|
|
+ mBytes[183] = (byte)Integer.parseInt(edtDriverCH41.getText().toString(),10);
|
|
|
+
|
|
|
+ int checksum = 0;
|
|
|
+ for (int i = 0; i < 184; i++) {
|
|
|
+ int k = mBytes[i] & 0xFF;
|
|
|
+ checksum = checksum + k;
|
|
|
+ }
|
|
|
+ mBytes[184] = (byte)(256 - (checksum % 256));
|
|
|
+
|
|
|
+ mBytes[185] = 1;
|
|
|
+
|
|
|
+ }
|
|
|
+ //======================================合并配置结束===========================================//
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(final View v) {
|
|
|
+ byte starttemp;
|
|
|
+ byte endtemp;
|
|
|
+ byte revtemp;
|
|
|
+ byte[] ichanneldata = new byte[44];
|
|
|
+ StringBuilder configBuilder = new StringBuilder("");
|
|
|
+ String[] stringArr;
|
|
|
+
|
|
|
+ switch (v.getId()) {
|
|
|
+ case R.id.tvsample:
|
|
|
+ vpagerCfg.setCurrentItem(0);
|
|
|
+ iChooseVPager = 0;
|
|
|
+ break;
|
|
|
+ case R.id.tvmoduleswitch:
|
|
|
+ vpagerCfg.setCurrentItem(1);
|
|
|
+ iChooseVPager = 1;
|
|
|
+ break;
|
|
|
+ case R.id.tvnormal:
|
|
|
+ vpagerCfg.setCurrentItem(2);
|
|
|
+ iChooseVPager = 2;
|
|
|
+ break;
|
|
|
+ case R.id.tvchannel:
|
|
|
+ vpagerCfg.setCurrentItem(3);
|
|
|
+ iChooseVPager = 3;
|
|
|
+ break;
|
|
|
+ case R.id.tvpen:
|
|
|
+ vpagerCfg.setCurrentItem(4);
|
|
|
+ iChooseVPager = 4;
|
|
|
+ break;
|
|
|
+ case R.id.tvplamrestrain:
|
|
|
+ vpagerCfg.setCurrentItem(5);
|
|
|
+ iChooseVPager = 5;
|
|
|
+ break;
|
|
|
+ case R.id.tvkey:
|
|
|
+ vpagerCfg.setCurrentItem(6);
|
|
|
+ iChooseVPager = 6;
|
|
|
+ break;
|
|
|
+ case R.id.tvhopping:
|
|
|
+ vpagerCfg.setCurrentItem(7);
|
|
|
+ iChooseVPager = 7;
|
|
|
+ break;
|
|
|
+ case R.id.tvcfgram:
|
|
|
+ vpagerCfg.setCurrentItem(8);
|
|
|
+ iChooseVPager = 8;
|
|
|
+ break;
|
|
|
+ case R.id.btnsensorrev:
|
|
|
+ configBuilder.append(edtSensorCH0.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH1.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH2.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH3.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH4.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH5.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH6.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH7.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH8.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH9.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH10.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH11.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH12.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH13.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH14.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH15.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH16.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH17.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH18.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH19.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH20.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH21.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH22.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH23.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH24.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH25.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH26.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH27.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH28.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorCH29.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorStart.getText().toString()+",");
|
|
|
+ configBuilder.append(edtSensorEnd.getText().toString()+",");
|
|
|
+
|
|
|
+ value = configBuilder.toString();
|
|
|
+ stringArr = value.split(",");
|
|
|
+
|
|
|
+ for (int b = 0; b < stringArr.length; b++) {
|
|
|
+ byte aByte = (byte) Integer.parseInt(stringArr[b], 10);
|
|
|
+ ichanneldata[b] = aByte;
|
|
|
+ }
|
|
|
+
|
|
|
+ starttemp = ichanneldata[30];
|
|
|
+ endtemp = ichanneldata[31];
|
|
|
+ if ((endtemp == 0) || (starttemp > endtemp)){
|
|
|
+ starttemp = 0;
|
|
|
+ if (bSensorNumber == 0){
|
|
|
+ endtemp = 29;
|
|
|
+ }else{
|
|
|
+ endtemp = (byte)(bSensorNumber - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = starttemp,j = 0; i < (endtemp + 1) / 2; i++,j++){
|
|
|
+ revtemp = ichanneldata[i];
|
|
|
+ ichanneldata[i] = ichanneldata[endtemp - j];
|
|
|
+ ichanneldata[endtemp - j] = revtemp;
|
|
|
+ }
|
|
|
+
|
|
|
+ edtSensorCH0.setText(Integer.toString(ichanneldata[0] & 0xFF));
|
|
|
+ edtSensorCH1.setText(Integer.toString(ichanneldata[1] & 0xFF));
|
|
|
+ edtSensorCH2.setText(Integer.toString(ichanneldata[2] & 0xFF));
|
|
|
+ edtSensorCH3.setText(Integer.toString(ichanneldata[3] & 0xFF));
|
|
|
+ edtSensorCH4.setText(Integer.toString(ichanneldata[4] & 0xFF));
|
|
|
+ edtSensorCH5.setText(Integer.toString(ichanneldata[5] & 0xFF));
|
|
|
+ edtSensorCH6.setText(Integer.toString(ichanneldata[6] & 0xFF));
|
|
|
+ edtSensorCH7.setText(Integer.toString(ichanneldata[7] & 0xFF));
|
|
|
+ edtSensorCH8.setText(Integer.toString(ichanneldata[8] & 0xFF));
|
|
|
+ edtSensorCH9.setText(Integer.toString(ichanneldata[9] & 0xFF));
|
|
|
+ edtSensorCH10.setText(Integer.toString(ichanneldata[10] & 0xFF));
|
|
|
+ edtSensorCH11.setText(Integer.toString(ichanneldata[11] & 0xFF));
|
|
|
+ edtSensorCH12.setText(Integer.toString(ichanneldata[12] & 0xFF));
|
|
|
+ edtSensorCH13.setText(Integer.toString(ichanneldata[13] & 0xFF));
|
|
|
+ edtSensorCH14.setText(Integer.toString(ichanneldata[14] & 0xFF));
|
|
|
+ edtSensorCH15.setText(Integer.toString(ichanneldata[15] & 0xFF));
|
|
|
+ edtSensorCH16.setText(Integer.toString(ichanneldata[16] & 0xFF));
|
|
|
+ edtSensorCH17.setText(Integer.toString(ichanneldata[17] & 0xFF));
|
|
|
+ edtSensorCH18.setText(Integer.toString(ichanneldata[18] & 0xFF));
|
|
|
+ edtSensorCH19.setText(Integer.toString(ichanneldata[19] & 0xFF));
|
|
|
+ edtSensorCH20.setText(Integer.toString(ichanneldata[20] & 0xFF));
|
|
|
+ edtSensorCH21.setText(Integer.toString(ichanneldata[21] & 0xFF));
|
|
|
+ edtSensorCH22.setText(Integer.toString(ichanneldata[22] & 0xFF));
|
|
|
+ edtSensorCH23.setText(Integer.toString(ichanneldata[23] & 0xFF));
|
|
|
+ edtSensorCH24.setText(Integer.toString(ichanneldata[24] & 0xFF));
|
|
|
+ edtSensorCH25.setText(Integer.toString(ichanneldata[25] & 0xFF));
|
|
|
+ edtSensorCH26.setText(Integer.toString(ichanneldata[26] & 0xFF));
|
|
|
+ edtSensorCH27.setText(Integer.toString(ichanneldata[27] & 0xFF));
|
|
|
+ edtSensorCH28.setText(Integer.toString(ichanneldata[28] & 0xFF));
|
|
|
+ edtSensorCH29.setText(Integer.toString(ichanneldata[29] & 0xFF));
|
|
|
+ break;
|
|
|
+ case R.id.allsensorchannels:
|
|
|
+ edtSensorCH0.setText("00");edtSensorCH1.setText("01");edtSensorCH2.setText("02");edtSensorCH3.setText("03");edtSensorCH4.setText("04");
|
|
|
+ edtSensorCH5.setText("05");edtSensorCH6.setText("06");edtSensorCH7.setText("07");edtSensorCH8.setText("08");edtSensorCH9.setText("09");
|
|
|
+ edtSensorCH10.setText("10");edtSensorCH11.setText("11");edtSensorCH12.setText("12");edtSensorCH13.setText("13");edtSensorCH14.setText("14");
|
|
|
+ edtSensorCH15.setText("15");edtSensorCH16.setText("16");edtSensorCH17.setText("17");edtSensorCH18.setText("18");edtSensorCH19.setText("19");
|
|
|
+ edtSensorCH20.setText("20");edtSensorCH21.setText("21");edtSensorCH22.setText("22");edtSensorCH23.setText("23");edtSensorCH24.setText("24");
|
|
|
+ edtSensorCH25.setText("25");edtSensorCH26.setText("26");edtSensorCH27.setText("27");edtSensorCH28.setText("28");edtSensorCH29.setText("29");
|
|
|
+ break;
|
|
|
+ case R.id.btndriverrev:
|
|
|
+ configBuilder.append(edtDriverCH0.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH1.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH2.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH3.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH4.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH5.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH6.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH7.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH8.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH9.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH10.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH11.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH12.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH13.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH14.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH15.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH16.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH17.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH18.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH19.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH20.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH21.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH22.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH23.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH24.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH25.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH26.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH27.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH28.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH29.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH30.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH31.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH32.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH33.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH34.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH35.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH36.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH37.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH38.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH39.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH40.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverCH41.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverStart.getText().toString()+",");
|
|
|
+ configBuilder.append(edtDriverEnd.getText().toString()+",");
|
|
|
+
|
|
|
+ value = configBuilder.toString();
|
|
|
+ stringArr = value.split(",");
|
|
|
+
|
|
|
+ for (int b = 0; b < stringArr.length; b++) {
|
|
|
+ byte aByte = (byte) Integer.parseInt(stringArr[b], 10);
|
|
|
+ ichanneldata[b] = aByte;
|
|
|
+ }
|
|
|
+
|
|
|
+ starttemp = ichanneldata[42];
|
|
|
+ endtemp = ichanneldata[43];
|
|
|
+ if ((endtemp == 0) || (starttemp > endtemp)){
|
|
|
+ starttemp = 0;
|
|
|
+ if (bDriverNumber == 0){
|
|
|
+ endtemp = 41;
|
|
|
+ }else{
|
|
|
+ endtemp = (byte)(bDriverNumber - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = starttemp,j = 0; i < (endtemp + 1) / 2; i++,j++){
|
|
|
+ revtemp = ichanneldata[i];
|
|
|
+ ichanneldata[i] = ichanneldata[endtemp - j];
|
|
|
+ ichanneldata[endtemp - j] = revtemp;
|
|
|
+ }
|
|
|
+
|
|
|
+ edtDriverCH0.setText(Integer.toString(ichanneldata[0] & 0xFF));
|
|
|
+ edtDriverCH1.setText(Integer.toString(ichanneldata[1] & 0xFF));
|
|
|
+ edtDriverCH2.setText(Integer.toString(ichanneldata[2] & 0xFF));
|
|
|
+ edtDriverCH3.setText(Integer.toString(ichanneldata[3] & 0xFF));
|
|
|
+ edtDriverCH4.setText(Integer.toString(ichanneldata[4] & 0xFF));
|
|
|
+ edtDriverCH5.setText(Integer.toString(ichanneldata[5] & 0xFF));
|
|
|
+ edtDriverCH6.setText(Integer.toString(ichanneldata[6] & 0xFF));
|
|
|
+ edtDriverCH7.setText(Integer.toString(ichanneldata[7] & 0xFF));
|
|
|
+ edtDriverCH8.setText(Integer.toString(ichanneldata[8] & 0xFF));
|
|
|
+ edtDriverCH9.setText(Integer.toString(ichanneldata[9] & 0xFF));
|
|
|
+ edtDriverCH10.setText(Integer.toString(ichanneldata[10] & 0xFF));
|
|
|
+ edtDriverCH11.setText(Integer.toString(ichanneldata[11] & 0xFF));
|
|
|
+ edtDriverCH12.setText(Integer.toString(ichanneldata[12] & 0xFF));
|
|
|
+ edtDriverCH13.setText(Integer.toString(ichanneldata[13] & 0xFF));
|
|
|
+ edtDriverCH14.setText(Integer.toString(ichanneldata[14] & 0xFF));
|
|
|
+ edtDriverCH15.setText(Integer.toString(ichanneldata[15] & 0xFF));
|
|
|
+ edtDriverCH16.setText(Integer.toString(ichanneldata[16] & 0xFF));
|
|
|
+ edtDriverCH17.setText(Integer.toString(ichanneldata[17] & 0xFF));
|
|
|
+ edtDriverCH18.setText(Integer.toString(ichanneldata[18] & 0xFF));
|
|
|
+ edtDriverCH19.setText(Integer.toString(ichanneldata[19] & 0xFF));
|
|
|
+ edtDriverCH20.setText(Integer.toString(ichanneldata[20] & 0xFF));
|
|
|
+ edtDriverCH21.setText(Integer.toString(ichanneldata[21] & 0xFF));
|
|
|
+ edtDriverCH22.setText(Integer.toString(ichanneldata[22] & 0xFF));
|
|
|
+ edtDriverCH23.setText(Integer.toString(ichanneldata[23] & 0xFF));
|
|
|
+ edtDriverCH24.setText(Integer.toString(ichanneldata[24] & 0xFF));
|
|
|
+ edtDriverCH25.setText(Integer.toString(ichanneldata[25] & 0xFF));
|
|
|
+ edtDriverCH26.setText(Integer.toString(ichanneldata[26] & 0xFF));
|
|
|
+ edtDriverCH27.setText(Integer.toString(ichanneldata[27] & 0xFF));
|
|
|
+ edtDriverCH28.setText(Integer.toString(ichanneldata[28] & 0xFF));
|
|
|
+ edtDriverCH29.setText(Integer.toString(ichanneldata[29] & 0xFF));
|
|
|
+ edtDriverCH30.setText(Integer.toString(ichanneldata[30] & 0xFF));
|
|
|
+ edtDriverCH31.setText(Integer.toString(ichanneldata[31] & 0xFF));
|
|
|
+ edtDriverCH32.setText(Integer.toString(ichanneldata[32] & 0xFF));
|
|
|
+ edtDriverCH33.setText(Integer.toString(ichanneldata[33] & 0xFF));
|
|
|
+ edtDriverCH34.setText(Integer.toString(ichanneldata[34] & 0xFF));
|
|
|
+ edtDriverCH35.setText(Integer.toString(ichanneldata[35] & 0xFF));
|
|
|
+ edtDriverCH36.setText(Integer.toString(ichanneldata[36] & 0xFF));
|
|
|
+ edtDriverCH37.setText(Integer.toString(ichanneldata[37] & 0xFF));
|
|
|
+ edtDriverCH38.setText(Integer.toString(ichanneldata[38] & 0xFF));
|
|
|
+ edtDriverCH39.setText(Integer.toString(ichanneldata[39] & 0xFF));
|
|
|
+ edtDriverCH40.setText(Integer.toString(ichanneldata[40] & 0xFF));
|
|
|
+ edtDriverCH41.setText(Integer.toString(ichanneldata[41] & 0xFF));
|
|
|
+ break;
|
|
|
+ case R.id.alldriverchannels:
|
|
|
+ edtDriverCH0.setText("00");edtDriverCH1.setText("01");edtDriverCH2.setText("02");edtDriverCH3.setText("03");edtDriverCH4.setText("04");
|
|
|
+ edtDriverCH5.setText("05");edtDriverCH6.setText("06");edtDriverCH7.setText("07");edtDriverCH8.setText("08");edtDriverCH9.setText("09");
|
|
|
+ edtDriverCH10.setText("10");edtDriverCH11.setText("11");edtDriverCH12.setText("12");edtDriverCH13.setText("13");edtDriverCH14.setText("14");
|
|
|
+ edtDriverCH15.setText("15");edtDriverCH16.setText("16");edtDriverCH17.setText("17");edtDriverCH18.setText("18");edtDriverCH19.setText("19");
|
|
|
+ edtDriverCH20.setText("20");edtDriverCH21.setText("21");edtDriverCH22.setText("22");edtDriverCH23.setText("23");edtDriverCH24.setText("24");
|
|
|
+ edtDriverCH25.setText("25");edtDriverCH26.setText("26");edtDriverCH27.setText("27");edtDriverCH28.setText("28");edtDriverCH29.setText("29");
|
|
|
+ edtDriverCH30.setText("30");edtDriverCH31.setText("31");edtDriverCH32.setText("32");edtDriverCH33.setText("33");edtDriverCH34.setText("34");
|
|
|
+ edtDriverCH35.setText("35");edtDriverCH36.setText("36");edtDriverCH37.setText("37");edtDriverCH38.setText("38");edtDriverCH39.setText("39");
|
|
|
+ edtDriverCH40.setText("40");edtDriverCH41.setText("41");
|
|
|
+ break;
|
|
|
+ case R.id.sendcfg: //send cfg
|
|
|
+ bottonMode = 1;
|
|
|
+
|
|
|
+ if (iChooseVPager == 8) {
|
|
|
+ configBuilder.append(mCfg8047.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8048.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8049.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg804F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8050.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8051.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8052.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8053.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8054.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8055.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8056.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8057.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8058.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8059.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg805F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8060.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8061.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8062.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8063.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8064.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8065.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8066.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8067.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8068.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8069.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg806F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8070.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8071.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8072.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8073.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8074.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8075.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8076.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8077.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8078.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8079.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg807F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8080.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8081.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8082.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8083.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8084.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8085.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8086.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8087.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8088.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8089.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg808F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8090.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8091.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8092.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8093.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8094.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8095.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8096.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8097.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8098.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg8099.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809A.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809B.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809C.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809D.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809E.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg809F.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80A0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80A9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AD.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80AF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80B0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80B9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BD.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80BF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80C0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80C9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CD.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80CF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80D0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80D9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DD.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80DF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80E0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80E9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80EA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80EB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80EC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80ED.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80EE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80EF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg80F0.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F1.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F2.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F3.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F4.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F5.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F6.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F7.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F8.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80F9.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FA.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FB.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FC.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FD.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FE.getText().toString() + ",");
|
|
|
+ configBuilder.append(mCfg80FF.getText().toString() + ",");
|
|
|
+
|
|
|
+ configBuilder.append(mCfg8100.getText().toString());
|
|
|
+ }else{ //在其他界面则保存
|
|
|
+ CombineCfg();
|
|
|
+ for (int i = 0; i < 185; i++){
|
|
|
+ String hv = Integer.toHexString(mBytes[i] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ configBuilder.append(hv + ",");
|
|
|
+ }
|
|
|
+
|
|
|
+ configBuilder.append("01"); //mBytes[185],最后置上1
|
|
|
+ }
|
|
|
+ //mShow.setText(configBuilder.toString());
|
|
|
+
|
|
|
+ value = configBuilder.toString();
|
|
|
+ //value = mMessage.getText().toString();
|
|
|
+ stringArr = value.split(",");
|
|
|
+
|
|
|
+ value = value.replace(',', ' '); //逗号转换为空格
|
|
|
+
|
|
|
+ value = value.trim(); //去除空格
|
|
|
+ value = value.replaceAll(" ", ""); //逗号转换为空格
|
|
|
+ //char mTextData[] = value.toCharArray();
|
|
|
+ byte[] mBufferData = new byte[1024];
|
|
|
+
|
|
|
+ for (int b = 0; b < stringArr.length; b++) {
|
|
|
+ byte aByte = (byte) Integer.parseInt(stringArr[b], 16);
|
|
|
+ mBufferData[b] = aByte;
|
|
|
+ }
|
|
|
+ //mBufferData = value.getBytes();
|
|
|
+ mSendData = new byte[1024];
|
|
|
+
|
|
|
+ //重新计算checksum
|
|
|
+ int checksum = 0;
|
|
|
+ for (int i = 0; i < 184; i++) {
|
|
|
+ int vb = mBufferData[i] & 0xFF;
|
|
|
+ checksum = checksum + vb;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ //将checksum填入配置中
|
|
|
+ //if (checksum % 256 == 0) //校验和正确
|
|
|
+ {
|
|
|
+ mBufferData[184] = (byte) (256 - checksum % 256);
|
|
|
+ // mShow.setText("Cfg Checksum re-calculation!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新配置标志位
|
|
|
+ mBufferData[185] = 0x01;
|
|
|
+
|
|
|
+ //mSendData = mBufferData;
|
|
|
+ //mHandler.sendEmptyMessage(DEBUG_MESSAGE_SUCCESS);
|
|
|
+
|
|
|
+ //扩展命令 0x03,0x01,0x0f,-128,0x47,0x00,0x39,
|
|
|
+ byte addressH = (byte)0x80;
|
|
|
+ byte addressL = (byte)0x47;
|
|
|
+ iicWrite(addressH,addressL,mBufferData,0,186);
|
|
|
+ if (!recallCheck(addressH, addressL,mBufferData,0,185)) {
|
|
|
+ mShow.setText("Recall check error,Send cfg failed");
|
|
|
+ // return false;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ mShow.setText("Recall check success,Send cfg success");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (iChooseVPager == 8) {
|
|
|
+ mCfg80FF.setText(Integer.toHexString(mBufferData[184] & 0xff));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.readcfg: //read cfg
|
|
|
+ bottonMode = 2;
|
|
|
+ mSendData = mSendGetGt9ConfigData;
|
|
|
+
|
|
|
+ addressH = (byte)0x80;
|
|
|
+ addressL = (byte)0x47;
|
|
|
+ iicRead(addressH,addressL,mBytes,186);
|
|
|
+
|
|
|
+ StringBuilder stringBuilder = new StringBuilder("");
|
|
|
+ checksum = 0;
|
|
|
+ for (int i = 0; i < 186; i++) {
|
|
|
+
|
|
|
+ int k = mBytes[i] & 0xFF;
|
|
|
+ checksum =checksum+ k;
|
|
|
+ String hv = Integer.toHexString(k);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ mConfigShow[i] = hv;
|
|
|
+ stringBuilder.append(hv);
|
|
|
+ stringBuilder.append(",");
|
|
|
+ }
|
|
|
+ if(checksum % 256 == 0) //校验和正确
|
|
|
+ {
|
|
|
+ mShow.setText("Cfg Checksum is correct!");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ mShow.setText("Cfg Checksum is error!");
|
|
|
+ }
|
|
|
+
|
|
|
+ ReadCfgSample(mBytes);
|
|
|
+ ReadCfgModuleSwitch(mBytes);
|
|
|
+ ReadCfgNormalSetting(mBytes);
|
|
|
+ ReadCfgChannelSetting(mBytes);
|
|
|
+ ReadCfgPenSetting(mBytes);
|
|
|
+ ReadCfgPlamRestrain(mBytes);
|
|
|
+ ReadCfgKeySetting(mBytes);
|
|
|
+ ReadCfgHoppingSetting(mBytes);
|
|
|
+ ReadCfgRam(mConfigShow);
|
|
|
+
|
|
|
+ addressH = (byte)0x81;
|
|
|
+ addressL = (byte)0x40;
|
|
|
+ iicRead(addressH,addressL,mBytes,32);
|
|
|
+ tvVenderID.setText("VenderID:"+Integer.toString(mBytes[10] & 0xFF));
|
|
|
+
|
|
|
+ break;
|
|
|
+ case R.id.savecfg:
|
|
|
+
|
|
|
+ if (editname.getText().length() == 0){
|
|
|
+ Toast.makeText(this,"请输入文件名及文件格式",Toast.LENGTH_SHORT).show();
|
|
|
+ }else{
|
|
|
+ ActivityCompat.requestPermissions( Config.this, new String[]{android
|
|
|
+ .Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
|
|
|
+
|
|
|
+ //String filePath = Environment.getExternalStorageDirectory() + "/saveconfig/";
|
|
|
+ //String fileName = editname.getText().toString();
|
|
|
+ //writeTxtToFile(editdetail.getText().toString().trim(), filePath, fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPageSelected(int index) {
|
|
|
+
|
|
|
+ Animation animation = null;
|
|
|
+ switch (index) {
|
|
|
+ case 0:
|
|
|
+ /*
|
|
|
+ if (currIndex == 1) {
|
|
|
+ animation = new TranslateAnimation(one, 0, 0, 0);
|
|
|
+ } else if (currIndex == 2) {
|
|
|
+ animation = new TranslateAnimation(two, 0, 0, 0);
|
|
|
+ }
|
|
|
+ */
|
|
|
+ animation = new TranslateAnimation(one * currIndex, 0, 0, 0);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, one, 0, 0);
|
|
|
+ } else {// if (currIndex == 2) {
|
|
|
+ //animation = new TranslateAnimation(two, one, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, one, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, two, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, two, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, three, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, three, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, four, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, four, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, five, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, five, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, six, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, six, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, seven, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, seven, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, eight, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, eight, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ if (currIndex == 0) {
|
|
|
+ animation = new TranslateAnimation(offset, nine, 0, 0);
|
|
|
+ } else {//if (currIndex == 1) {
|
|
|
+ //animation = new TranslateAnimation(one, two, 0, 0);
|
|
|
+ animation = new TranslateAnimation(one * currIndex, nine, 0, 0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ currIndex = index;
|
|
|
+ animation.setFillAfter(true);// true表示图片停在动画结束位置
|
|
|
+ animation.setDuration(300); //设置动画时间为300毫秒
|
|
|
+ img_cursor.startAnimation(animation);//开始动画
|
|
|
+ iChooseVPager = index; //获取当前Vpager的索引,以便知道在哪个pager
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPageScrollStateChanged(int i) {
|
|
|
+ switch (i){
|
|
|
+ case 0:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPageScrolled(int i, float v, int i1) {
|
|
|
+ //edtshow3.setText("333");
|
|
|
+ switch (i){
|
|
|
+ case 0:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private byte iicByteData[]={
|
|
|
+ //0 1 2 3 4 5 6
|
|
|
+ 0x03,0x00,0x0f,0x00,0x00,0x00,0x01,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+
|
|
|
+ };
|
|
|
+ private byte iicWriteData[]={
|
|
|
+ //0 1 2 3 4 5 6
|
|
|
+ 0x03,0x00,0x0f,0x00,0x00,0x00,0x39,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ //发送命令,使得S818可以通过IIC向GT9的固定地址读取任意bytes的数据
|
|
|
+ private boolean iicRead(byte addressHigh,byte addressLow,byte[] wBuffer,int length) {
|
|
|
+
|
|
|
+ int i;
|
|
|
+ iicByteData[1] = 0x00; //read GT9 command
|
|
|
+ iicByteData[2] = 0x0f; //no command
|
|
|
+ iicByteData[3] = addressHigh;
|
|
|
+ iicByteData[4] = addressLow;
|
|
|
+ iicByteData[5] = 0x00;
|
|
|
+ iicByteData[6] = 63; //length 一次接收63个数据
|
|
|
+
|
|
|
+ for (int j = 7; j < 64; j++) {
|
|
|
+ iicWriteData[j] = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ int address1 = ((addressHigh&0xff)<<8);
|
|
|
+ int address2 = addressLow&0xff;
|
|
|
+ int address = address1|address2;
|
|
|
+
|
|
|
+ int sendTimes = length/63 + 1; //预计是向下取整,所以+1
|
|
|
+
|
|
|
+ for (int k = 0; k < sendTimes; k++) {
|
|
|
+ int finalOffset = k*63; //每次只能发57bytes数据
|
|
|
+ int offset = k*64;
|
|
|
+
|
|
|
+ if(length - (finalOffset ) < 63) {
|
|
|
+
|
|
|
+ iicByteData[6] = (byte) (length - (finalOffset)); //length
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ iicByteData[6] = 63;
|
|
|
+ }
|
|
|
+
|
|
|
+ //发送读取命令
|
|
|
+ i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicByteData, 0, 0x40, 100);
|
|
|
+ if (i != 0x40)
|
|
|
+ return false; //传输失败
|
|
|
+ // SystemClock.sleep(1);
|
|
|
+
|
|
|
+ //接收数据
|
|
|
+ i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointIn, wBuffer, offset, 0x40, 3000);
|
|
|
+
|
|
|
+ if (i != 0x40) {
|
|
|
+ editname.setText("iicWrite Failed");
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ address = address + 63;
|
|
|
+ iicByteData[3] = (byte)(address>>8);
|
|
|
+ iicByteData[4] = (byte)address;
|
|
|
+ }
|
|
|
+
|
|
|
+ //将report id从数组中去除
|
|
|
+ //byte[] temperBuffer =new byte[length];
|
|
|
+ if(true) {
|
|
|
+ int count1 = 0;
|
|
|
+ for (int k = 0; k < length; k++) {
|
|
|
+ if (k % 63 == 0) {
|
|
|
+ count1++;
|
|
|
+ }
|
|
|
+
|
|
|
+ wBuffer[k] = wBuffer[k + count1];
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ //发送命令,使得S818可以通过IIC向GT9的固定地址写任意bytes的数据
|
|
|
+ private boolean iicWrite(byte addressHigh,byte addressLow,byte[] wBuffer,int offset,int length) {
|
|
|
+ int i;
|
|
|
+
|
|
|
+ iicWriteData[1] = 0x01; //write GT9 command
|
|
|
+ iicWriteData[2] = 0x0f; //no command
|
|
|
+ iicWriteData[3] = addressHigh;
|
|
|
+ iicWriteData[4] = addressLow;
|
|
|
+ iicWriteData[5] = 0x00;
|
|
|
+ iicWriteData[6] = 0x39; //length
|
|
|
+
|
|
|
+ int address1 = ((addressHigh&0xff)<<8);
|
|
|
+ int address2 = addressLow&0xff;
|
|
|
+ int address = address1|address2;
|
|
|
+
|
|
|
+ int sendTimes = length/57 + 1; //预计是向下取整,所以+1
|
|
|
+
|
|
|
+ for (int k = 0; k < sendTimes; k++) {
|
|
|
+ int finalOffset = offset + k*57; //每次只能发57bytes数据
|
|
|
+
|
|
|
+ if(length - (finalOffset -offset) < 57) {
|
|
|
+
|
|
|
+ iicWriteData[6] = (byte) (length - (finalOffset -offset)); //length
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ iicWriteData[6] = 0x39;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int j = 7; j < 64; j++) {
|
|
|
+ iicWriteData[j] = wBuffer[finalOffset + j -7];
|
|
|
+ }
|
|
|
+ i = mUsbDeviceConnection.bulkTransfer(mUsbEndpointOut, iicWriteData, 0, 0x40, 100);
|
|
|
+
|
|
|
+ if (i != 0x40) {
|
|
|
+ editname.setText("iicWrite Failed");
|
|
|
+ return false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ address = address + 57;
|
|
|
+ iicWriteData[3] = (byte)(address>>8);
|
|
|
+ iicWriteData[4] = (byte)address;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean memCmp(byte[] sBuffer,byte[] dBuffer,int offset,int length) {
|
|
|
+ try {
|
|
|
+
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
+ if (sBuffer[i] != dBuffer[offset + i]) {
|
|
|
+ // FwUpdateMessage(L"Recall frame data fail,not equal.", MSG_ERR);
|
|
|
+ // mError.setText("Recall frame data fail,not equal.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (ArithmeticException e) {
|
|
|
+ mShow.setText("ArithmeticException!");
|
|
|
+ e.printStackTrace();
|
|
|
+ } catch (ArrayIndexOutOfBoundsException e) {
|
|
|
+ mShow.setText("ArrayIndexOutOfBoundsException!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean recallCheck(byte addressHigh,byte addressLow,byte[] wBuffer,int offset,int length)
|
|
|
+ {
|
|
|
+ //BYTE* pbBuf = new BYTE[wLen];
|
|
|
+ byte[] pbBuf =new byte[length+0x3000];
|
|
|
+
|
|
|
+ //if(false)
|
|
|
+ {
|
|
|
+ if (!iicRead(addressHigh, addressLow, pbBuf, length)) {
|
|
|
+ //FwUpdateMessage(L"recall i2c error failed", MSG_ERR);
|
|
|
+ mShow.setText("recall i2c error failed");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!memCmp(pbBuf, wBuffer, offset, length)) {
|
|
|
+
|
|
|
+ // FwUpdateMessage(L"Recall frame data fail,not equal.", MSG_ERR);
|
|
|
+ //mMessage.setText("Recall frame data fail,not equal.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+
|
|
|
+ if (mUsbDeviceConnection != null) {
|
|
|
+ mUsbDeviceConnection.releaseInterface(mUsbInterface);
|
|
|
+ mUsbDeviceConnection.close();
|
|
|
+ mUsbDeviceConnection = null;
|
|
|
+ }
|
|
|
+ mUsbEndpointIn = null;
|
|
|
+ mUsbEndpointOut = null;
|
|
|
+ isNeedFindDevice = false;
|
|
|
+ mThreadPool.shutdownNow();
|
|
|
+ // unregisterReceiver(mUsbDetachedReceiver);
|
|
|
+ unregisterReceiver(cfgOpenDevicesReceiver);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
|
+ switch (requestCode) {
|
|
|
+ case 1:
|
|
|
+ String filePath;// = Environment.getExternalStorageDirectory() + "/saveconfig/";
|
|
|
+ String fileName;
|
|
|
+ if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
|
+ //创建文件夹
|
|
|
+ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
|
+
|
|
|
+ StringBuilder configBuilder = new StringBuilder("");
|
|
|
+
|
|
|
+ if (iChooseVPager == 8){ //在ram cfg界面
|
|
|
+ configBuilder.append("0x"+mCfg8047.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8048.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8049.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg804F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg8050.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8051.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8052.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8053.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8054.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8055.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8056.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8057.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8058.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8059.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg805F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg8060.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8061.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8062.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8063.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8064.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8065.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8066.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8067.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8068.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8069.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg806F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg8070.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8071.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8072.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8073.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8074.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8075.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8076.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8077.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8078.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8079.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg807F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg8080.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8081.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8082.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8083.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8084.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8085.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8086.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8087.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8088.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8089.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg808F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg8090.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8091.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8092.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8093.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8094.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8095.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8096.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8097.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8098.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg8099.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809A.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809B.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809C.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809D.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809E.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg809F.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80A0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80A9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AD.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80AF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80B0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80B9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BD.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80BF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80C0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80C9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CD.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80CF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80D0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80D9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DD.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80DF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80E0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80E9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80EA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80EB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80EC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80ED.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80EE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80EF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x"+mCfg80F0.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F1.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F2.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F3.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F4.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F5.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F6.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F7.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F8.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80F9.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FA.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FB.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FC.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FD.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FE.getText().toString()+",");
|
|
|
+ configBuilder.append("0x"+mCfg80FF.getText().toString()+",");
|
|
|
+
|
|
|
+ configBuilder.append("0x01");
|
|
|
+
|
|
|
+ }else{ //在其他界面则保存
|
|
|
+ CombineCfg();
|
|
|
+ for (int i = 0; i < 185; i++){
|
|
|
+ String hv = Integer.toHexString(mBytes[i] & 0xFF);
|
|
|
+ if (hv.length() < 2){
|
|
|
+ hv = "0" + hv;
|
|
|
+ }
|
|
|
+ configBuilder.append("0x" + hv + ",");
|
|
|
+ }
|
|
|
+
|
|
|
+ configBuilder.append("0x01"); //mBytes[185],最后置上1
|
|
|
+ }
|
|
|
+
|
|
|
+ filePath = Environment.getExternalStorageDirectory() + "/saveconfig/";
|
|
|
+ //File file = new File(filePath);
|
|
|
+ fileName = editname.getText().toString();
|
|
|
+ writeTxtToFile(configBuilder.toString().trim(), filePath, fileName);
|
|
|
+
|
|
|
+ mShow.setText(fileName + " 保存到:"+ filePath.toString());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
|
|
+ //创建文件夹
|
|
|
+ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 将字符串写入到文本文件中
|
|
|
+ public void writeTxtToFile(String strcontent, String filePath, String fileName) {
|
|
|
+ // 生成文件夹之后,再生成文件,不然会出错
|
|
|
+ makeFilePath(filePath, fileName);
|
|
|
+
|
|
|
+ String strFilePath = filePath + fileName;
|
|
|
+ // 每次写入时,都换行写
|
|
|
+ String strContent = strcontent + "\r\n";
|
|
|
+ try {
|
|
|
+ File file = new File(strFilePath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ Log.d("TestFile", "Create the file:" + strFilePath);
|
|
|
+ file.getParentFile().mkdirs();
|
|
|
+ file.createNewFile();
|
|
|
+ }
|
|
|
+ RandomAccessFile raf = new RandomAccessFile(file, "rwd");
|
|
|
+ raf.seek(file.length());
|
|
|
+ raf.write(strContent.getBytes());
|
|
|
+ raf.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成文件
|
|
|
+ public File makeFilePath(String filePath, String fileName) {
|
|
|
+ File file = null;
|
|
|
+ makeRootDirectory(filePath);
|
|
|
+ try {
|
|
|
+ file = new File(filePath + fileName);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.createNewFile();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return file;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 生成文件夹
|
|
|
+ public static void makeRootDirectory(String filePath) {
|
|
|
+ File file = null;
|
|
|
+ try {
|
|
|
+ file = new File(filePath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdir();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|