Эх сурвалжийг харах

1.一个简单的检测手柄app

slambb 3 жил өмнө
parent
commit
e44ce1b7e0

+ 6 - 0
.idea/compiler.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <bytecodeTargetLevel target="1.8" />
+  </component>
+</project>

+ 40 - 0
.idea/jarRepositories.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="BintrayJCenter" />
+      <option name="name" value="BintrayJCenter" />
+      <option name="url" value="https://jcenter.bintray.com/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="Google" />
+      <option name="name" value="Google" />
+      <option name="url" value="https://dl.google.com/dl/android/maven2/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="D:\android-sdk-windows\android-sdk-windows\extras\android\m2repository" />
+      <option name="name" value="D:\android-sdk-windows\android-sdk-windows\extras\android\m2repository" />
+      <option name="url" value="file:/D:/android-sdk-windows/android-sdk-windows/extras/android/m2repository/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="D:\android-sdk-windows\android-sdk-windows\extras\google\m2repository" />
+      <option name="name" value="D:\android-sdk-windows\android-sdk-windows\extras\google\m2repository" />
+      <option name="url" value="file:/D:/android-sdk-windows/android-sdk-windows/extras/google/m2repository/" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="D:\android-sdk-windows\android-sdk-windows\extras\m2repository" />
+      <option name="name" value="D:\android-sdk-windows\android-sdk-windows\extras\m2repository" />
+      <option name="url" value="file:/D:/android-sdk-windows/android-sdk-windows/extras/m2repository/" />
+    </remote-repository>
+  </component>
+</project>

+ 3 - 3
.idea/modules.xml

@@ -2,9 +2,9 @@
 <project version="4">
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file://$PROJECT_DIR$/android-bboxble.iml" filepath="$PROJECT_DIR$/android-bboxble.iml" />
-      <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
-      <module fileurl="file://$PROJECT_DIR$/bboxblelib/bboxblelib.iml" filepath="$PROJECT_DIR$/bboxblelib/bboxblelib.iml" />
+      <module fileurl="file://$PROJECT_DIR$/.idea/modules/android-bboxble.iml" filepath="$PROJECT_DIR$/.idea/modules/android-bboxble.iml" />
+      <module fileurl="file://$PROJECT_DIR$/.idea/modules/app/android-bboxble.app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/android-bboxble.app.iml" />
+      <module fileurl="file://$PROJECT_DIR$/.idea/modules/bboxblelib/android-bboxble.bboxblelib.iml" filepath="$PROJECT_DIR$/.idea/modules/bboxblelib/android-bboxble.bboxblelib.iml" />
     </modules>
   </component>
 </project>

+ 0 - 12
.idea/runConfigurations.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="RunConfigurationProducerService">
-    <option name="ignoredProducers">
-      <set>
-        <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
-        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
-        <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
-      </set>
-    </option>
-  </component>
-</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 8 - 3
app/build.gradle

@@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
 android {
     compileSdkVersion 26
     defaultConfig {
-        applicationId "com.slam.bboxble"
+        applicationId "com.slam.bboxbleNext3"
         minSdkVersion 19
         targetSdkVersion 26
-        versionCode 1
-        versionName "1.0"
+        versionCode 3
+        versionName "3.0"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
@@ -16,6 +16,10 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
 }
 
 
@@ -28,4 +32,5 @@ dependencies {
     androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
     implementation 'org.greenrobot:eventbus:3.0.0'
     implementation project(':bboxblelib')
+
 }

+ 579 - 16
app/src/main/java/com/slam/bboxble/TestActivity.java

@@ -7,21 +7,25 @@ import android.os.Bundle;
 import android.support.v4.app.ActivityCompat;
 import android.text.method.ScrollingMovementMethod;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.View;
 import android.widget.Button;
+import android.widget.CompoundButton;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import com.slam.bboxblelib.Conversion;
 import com.slam.bboxblelib.DataEvent;
 import com.slam.bboxblelib.DeviceEvent;
 import com.slam.bboxblelib.MainBluetooth;
 import com.slam.bboxblelib.Responser;
-import com.slam.bboxblelib.WriteEvent;
-import com.slam.bboxblelib.WriteResponser;
 import com.slam.bboxblelib.impl.MainBluetoothImpl;
 
-import java.util.HashMap;
-import java.util.Map;
+import android.widget.CheckBox;
+import android.widget.ImageButton;
+import android.widget.ImageView;
+import android.widget.Toast;
+
 
 public class TestActivity extends Activity implements View.OnClickListener {
 
@@ -33,11 +37,95 @@ public class TestActivity extends Activity implements View.OnClickListener {
     private Button mButtonSend2;
     private Button mButtonSend3;
     private Button mButtonConnect;
+    private Button mButtonConnect2;
     private Button mButtonDisconnect;
+    private Button mButtonDisconnect3;
+    private Button mButtonDisconnect2;
     private Button mButtonUpdate;
 
     private TextView textView;
 
+    private Button mButtonNext1;
+    private Button mButtonNext2;
+
+    /**
+     *检测按钮部分
+     */
+    private CheckBox mCheckBoxX;
+    private CheckBox mCheckBoxY;
+    private CheckBox mCheckBoxZ;
+
+    private Button mButtonX;
+    private Button mButtonX1;
+
+    private Button mButtonY;
+    private Button mButtonY1;
+    private Button mButtonZ;
+    private TextView mTextView2;
+
+
+    private double ax = 1;
+    private double ay = 1;
+    private double az = 1;
+    private double gx = 0;
+    private double gy = 0;
+    private double gz = 0;
+
+    //用于判断加速计的轴向
+    private double consult_ax = 1;
+    private double consult_ay = 1;
+    private double consult_az = -1;
+
+    private double ax_max = 0;
+    private double ay_max = 0;
+    private double az_max = 0;
+    private double allMax = 0;
+
+
+    private Button mButtonGY3;
+    private CheckBox mCheckBoxGY;
+    private boolean mFinishCheck = false;
+    private double gx_max = 0;
+    private double gy_max = 0;
+    private double gz_max = 0;
+    private TextView mTextViewTitle;
+
+    private ImageButton mImageButtonX;
+    private ImageButton mImageButtonY;
+    private ImageButton mImageButtonZ;
+    private ImageView mImageViewX;
+    private ImageView mImageViewY;
+    private ImageView mImageViewZ;
+
+    private RelativeLayout page_1;
+    private RelativeLayout page_2;
+    private RelativeLayout page_3;
+    private ImageView mImageViewPage_1;
+    private ImageView mImageViewPage_2;
+
+    private Toast toastCenter;
+
+    //类型变量
+    private static final int TestAccX = 11;
+    private static final int TestAccY = 12;
+    private static final int TestAccZ = 13;
+    private static final int TestGyroX = 21;
+    private static final int TestGyroY = 22;
+    private static final int TestGyroZ = 23;
+    //当前测试的场景
+    private int currentTest = 0;
+
+    //开始进入页面的时候,选择检测对应轴对应的按钮
+    private CheckBox mCheckBoxAccX;
+    private CheckBox mCheckBoxAccY;
+    private CheckBox mCheckBoxAccZ;
+    private CheckBox mCheckBoxGyroX;
+    private CheckBox mCheckBoxGyroY;
+    private CheckBox mCheckBoxGyroZ;
+    //进入第一个页面
+    private Button mButtonEnter;
+    private LinearLayout mSettingLayout;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -63,6 +151,17 @@ public class TestActivity extends Activity implements View.OnClickListener {
 
         mButtonConnect = this.findViewById(R.id.button_connect);
         mButtonSend1 = this.findViewById(R.id.button_send1);
+
+        mButtonConnect2 = this.findViewById(R.id.button_connect_1);
+        mButtonConnect2.setOnClickListener(this);
+
+
+        mButtonDisconnect2 = this.findViewById(R.id.button_dis_connect_2);
+        mButtonDisconnect2.setOnClickListener(this);
+        mButtonDisconnect3= this.findViewById(R.id.button_dis_connect_3);
+        mButtonDisconnect3.setOnClickListener(this);
+
+
         mButtonConnect.setOnClickListener(this);
         mButtonSend1.setOnClickListener(this);
 
@@ -88,9 +187,19 @@ public class TestActivity extends Activity implements View.OnClickListener {
                     Log.i(TAG, deviceEvent.getDeviceName());
 
                     String _tip = textView.getText().toString();
-                    _tip += "设备,address:" + deviceEvent.getDeviceAddress() + ",deviceName:" + deviceEvent.getDeviceName() + "\n";
+                    _tip += "设备mac-->:" + deviceEvent.getDeviceAddress() + "\n设备名称-->:" + deviceEvent.getDeviceName() + "\n";
                     textView.setText(_tip);
+
+
                 }
+
+                if(code == 20002){
+                    onWriteValue("3");
+
+                    mButtonX1.setVisibility(View.VISIBLE);
+                    mButtonConnect2.setVisibility(View.GONE);
+                }
+
                 //todo 返回成功对象信息
                 //约定处理信息 onSuccess
                 // {
@@ -121,20 +230,95 @@ public class TestActivity extends Activity implements View.OnClickListener {
 
 //                    Log.i(TAG, "type  =" + dataEvent.getDataType());
                     String hand = dataEvent.getHand();
-                    double ax = dataEvent.getAcc().get("ax");
-                    double ay = dataEvent.getAcc().get("ay");
-                    double az = dataEvent.getAcc().get("az");
-                    double gx = dataEvent.getGyro().get("gx");
-                    double gy = dataEvent.getGyro().get("gy");
-                    double gz = dataEvent.getGyro().get("gz");
+                    ax = dataEvent.getAcc().get("ax");
+                    ay = dataEvent.getAcc().get("ay");
+                    az = dataEvent.getAcc().get("az");
+                    gx = dataEvent.getGyro().get("gx");
+                    gy = dataEvent.getGyro().get("gy");
+                    gz = dataEvent.getGyro().get("gz");
                     Integer min = dataEvent.getMin();
                     Integer s = dataEvent.getS();
                     Integer ms = dataEvent.getMs();
 
-                    textView.setText("hand =" + hand + "\n" +
-                            "acc   = " + String.format("%.2f", ax) + " = " + String.format("%.2f", ay) + " = " + String.format("%.2f", az) +
-                            "\n gyro  = " + String.format("%.2f", gx) + " = " + String.format("%.2f", gy) + " = " + String.format("%.2f", gz) +
-                            "\n min = " + min + " s= " + s + " ms= " + ms);
+                    if(Math.abs(ax)>ax_max)
+                        ax_max = Math.abs(ax);
+                    if(Math.abs(ay)>ay_max)
+                        ay_max = Math.abs(ay);
+                    if(Math.abs(az)>az_max)
+                        az_max = Math.abs(az);
+
+                    allMax =Math.sqrt(ax_max*ax_max +  ay_max*ay_max + az_max*az_max);
+
+                    if(currentTest == TestGyroX && Math.abs(gx)>100){
+                        //右旋转为负数,左旋转为正数
+                        if(gx>0){
+                            mCheckBoxX.setChecked(true);
+                        }else{
+                            mCheckBoxX.setChecked(false);
+                        }
+                        gx_max += gx;
+                        if(gx_max>200){
+                            if(!mFinishCheck && gx_max >20000)
+                            {
+                                mTextViewTitle.setVisibility(View.GONE);
+                                if(mCheckBoxGyroY.isChecked() || mCheckBoxGyroZ.isChecked()){
+                                    mButtonNext1.setVisibility(View.VISIBLE);
+                                }else{
+                                    mButtonGY3.setVisibility(View.VISIBLE);
+                                }
+                                mFinishCheck = true;
+                            }
+                            mCheckBoxX.setText("逆时针旋转值会持续变大:"+ String.format("%.2f", gx_max));
+                        }
+                    }else if(currentTest == TestGyroY && Math.abs(gy)>100){
+                        //右旋转为正数,左旋转为负数
+                        if(gy>0){
+                            mCheckBoxX.setChecked(true);
+                        }else{
+                            mCheckBoxX.setChecked(false);
+                        }
+                        gy_max += gy;
+                        if(gy_max>200){
+                            if(!mFinishCheck && gy_max >20000)
+                            {
+                                mTextViewTitle.setVisibility(View.GONE);
+                                if(mCheckBoxGyroZ.isChecked()){
+                                    mButtonNext1.setVisibility(View.VISIBLE);
+                                }else{
+                                    mButtonGY3.setVisibility(View.VISIBLE);
+                                }
+                                mFinishCheck = true;
+                            }
+                            mCheckBoxX.setText("逆时针旋转值会持续变大:"+ String.format("%.2f", gy_max));
+                        }
+                    }else if(currentTest == TestGyroZ && Math.abs(gz)>100){
+                        //右旋转为正数,左旋转为负数
+                        if(gz>0){
+                            mCheckBoxX.setChecked(true);
+                        }else{
+                            mCheckBoxX.setChecked(false);
+                        }
+                        gz_max += gz;
+                        if(gz_max>200){
+                            if(!mFinishCheck && gz_max >20000)
+                            {
+                                mTextViewTitle.setVisibility(View.GONE);
+                                mButtonGY3.setVisibility(View.VISIBLE);
+                                mFinishCheck = true;
+                            }
+                            mCheckBoxX.setText("顺时针旋转值会持续变大:"+ String.format("%.2f", gz_max));
+                        }
+                    }
+                    //  "hand =" + hand + "\n" +
+                    textView.setText("六轴实时数据值:\n"+
+                                    "加速计acc   X= " + String.format("%.2f", ax) + " Y= " + String.format("%.2f", ay) + " Z= " + String.format("%.2f", az) +
+                                    "\n陀螺仪gyro  X= " + String.format("%.2f", gx) + " Y= " + String.format("%.2f", gy) + " Z= " + String.format("%.2f", gz) +
+                                    "\n运行时间min = " + min + " s= " + s + " ms= " + ms + "\n"+
+                                    "\n最大的量程加速度:"+
+                                    "\nx最大值 = " + String.format("%.2f", ax_max)  + " y最大值= " + String.format("%.2f", ay_max)  + " z最大值= " + String.format("%.2f", az_max)   +
+                                    "\n三个轴最大和加速度 = " + String.format("%.2f", allMax) );
+
+
 
                     //todo 此处回调硬件解析的信息
                     //约定处理信息 onUpdateData
@@ -164,6 +348,125 @@ public class TestActivity extends Activity implements View.OnClickListener {
         };
         //todo 1.注册一下事件
         mainBluetooth.onRegisterEvent(this, responser);
+
+        /**
+         * 检测按钮部分
+         */
+        //通过id找到按钮
+        mCheckBoxX = (CheckBox) findViewById(R.id.checkBoxX);
+        mCheckBoxY = (CheckBox) findViewById(R.id.checkBoxY);
+        mCheckBoxZ = (CheckBox) findViewById(R.id.checkBoxZ);
+        mButtonX = this.findViewById(R.id.buttonX);
+        mButtonX.setOnClickListener(this);
+        mButtonX1 = this.findViewById(R.id.buttonX_1);
+        mButtonX1.setOnClickListener(this);
+
+        mButtonY = this.findViewById(R.id.buttonY);
+        mButtonY.setOnClickListener(this);
+        mButtonY1 = this.findViewById(R.id.buttonY_1);
+        mButtonY1.setOnClickListener(this);
+        mTextView2 = this.findViewById(R.id.textView_2);
+
+        mButtonZ = this.findViewById(R.id.buttonZ);
+        mButtonZ.setOnClickListener(this);
+        //旋转部分
+        mCheckBoxGY = (CheckBox) findViewById(R.id.checkBoxGY);
+        mCheckBoxGY.setText("逆时针旋转值会持续变大:"+ 0);
+
+        mButtonGY3 = this.findViewById(R.id.buttonX_3);
+        mButtonGY3.setOnClickListener(this);
+
+        mImageButtonX = this.findViewById(R.id.imageButtonX);
+        mImageButtonX.setOnClickListener(this);
+        mImageButtonY = this.findViewById(R.id.imageButtonY);
+        mImageButtonY.setOnClickListener(this);
+        mImageButtonZ = this.findViewById(R.id.imageButtonZ);
+        mImageButtonZ.setOnClickListener(this);
+        mImageViewX = this.findViewById(R.id.imageViewX);
+        mImageViewX.setOnClickListener(this);
+        mImageViewY = this.findViewById(R.id.imageViewY);
+        mImageViewY.setOnClickListener(this);
+        mImageViewZ = this.findViewById(R.id.imageViewZ);
+        mImageViewZ.setOnClickListener(this);
+
+        page_1 = this.findViewById(R.id.page_1);
+        page_2 = this.findViewById(R.id.page_2);
+        page_3 = this.findViewById(R.id.page_3);
+
+        mImageViewPage_1 = this.findViewById(R.id.imageViewX_1);
+        mImageViewPage_2 = this.findViewById(R.id.imageViewX_2);
+
+        toastCenter = Toast.makeText(getApplicationContext(),"正在连接中",Toast.LENGTH_LONG);
+        //setGravity决定Toast显示位置
+        toastCenter.setGravity(Gravity.CENTER,0,0);
+
+
+        mButtonNext1 = this.findViewById(R.id.button_next_1);
+        mButtonNext1.setOnClickListener(this);
+        mButtonNext2 = this.findViewById(R.id.button_next_2);
+        mButtonNext2.setOnClickListener(this);
+
+        //首页选择
+        mCheckBoxAccX = this.findViewById(R.id.checkBoxAccX);
+        mCheckBoxAccY = this.findViewById(R.id.checkBoxAccY);
+        mCheckBoxAccZ = this.findViewById(R.id.checkBoxAccZ);
+        mCheckBoxGyroX = this.findViewById(R.id.checkBoxGyroX);
+        mCheckBoxGyroY = this.findViewById(R.id.checkBoxGyroY);
+        mCheckBoxGyroZ = this.findViewById(R.id.checkBoxGyroZ);
+
+        //lambda 表达式
+        mCheckBoxAccX.setOnCheckedChangeListener((buttonView,isChecked)->{
+            // TODO Auto-generated method stub
+            if(isChecked){
+                Log.i(TAG, "mCheckBoxAccX"+isChecked);
+            }else{
+                Log.i(TAG, "mCheckBoxAccX"+isChecked);
+            }
+        });
+        mCheckBoxAccY.setOnCheckedChangeListener((buttonView,isChecked)->{
+            if(isChecked){
+
+            }else{
+            }
+        });
+        mCheckBoxAccZ.setOnCheckedChangeListener((buttonView,isChecked)->{
+            if(isChecked){
+
+            }else{
+            }
+        });
+        mCheckBoxGyroX.setOnCheckedChangeListener((buttonView,isChecked)->{
+            if(isChecked){
+
+            }else{
+            }
+        });
+        mCheckBoxGyroY.setOnCheckedChangeListener((buttonView,isChecked)->{
+            if(isChecked){
+
+            }else{
+            }
+        });
+        mCheckBoxGyroZ.setOnCheckedChangeListener((buttonView,isChecked)->{
+            if(isChecked){
+
+            }else{
+            }
+        });
+
+        /**
+         * 默认设置的3个轴,x,y 。和陀螺仪y
+         */
+        mCheckBoxAccX.setChecked(true);
+        mCheckBoxAccZ.setChecked(true);
+        mCheckBoxGyroX.setChecked(true);
+
+        mButtonEnter = this.findViewById(R.id.button_enter);
+        mButtonEnter.setOnClickListener(this);
+        mSettingLayout = this.findViewById(R.id.SettingLayout);
+
+        mTextViewTitle = this.findViewById(R.id.textView_title);
+
     }
 
     @Override
@@ -176,8 +479,25 @@ public class TestActivity extends Activity implements View.OnClickListener {
     @Override
     public void onClick(View view) {
         switch (view.getId()) {
+            case R.id.button_enter:
+                //判断有什么检测就进什么页面,如果没有给出提示
+                if(  mCheckBoxAccX.isChecked() ||  mCheckBoxAccY.isChecked() || mCheckBoxAccZ.isChecked() ||
+                        mCheckBoxGyroX.isChecked() || mCheckBoxGyroY.isChecked() || mCheckBoxGyroZ.isChecked()){
+                    //设置page_1页面现在检测什么轴 文案
+                    resetTestState();
+                    //隐藏选择页面,现在Acc检测页面类型
+                    mSettingLayout.setVisibility(View.GONE);
+                    page_1.setVisibility(View.VISIBLE);
+                }else {
+                    toastCenter.setText("请选择一个测试轴");
+                    toastCenter.show();
+                }
+                break;
             case R.id.button_connect:
+            case R.id.button_connect_1:
                 onConnect("BGBox");
+                toastCenter.setText("正在连接中");
+                toastCenter.show();
                 break;
             case R.id.button_send1:
                 onWriteValue("V");
@@ -195,9 +515,161 @@ public class TestActivity extends Activity implements View.OnClickListener {
                 break;
 
             case R.id.button_dis_connect:
+            case R.id.button_dis_connect_2:
+            case R.id.button_dis_connect_3:
+            case R.id.buttonX_3:
                 onDisconnect();
                 break;
+            case R.id.buttonX:
+            case R.id.buttonX_1:
+                //检测的时候,按照类型来
+                double _temp = 1d;
+                String _strSuccess = "" , _strFail = "";
+                if(currentTest ==  TestAccX){
+                   _temp = Math.abs(ax - consult_ax);
+                   _strSuccess = "检测X正确,值为:"+String.format("%.2f", ax);
+                   _strFail = "检测X不正确,值为:"+String.format("%.2f", ax);
+                }else if(currentTest == TestAccY){
+                    _temp = Math.abs(ay - consult_ay);
+                    _strSuccess = "检测Y正确,值为:"+String.format("%.2f", ay);
+                    _strFail = "检测Y不正确,值为:"+String.format("%.2f", ay);
+                }else if(currentTest == TestAccZ){
+                    _temp = Math.abs(az - consult_az);
+                    _strSuccess = "检测Z正确,值为:"+String.format("%.2f", az);
+                    _strFail = "检测Z不正确,值为:"+String.format("%.2f", az);
+                }
+                if(_temp <0.2f){
+                    mCheckBoxX.setChecked(true);
+                    mCheckBoxX.setText(_strSuccess);
+                    toastCenter.setText("检测成功");
+                    toastCenter.show();
+
+                    mButtonNext1.setVisibility(View.VISIBLE);
+                    mButtonX1.setVisibility(View.GONE);
+
+                }else{
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText(_strFail);
+                }
 
+                break;
+            case R.id.button_next_1:
+                //点击下一步时候,切换检测坐标
+                if(mCheckBoxAccX.isChecked() && currentTest < TestAccX){
+                    mButtonNext1.setVisibility(View.GONE);
+                    mButtonX1.setVisibility(View.VISIBLE);
+                    currentTest = TestAccX;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("检测X方向,方向键向上垂直桌面");
+                    mImageViewPage_1.setImageResource(R.drawable.x);
+
+                }else if(mCheckBoxAccY.isChecked() && currentTest < TestAccY){
+                    mButtonNext1.setVisibility(View.GONE);
+                    mButtonX1.setVisibility(View.VISIBLE);
+                    currentTest = TestAccY;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("检测Y方向,L,R向上垂直桌面");
+                    mImageViewPage_1.setImageResource(R.drawable.y);
+
+                }else if(mCheckBoxAccZ.isChecked() && currentTest < TestAccZ){
+                    mButtonNext1.setVisibility(View.GONE);
+                    mButtonX1.setVisibility(View.VISIBLE);
+                    currentTest = TestAccZ;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("检测Z方向,AB键向上放置桌面");
+                    mImageViewPage_1.setImageResource(R.drawable.z);
+                }
+                //选择时候,不用显示检测按钮,直接根据旋转判断是否进行下一步
+                else if(mCheckBoxGyroX.isChecked() && currentTest < TestGyroX){
+                    currentTest = TestGyroX;
+                    mButtonNext1.setVisibility(View.GONE);
+                    mTextViewTitle.setVisibility(View.VISIBLE);
+                    mTextViewTitle.setText("检测陀螺仪X轴,直到超过20000");
+                    mFinishCheck = false;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("方向键向上垂直桌面,逆时针旋转增大!");
+                    mImageViewPage_1.setImageResource(R.drawable.x);
+                }else if(mCheckBoxGyroY.isChecked() && currentTest < TestGyroY){
+                    currentTest = TestGyroY;
+                    mButtonNext1.setVisibility(View.GONE);
+                    mTextViewTitle.setVisibility(View.VISIBLE);
+                    mTextViewTitle.setText("检测陀螺仪Y轴,直到超过20000");
+                    mFinishCheck = false;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("L,R向上垂直桌面,逆时针旋转增大!");
+                    mImageViewPage_1.setImageResource(R.drawable.y);
+                }else if(mCheckBoxGyroZ.isChecked() && currentTest < TestGyroZ){
+                    currentTest = TestGyroZ;
+                    mButtonNext1.setVisibility(View.GONE);
+                    mTextViewTitle.setVisibility(View.VISIBLE);
+                    mTextViewTitle.setText("检测陀螺仪Z轴,直到超过20000");
+                    mFinishCheck = false;
+                    mCheckBoxX.setChecked(false);
+                    mCheckBoxX.setText("AB键向上放置桌面,顺时针旋转增大!");
+                    mImageViewPage_1.setImageResource(R.drawable.z);
+                }
+
+                //进行下一步
+                //隐藏当前页面
+//                page_1.setVisibility(View.INVISIBLE);
+//                page_2.setVisibility(View.VISIBLE);
+                break;
+            case R.id.button_next_2:
+                //进行下一步
+                //隐藏当前页面
+                page_2.setVisibility(View.INVISIBLE);
+                page_3.setVisibility(View.VISIBLE);
+                break;
+            case R.id.buttonY:
+            case R.id.buttonY_1:
+                if(Math.abs(ay - consult_ay) <0.2f){
+                    mCheckBoxY.setChecked(true);
+                    mCheckBoxY.setText("检测Y正确,值为:"+String.format("%.2f", ay));
+                    mTextView2.setText("检测Y正确,值为:"+String.format("%.2f", ay));
+
+                    toastCenter.setText("检测Y成功");
+                    toastCenter.show();
+
+                    mButtonDisconnect2.setVisibility(View.GONE);
+                    mButtonY1.setVisibility(View.GONE);
+                    mButtonNext2.setVisibility(View.VISIBLE);
+
+                }else{
+                    mCheckBoxY.setChecked(false);
+                    mCheckBoxY.setText("检测Y不正确,值为:"+String.format("%.2f", ay));
+                    mTextView2.setText("检测Y不正确,值为:"+String.format("%.2f", ay));
+                }
+
+
+                break;
+
+            case R.id.buttonZ:
+                if(az - consult_az <0.2f){
+                    mCheckBoxZ.setChecked(true);
+                    mCheckBoxZ.setText("检测Z正确,值为:"+String.format("%.2f", az));
+                }else{
+                    mCheckBoxZ.setChecked(false);
+                    mCheckBoxZ.setText("检测Z不正确,值为:"+String.format("%.2f", az));
+                }
+                break;
+            case R.id.imageButtonX:
+                mImageViewX.setVisibility(mImageViewX.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
+            case R.id.imageButtonY:
+                mImageViewY.setVisibility(mImageViewY.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
+            case R.id.imageButtonZ:
+                mImageViewZ.setVisibility(mImageViewZ.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
+            case R.id.imageViewX:
+                mImageViewX.setVisibility(mImageViewX.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
+            case R.id.imageViewY:
+                mImageViewY.setVisibility(mImageViewY.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
+            case R.id.imageViewZ:
+                mImageViewZ.setVisibility(mImageViewZ.getVisibility() == View.INVISIBLE? View.VISIBLE:View.INVISIBLE);
+                break;
             default:
                 break;
         }
@@ -227,7 +699,98 @@ public class TestActivity extends Activity implements View.OnClickListener {
      * 断开连接
      */
     public void onDisconnect() {
+        //重置对应的数据
+        ax = 1;
+        ay = 1;
+        az = 1;
+        gx = 0;
+        gy = 0;
+        gz = 0;
+
+        ax_max = 0;
+        ay_max = 0;
+        az_max = 0;
+        allMax = 0;
+
+
+        gx_max = 0;
+        gy_max = 0;
+        gz_max = 0;
+
+        //返回第一页
+        page_1.setVisibility(View.VISIBLE);
+        page_2.setVisibility(View.INVISIBLE);
+        page_3.setVisibility(View.INVISIBLE);
+
+        //首页按钮
+        mButtonX1.setVisibility(View.GONE);
+        mButtonConnect2.setVisibility(View.VISIBLE);
+
+        mCheckBoxX.setChecked(false);
+        mCheckBoxX.setText("检测x方向,方向键向上");
+        mCheckBoxY.setChecked(false);
+        mCheckBoxY.setText("检测Y方向,L,R键向上");
+        mCheckBoxGY.setChecked(false);
+
+        mFinishCheck = false;
+
+        textView.setText("");
         mainBluetooth.disConnectLeDevice();
+
+
+        mButtonConnect.setVisibility(View.VISIBLE);
+        mButtonNext1.setVisibility(View.GONE);
+
+        mButtonDisconnect2.setVisibility(View.VISIBLE);
+        mButtonY1.setVisibility(View.VISIBLE);
+        mButtonNext2.setVisibility(View.GONE);
+
+        mButtonDisconnect3.setVisibility(View.VISIBLE);
+        mButtonGY3.setVisibility(View.GONE);
+        mCheckBoxGY.setText("逆时针旋转值会持续变大:"+ 0);
+
+
+        resetTestState();
+    }
+
+    public  void resetTestState(){
+        if(mCheckBoxAccX.isChecked()){
+            currentTest = TestAccX;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测X方向,方向键向上垂直桌面");
+            mImageViewPage_1.setImageResource(R.drawable.x);
+
+        }else if(mCheckBoxAccY.isChecked()){
+            currentTest = TestAccY;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测Y方向,L,R向上垂直桌面");
+            mImageViewPage_1.setImageResource(R.drawable.y);
+
+        }else if(mCheckBoxAccZ.isChecked()){
+            currentTest = TestAccZ;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测Z方向,AB键向上放置桌面");
+            mImageViewPage_1.setImageResource(R.drawable.z);
+
+        }else if(mCheckBoxGyroX.isChecked()){
+            currentTest = TestGyroX;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测X方向,方向键向上垂直桌面");
+            mImageViewPage_1.setImageResource(R.drawable.x);
+        }else if(mCheckBoxGyroY.isChecked()){
+            currentTest = TestGyroY;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测Y方向,L,R向上垂直桌面");
+            mImageViewPage_1.setImageResource(R.drawable.y);
+        }else if(mCheckBoxGyroZ.isChecked()){
+            currentTest = TestGyroZ;
+            mCheckBoxX.setChecked(false);
+            mCheckBoxX.setText("检测Z方向,AB键向上放置桌面");
+            mImageViewPage_1.setImageResource(R.drawable.z);
+        }
     }
 
+
+
 }
+

BIN
app/src/main/res/drawable/x.jpg


BIN
app/src/main/res/drawable/y.jpg


BIN
app/src/main/res/drawable/z.jpg


+ 497 - 41
app/src/main/res/layout/activity_test.xml

@@ -6,85 +6,541 @@
     android:layout_height="match_parent"
     tools:context="com.slam.bboxble.TestActivity">
 
-    <Button
-        android:id="@+id/button_dis_connect"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="32dp"
-        android:text="断开连接"
-        app:layout_constraintEnd_toStartOf="@+id/button_send1"
-        app:layout_constraintStart_toEndOf="@+id/button_connect"
-        app:layout_constraintTop_toTopOf="parent" />
-
     <Button
         android:id="@+id/button_send1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginEnd="28dp"
-        android:layout_marginTop="32dp"
+        android:layout_marginTop="16dp"
         android:text="发送数据v"
+        android:visibility="gone"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintHorizontal_bias="0.319"
+        app:layout_constraintStart_toEndOf="@+id/button_update"
+        app:layout_constraintTop_toBottomOf="@+id/button_send2" />
 
     <Button
         android:id="@+id/button_send2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginTop="112dp"
-        android:text="发送数据3"
-        app:layout_constraintTop_toTopOf="parent"
-        tools:layout_editor_absoluteX="10dp" />
+        android:layout_marginBottom="731dp"
+        android:layout_marginEnd="411dp"
+        android:layout_marginTop="731dp"
+        android:text="发送3"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
 
     <Button
         android:id="@+id/button_send3"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginEnd="16dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="112dp"
-        android:text="发送数据4"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.028"
+        android:layout_marginStart="2dp"
+        android:layout_marginTop="16dp"
+        android:text="发送4"
+        android:visibility="gone"
         app:layout_constraintStart_toEndOf="@+id/button_send2"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent"
+        tools:visibility="gone" />
 
     <Button
         android:id="@+id/button_update"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginBottom="731dp"
         android:layout_marginEnd="16dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="112dp"
+        android:layout_marginStart="411dp"
+        android:layout_marginTop="731dp"
         android:text="发送数据a"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.47"
-        app:layout_constraintStart_toEndOf="@+id/button_send3"
+        app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
     <Button
         android:id="@+id/button_connect"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="32dp"
+        android:layout_marginBottom="731dp"
+        android:layout_marginEnd="411dp"
+        android:layout_marginTop="16dp"
         android:text="连接蓝牙"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
+    <Button
+        android:id="@+id/buttonX"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="16dp"
+        android:text="x"
+        android:visibility="gone"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/button_connect" />
+
+    <Button
+        android:id="@+id/buttonY"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:text="y"
+        android:visibility="gone"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/buttonX" />
+
+    <Button
+        android:id="@+id/buttonZ"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="16dp"
+        android:text="z"
+        android:visibility="gone"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/buttonY" />
+
     <TextView
-        android:id="@+id/textView6"
-        android:layout_width="292dp"
-        android:layout_height="233dp"
-        android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
+        android:id="@+id/textView8"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="根据Y图示放置后绕Y轴进行右旋转,直到出现数字变化"
+        android:visibility="gone"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/buttonZ" />
+
+    <CheckBox
+        android:id="@+id/checkBoxZ"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="116dp"
+        android:layout_marginEnd="411dp"
+        android:layout_marginStart="198dp"
+        android:layout_marginTop="731dp"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageButton
+        android:id="@+id/imageButtonX"
+        android:layout_width="46dp"
+        android:layout_height="46dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginTop="80dp"
+        android:src="@mipmap/x"
+        android:visibility="gone"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageButton
+        android:id="@+id/imageButtonY"
+        android:layout_width="46dp"
+        android:layout_height="46dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginTop="8dp"
+        android:src="@mipmap/y"
+        android:visibility="gone"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/imageButtonX" />
+
+    <ImageButton
+        android:id="@+id/imageButtonZ"
+        android:layout_width="46dp"
+        android:layout_height="46dp"
+        android:layout_marginEnd="16dp"
         android:layout_marginTop="8dp"
-        android:maxLines="20"
-        android:scrollbars="vertical"
+        android:src="@mipmap/z"
+        android:visibility="gone"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/imageButtonY" />
+
+    <ImageView
+        android:id="@+id/imageViewX"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="#CE020202"
+        android:scaleType="fitXY"
+        android:src="@drawable/x"
+        android:visibility="gone"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/button_update" />
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/imageViewY"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="#CE020202"
+        android:scaleType="fitXY"
+        android:src="@drawable/y"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/imageViewZ"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="#CE020202"
+        android:scaleType="fitXY"
+        android:src="@drawable/z"
+        android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.0"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <LinearLayout
+        android:id="@+id/SettingLayout"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:gravity="center_horizontal|center_vertical"
+        android:orientation="vertical"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <TextView
+            android:id="@+id/textView9"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingBottom="10dp"
+            android:text="选择需要检测的轴"
+            android:textAlignment="center"
+            android:textSize="20sp" />
+
+        <CheckBox
+            android:id="@+id/checkBoxAccX"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:clickable="false"
+            android:text="检测加速计X" />
+
+        <CheckBox
+            android:id="@+id/checkBoxAccZ"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="检测加速计Z" />
+
+        <CheckBox
+            android:id="@+id/checkBoxAccY"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:clickable="true"
+            android:text="检测加速计Y" />
+
+        <CheckBox
+            android:id="@+id/checkBoxGyroX"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:checked="false"
+            android:clickable="false"
+            android:text="检测陀螺仪X" />
+
+        <CheckBox
+            android:id="@+id/checkBoxGyroY"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:clickable="true"
+            android:text="检测陀螺仪Y" />
+
+        <CheckBox
+            android:id="@+id/checkBoxGyroZ"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="检测陀螺仪Z" />
+
+
+
+        <Button
+            android:id="@+id/button_enter"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="10dp"
+            android:baselineAligned="false"
+            android:text="进入检测" />
+
+
+    </LinearLayout>
+    <!-- 处理加速计判断的页面   -->
+    <RelativeLayout
+        android:id="@+id/page_1"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_margin="0dp"
+        android:orientation="horizontal"
+        android:visibility="invisible"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <ImageView
+            android:id="@+id/imageView_1"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#FFFFFF" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_margin="0dp"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:visibility="visible">
+
+
+            <Button
+                android:id="@+id/button_next_1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                android:text="下一步"
+                android:visibility="gone" />
+
+            <Button
+                android:id="@+id/button_dis_connect"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="16dp"
+                android:layout_weight="0"
+                android:text="断开连接"
+                android:visibility="gone" />
+
+            <Button
+                android:id="@+id/button_connect_1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                android:layout_weight="0"
+                android:text="连接蓝牙" />
+
+            <Button
+                android:id="@+id/buttonX_1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="8dp"
+                android:layout_weight="0"
+                android:text="检测"
+                android:visibility="gone" />
+
+            <Button
+                android:id="@+id/buttonX_3"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="8dp"
+                android:background="#27FF00"
+                android:enabled="true"
+                android:text="全部检测完成,清空数据并返回"
+                android:visibility="gone" />
+
+            <TextView
+                android:id="@+id/textView_title"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingBottom="16dp"
+                android:paddingTop="16dp"
+                android:text="TextView"
+                android:textAlignment="center"
+                android:textSize="18sp"
+                android:visibility="gone" />
+
+            <CheckBox
+                android:id="@+id/checkBoxX"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="0dp"
+                android:layout_weight="0"
+                android:clickable="false"
+                android:text="检测x方向,L,R键向上" />
+
+            <ImageView
+                android:id="@+id/imageViewX_1"
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:background="#CE020202"
+                android:scaleType="centerInside"
+                android:src="@drawable/x"
+                android:visibility="visible"
+                app:layout_constraintBottom_toBottomOf="@id/buttonX_1"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <TextView
+                android:id="@+id/textView6"
+                android:layout_width="292dp"
+                android:layout_height="200dp"
+                android:layout_margin="5dp"
+                android:background="#0C000000"
+                android:maxLines="20"
+                android:scrollbars="vertical"
+                android:text="  点击【连接蓝牙】,成功后点击检测按钮" />
+
+        </LinearLayout>
+    </RelativeLayout>
+
+    <!-- 处理陀螺仪检测   -->
+    <RelativeLayout
+        android:id="@+id/page_2"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="invisible"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <ImageView
+            android:id="@+id/imageView_2"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#FFFFFF" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:layout_margin="0dp"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:visibility="visible">
+
+
+            <Button
+                android:id="@+id/button_next_2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="下一步"
+                android:visibility="gone" />
+
+            <Button
+                android:id="@+id/button_dis_connect_2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="16dp"
+                android:text="断开蓝牙"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <Button
+                android:id="@+id/buttonY_1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="16dp"
+                android:text="检测" />
+
+            <CheckBox
+                android:id="@+id/checkBoxY"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="0dp"
+                android:text="检测Y方向,方向键向上" />
+
+            <ImageView
+                android:id="@+id/imageViewX_2"
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:background="#CE020202"
+                android:scaleType="fitXY"
+                android:src="@drawable/y"
+                android:visibility="visible"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <TextView
+                android:id="@+id/textView_2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="检测y轴方向\n按照图片把方向键竖起来固定后点击检测按钮"
+                android:textAlignment="center" />
+
+        </LinearLayout>
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/page_3"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:visibility="invisible"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <ImageView
+            android:id="@+id/imageView_3"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#FFFFFF" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:gravity="center_horizontal"
+            android:orientation="vertical"
+            android:visibility="visible">
+
+
+            <Button
+                android:id="@+id/button_dis_connect_3"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="16dp"
+                android:text="断开蓝牙"
+                android:visibility="visible"
+                app:layout_constraintTop_toTopOf="parent" />
+
+
+
+            <CheckBox
+                android:id="@+id/checkBoxGY"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="0dp"
+                android:layout_marginTop="0dp" />
+
+            <ImageView
+                android:id="@+id/imageViewX_3"
+                android:layout_width="300dp"
+                android:layout_height="300dp"
+                android:background="#CE020202"
+                android:scaleType="fitXY"
+                android:src="@drawable/y"
+                android:visibility="visible"
+                app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <TextView
+                android:id="@+id/textView_3"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="10dp"
+                android:layout_marginTop="10dp"
+                android:text="根据Y图示放置后绕Y轴进行右旋转,直到出现数字变化"
+                android:textAlignment="center" />
+
+        </LinearLayout>
+    </RelativeLayout>
+
 </android.support.constraint.ConstraintLayout>

BIN
app/src/main/res/mipmap-xxxhdpi/x.jpg


BIN
app/src/main/res/mipmap-xxxhdpi/y.jpg


BIN
app/src/main/res/mipmap-xxxhdpi/z.jpg


+ 1 - 1
app/src/main/res/values/base-strings.xml

@@ -16,7 +16,7 @@
 -->
 
 <resources>
-    <string name="app_name">BBOXBLELIB</string>
+    <string name="app_name">测试工具Next3.0</string>
     <string name="intro_message">
         <![CDATA[