Răsfoiți Sursa

1.添加基本设备活动类及其视图;
2.优化主活动。

Yumin 6 ani în urmă
părinte
comite
dc2f696fe6

+ 3 - 5
app/src/main/AndroidManifest.xml

@@ -2,12 +2,9 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="cn.minbb.producttester">
-
     <!-- 使用蓝牙设备 -->
-    <uses-permission android:name="android.permission.BLUETOOTH" />
-    <!-- 管理蓝牙设备 -->
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-    <!-- 如果 Android6.0 蓝牙搜索不到设备,需要补充下面两个权限 -->
+    <uses-permission android:name="android.permission.BLUETOOTH" /> <!-- 管理蓝牙设备 -->
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 如果 Android6.0 蓝牙搜索不到设备,需要补充下面两个权限 -->
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
@@ -21,6 +18,7 @@
         android:supportsRtl="true"
         android:theme="@style/AppTheme"
         tools:ignore="GoogleAppIndexingWarning">
+        <activity android:name=".views.DeviceBasicActivity"></activity>
         <activity
             android:name=".views.StartActivity"
             android:configChanges="orientation|keyboardHidden|screenSize"

+ 5 - 1
app/src/main/java/cn/minbb/producttester/ctrl/BluetoothChatService.java

@@ -35,6 +35,7 @@ public class BluetoothChatService {
     private ConnectThread mConnectThread;
     private ConnectedThread mConnectedThread;
     private int mState;
+
     // 指示当前连接状态的常量
     public static final int STATE_NONE = 0;       // we're doing nothing
     public static final int STATE_LISTEN = 1;     // 现在正在侦听传入连接
@@ -50,6 +51,9 @@ public class BluetoothChatService {
     public static final String DEVICE_NAME = "device_name";
     public static final String TOAST = "toast";
 
+    public static String EXTRA_DEVICE_ADDRESS = "device_address";
+    public static String EXTRA_LEGAL = "legal";
+
     // 蓝牙接收延迟时间
     private int delayTime;
 
@@ -228,7 +232,7 @@ public class BluetoothChatService {
      * 指示连接已丢失并通知UI活动
      */
     private void connectionLost() {
-        setState(STATE_NONE);
+        setState(STATE_LISTEN);
         // 将失败消息发送回活动
         Message msg = mHandler.obtainMessage(MESSAGE_TOAST);
         Bundle bundle = new Bundle();

+ 227 - 0
app/src/main/java/cn/minbb/producttester/views/DeviceBasicActivity.java

@@ -0,0 +1,227 @@
+package cn.minbb.producttester.views;
+
+import android.annotation.SuppressLint;
+import android.app.ProgressDialog;
+import android.bluetooth.BluetoothAdapter;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.app.AppCompatDelegate;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.joanzapata.iconify.widget.IconTextView;
+
+import java.io.UnsupportedEncodingException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import cn.minbb.producttester.R;
+import cn.minbb.producttester.ctrl.App;
+import cn.minbb.producttester.ctrl.BluetoothChatService;
+
+public class DeviceBasicActivity extends AppCompatActivity {
+
+    @BindView(R.id.noDevice)
+    IconTextView noDevice;
+    @BindView(R.id.t1)
+    TextView t1;
+    @BindView(R.id.t2)
+    TextView t2;
+    @BindView(R.id.t3)
+    TextView t3;
+    @BindView(R.id.t4)
+    TextView t4;
+    @BindView(R.id.t5)
+    TextView t5;
+    @BindView(R.id.t6)
+    TextView t6;
+
+    private ProgressDialog dialog;
+
+    private BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+    private BluetoothChatService chatService = null;
+
+    static {
+        AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_device_basic);
+        ButterKnife.bind(this);
+
+        App.setupActionBar(this);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        if (chatService != null) {
+            // 只有状态是 STATE_NONE,我们知道我们还没有启动蓝牙
+            if (chatService.getState() == BluetoothChatService.STATE_NONE) {
+                // 启动 BluetoothChat 服务
+                chatService.start();
+            }
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+        mHandler.removeCallbacksAndMessages(null);
+        // 停止蓝牙通信连接服务
+        if (chatService != null) chatService.stop();
+    }
+
+    public static void start(Context context) {
+        Intent starter = new Intent(context, DeviceBasicActivity.class);
+        context.startActivity(starter);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        switch (item.getItemId()) {
+            case android.R.id.home:
+                AlertDialog.Builder builder = new AlertDialog.Builder(DeviceBasicActivity.this);
+                builder.setTitle("退出")
+                        .setMessage("返回将断开设备的蓝牙连接")
+                        .setNegativeButton("取消", null)
+                        .setPositiveButton("退出", (dialog, which) -> finish())
+                        .create()
+                        .show();
+            default:
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        switch (requestCode) {
+            case 0:
+                if (resultCode == RESULT_OK) {
+                    // 初始化蓝牙连接服务
+                    chatService = new BluetoothChatService(this, mHandler);
+                    // 获取设备的 MAC 地址
+                    String address = data.getExtras().getString(BluetoothChatService.EXTRA_DEVICE_ADDRESS);
+                    // 尝试连接到设备
+                    chatService.connect(bluetoothAdapter.getRemoteDevice(address));
+                }
+        }
+    }
+
+    @OnClick({R.id.noDevice, R.id.opUp, R.id.opDown, R.id.opLeft, R.id.opRight})
+    public void onViewClicked(View view) {
+        switch (view.getId()) {
+            case R.id.noDevice:
+                startActivityForResult(new Intent(DeviceBasicActivity.this, ScanDeviceActivity.class), 0);
+                break;
+            case R.id.opUp:
+                break;
+            case R.id.opDown:
+                break;
+            case R.id.opLeft:
+                break;
+            case R.id.opRight:
+                break;
+        }
+    }
+
+    private void showConnectDeviceProgress(boolean show) {
+        if (dialog == null) {
+            dialog = new ProgressDialog(this);
+            dialog.setTitle("连接");
+            dialog.setMessage("设备连接中······");
+            dialog.setCancelable(false);
+        }
+        if (show) {
+            dialog.show();
+        } else {
+            dialog.dismiss();
+            dialog = null;
+        }
+    }
+
+    @SuppressLint("HandlerLeak")
+    private final Handler mHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case BluetoothChatService.MESSAGE_STATE_CHANGE:
+                    System.err.println("MESSAGE_STATE_CHANGE = " + msg.arg1);
+                    switch (msg.arg1) {
+                        case BluetoothChatService.STATE_CONNECTED:
+                            // 已连接
+                            showConnectDeviceProgress(false);
+                            noDevice.setVisibility(View.GONE);
+                            break;
+                        case BluetoothChatService.STATE_CONNECTING:
+                            showConnectDeviceProgress(true);
+                            break;
+                        case BluetoothChatService.STATE_LISTEN:
+                            showConnectDeviceProgress(false);
+                            break;
+                        case BluetoothChatService.STATE_NONE:
+                            // 无连接
+                            showConnectDeviceProgress(false);
+                            noDevice.setVisibility(View.VISIBLE);
+                            break;
+                    }
+                    break;
+                case BluetoothChatService.MESSAGE_READ:
+                    byte[] readBuf = (byte[]) msg.obj;
+                    String readMessage = null;
+                    try {
+                        readMessage = new String(readBuf, 0, msg.arg1, "GBK");
+                    } catch (UnsupportedEncodingException e) {
+                        e.printStackTrace();
+                    }
+                    System.err.println("/" + readMessage);
+
+                    Pattern p = Pattern.compile("\\{.*?\\}");
+                    Matcher m = p.matcher(readMessage);
+                    // 判断正则表达式是否匹配到
+                    if (m.find()) {
+                        System.out.println("->" + m.group());
+                    } else {
+                        System.out.println("未找到");
+                    }
+                    //检错误码计算函数
+//                    if (inhex == true) {
+//                        String readMessage = " " + Data_syn.bytesToHexString(readBuf, msg.arg1);
+//                        fmsg += readMessage;
+//                        mConversationView.append(readMessage);
+//                        // 接收计数,更显UI
+//                        countin += readMessage.length() / 2;
+//                        incount.setText("" + countin);
+//                    } else if (inhex == false) {
+//                    }
+                    break;
+                case BluetoothChatService.MESSAGE_DEVICE_NAME:
+                    String connectedDeviceName = msg.getData().getString(BluetoothChatService.DEVICE_NAME);
+                    Toast.makeText(getApplicationContext(), "连接到 " + connectedDeviceName, Toast.LENGTH_SHORT).show();
+                    break;
+                case BluetoothChatService.MESSAGE_TOAST:
+                    Toast.makeText(getApplicationContext(), msg.getData().getString(BluetoothChatService.TOAST), Toast.LENGTH_SHORT).show();
+                    break;
+            }
+        }
+    };
+}

+ 47 - 11
app/src/main/java/cn/minbb/producttester/views/MainActivity.java

@@ -1,6 +1,8 @@
 package cn.minbb.producttester.views;
 
 import android.annotation.SuppressLint;
+import android.app.ProgressDialog;
+import android.bluetooth.BluetoothAdapter;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
@@ -24,6 +26,8 @@ import com.joanzapata.iconify.widget.IconTextView;
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -50,7 +54,9 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
     IconTextView noDevice;
 
     private List<View> views = new ArrayList<>(3);
+    private ProgressDialog dialog;
 
+    private BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
     private BluetoothChatService chatService = null;
 
     static {
@@ -63,9 +69,6 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
         setContentView(R.layout.activity_main);
         ButterKnife.bind(this);
 
-        // 初始化蓝牙连接服务
-        chatService = new BluetoothChatService(this, mHandler);
-
         initView();
         setListener();
         loadData();
@@ -140,6 +143,21 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
         context.startActivity(starter);
     }
 
+    private void showConnectDeviceProgress(boolean show) {
+        if (dialog == null) {
+            dialog = new ProgressDialog(this);
+            dialog.setTitle("连接");
+            dialog.setMessage("设备连接中······");
+            dialog.setCancelable(false);
+        }
+        if (show) {
+            dialog.show();
+        } else {
+            dialog.dismiss();
+            dialog = null;
+        }
+    }
+
     @OnClick({R.id.device, R.id.noDevice})
     public void onViewClicked(View view) {
         switch (view.getId()) {
@@ -149,10 +167,11 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
                         .setMessage("确定断开设备的蓝牙连接吗?")
                         .setNegativeButton("取消", null)
                         .setPositiveButton("确定", (dialog, which) -> chatService.stop())
-                        .create().show();
+                        .create()
+                        .show();
                 break;
             case R.id.noDevice:
-                startActivityForResult(new Intent(MainActivity.this, ScanDeviceActivity.class), 0);
+                DeviceBasicActivity.start(this);
                 break;
             default:
         }
@@ -188,7 +207,8 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
                 .setMessage("确定断开设备的蓝牙连接并退出程序吗?")
                 .setNegativeButton("取消", null)
                 .setPositiveButton("确定", (dialog, which) -> finish())
-                .create().show();
+                .create()
+                .show();
     }
 
     @Override
@@ -197,6 +217,12 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
         switch (requestCode) {
             case 0:
                 if (resultCode == RESULT_OK) {
+                    // 初始化蓝牙连接服务
+                    chatService = new BluetoothChatService(this, mHandler);
+                    // 获取设备的 MAC 地址
+                    String address = data.getExtras().getString(BluetoothChatService.EXTRA_DEVICE_ADDRESS);
+                    // 尝试连接到设备
+                    chatService.connect(bluetoothAdapter.getRemoteDevice(address));
                 }
         }
     }
@@ -207,21 +233,22 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case BluetoothChatService.MESSAGE_STATE_CHANGE:
-                    System.err.println("************************ MESSAGE_STATE_CHANGE = " + msg.arg1);
+                    System.err.println("MESSAGE_STATE_CHANGE = " + msg.arg1);
                     switch (msg.arg1) {
                         case BluetoothChatService.STATE_CONNECTED:
                             // 已连接
-                            Toast.makeText(getApplicationContext(), "已连接 +", Toast.LENGTH_SHORT).show();
+                            showConnectDeviceProgress(false);
                             noDevice.setVisibility(View.GONE);
                             break;
                         case BluetoothChatService.STATE_CONNECTING:
-                            Toast.makeText(getApplicationContext(), "连接中 +", Toast.LENGTH_SHORT).show();
+                            showConnectDeviceProgress(true);
                             break;
                         case BluetoothChatService.STATE_LISTEN:
-                            Toast.makeText(getApplicationContext(), "侦听中 +", Toast.LENGTH_SHORT).show();
+                            showConnectDeviceProgress(false);
                             break;
                         case BluetoothChatService.STATE_NONE:
                             // 无连接
+                            showConnectDeviceProgress(false);
                             noDevice.setVisibility(View.VISIBLE);
                             break;
                     }
@@ -235,6 +262,15 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
                         e.printStackTrace();
                     }
                     System.err.println("/" + readMessage);
+
+                    Pattern p = Pattern.compile("\\{.*?\\}");
+                    Matcher m = p.matcher(readMessage);
+                    // 判断正则表达式是否匹配到
+                    if (m.find()) {
+                        System.out.println("->" + m.group());
+                    } else {
+                        System.out.println("未找到");
+                    }
                     //检错误码计算函数
 //                    if (inhex == true) {
 //                        String readMessage = " " + Data_syn.bytesToHexString(readBuf, msg.arg1);
@@ -248,7 +284,7 @@ public class MainActivity extends AppCompatActivity implements BottomNavigationV
                     break;
                 case BluetoothChatService.MESSAGE_DEVICE_NAME:
                     String connectedDeviceName = msg.getData().getString(BluetoothChatService.DEVICE_NAME);
-                    Toast.makeText(getApplicationContext(), "连接到 + " + connectedDeviceName, Toast.LENGTH_SHORT).show();
+                    Toast.makeText(getApplicationContext(), "连接到 " + connectedDeviceName, Toast.LENGTH_SHORT).show();
                     break;
                 case BluetoothChatService.MESSAGE_TOAST:
                     Toast.makeText(getApplicationContext(), msg.getData().getString(BluetoothChatService.TOAST), Toast.LENGTH_SHORT).show();

+ 7 - 38
app/src/main/java/cn/minbb/producttester/views/ScanDeviceActivity.java

@@ -138,12 +138,15 @@ public class ScanDeviceActivity extends AppCompatActivity {
                     // 配对中
                     break;
                 case BluetoothDevice.BOND_BONDED:
-                    showConnectDeviceProgress(true);
                     // 已配对 - 尝试连接到设备
                     // BluetoothDevice device = bluetoothAdapter.getRemoteDevice(address);
                     // 设备的 MAC 地址
-                    BluetoothDevice device = bluetoothAdapter.getRemoteDevice(selectDevice.getAddress());
-                    chatService.connect(device);
+                    Intent intent = new Intent();
+                    intent.putExtra(BluetoothChatService.EXTRA_DEVICE_ADDRESS, selectDevice.getAddress());
+                    intent.putExtra(BluetoothChatService.EXTRA_LEGAL, false);
+                    // 设置结果并完成此活动
+                    setResult(RESULT_OK, intent);
+                    finish();
                     break;
                 default:
             }
@@ -202,21 +205,6 @@ public class ScanDeviceActivity extends AppCompatActivity {
         }
     }
 
-    private void showConnectDeviceProgress(boolean show) {
-        if (dialog == null) {
-            dialog = new ProgressDialog(this);
-            dialog.setTitle("连接");
-            dialog.setMessage("设备连接中······");
-            dialog.setCancelable(false);
-        }
-        if (show) {
-            dialog.show();
-        } else {
-            dialog.dismiss();
-            dialog = null;
-        }
-    }
-
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         menu.add(0, 0, 0, "提示").setIcon(R.drawable.ic_info_outline_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
@@ -284,7 +272,7 @@ public class ScanDeviceActivity extends AppCompatActivity {
             case 1:
                 new Handler().postDelayed(() -> runOnUiThread(() -> {
                     // 刷新蓝牙设备列表
-                    System.out.println("刷新蓝牙设备列表");
+                    Toast.makeText(this, "刷新蓝牙设备列表", Toast.LENGTH_SHORT).show();
                 }), 50);
                 if (resultCode == RESULT_OK) {
                     Toast.makeText(this, "允许本地蓝牙被附近的其它蓝牙设备发现", Toast.LENGTH_SHORT).show();
@@ -315,24 +303,6 @@ public class ScanDeviceActivity extends AppCompatActivity {
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
-                case BluetoothChatService.MESSAGE_STATE_CHANGE:
-                    System.err.println("MESSAGE_STATE_CHANGE = " + msg.arg1);
-                    switch (msg.arg1) {
-                        case BluetoothChatService.STATE_CONNECTED:
-                            showConnectDeviceProgress(false);
-                            break;
-                        case BluetoothChatService.STATE_CONNECTING:
-                            Toast.makeText(getApplicationContext(), "连接中", Toast.LENGTH_SHORT).show();
-                            break;
-                        case BluetoothChatService.STATE_LISTEN:
-                            Toast.makeText(getApplicationContext(), "侦听中", Toast.LENGTH_SHORT).show();
-                            break;
-                        case BluetoothChatService.STATE_NONE:
-                            Toast.makeText(getApplicationContext(), "无连接", Toast.LENGTH_SHORT).show();
-                            showConnectDeviceProgress(false);
-                            break;
-                    }
-                    break;
                 case BluetoothChatService.MESSAGE_WRITE:
                     byte[] writeBuf = (byte[]) msg.obj;
                     // 自动发送
@@ -393,7 +363,6 @@ public class ScanDeviceActivity extends AppCompatActivity {
                 case BluetoothChatService.MESSAGE_DEVICE_NAME:
                     String connectedDeviceName = msg.getData().getString(BluetoothChatService.DEVICE_NAME);
                     Toast.makeText(getApplicationContext(), "连接到 " + connectedDeviceName, Toast.LENGTH_SHORT).show();
-                    ScanDeviceActivity.this.finish();
                     break;
                 case BluetoothChatService.MESSAGE_TOAST:
                     Toast.makeText(getApplicationContext(), msg.getData().getString(BluetoothChatService.TOAST), Toast.LENGTH_SHORT).show();

+ 128 - 0
app/src/main/res/layout/activity_device_basic.xml

@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    tools:context=".views.DeviceBasicActivity">
+
+    <LinearLayout
+        android:id="@+id/contentPanel"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+        <TextView
+            android:id="@+id/t1"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="PAGEONE: 0" />
+
+        <TextView
+            android:id="@+id/t2"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="TestPageNum: 1" />
+
+        <TextView
+            android:id="@+id/t3"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="TestCursorNum: 1" />
+
+        <TextView
+            android:id="@+id/t4"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="Angle_P: 23.670000" />
+
+        <TextView
+            android:id="@+id/t5"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="Angle_I: -55.799999" />
+
+        <TextView
+            android:id="@+id/t6"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="16dp"
+            android:text="Angle_D: 0.000000" />
+    </LinearLayout>
+
+    <android.support.constraint.ConstraintLayout
+        android:id="@+id/op"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:padding="16dp">
+
+        <android.support.design.widget.FloatingActionButton
+            android:id="@+id/opUp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="8dp"
+            app:layout_constraintBottom_toTopOf="@+id/opCenter"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:srcCompat="@drawable/ic_info_outline_white_24dp" />
+
+        <android.support.design.widget.FloatingActionButton
+            android:id="@+id/opLeft"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@+id/opCenter"
+            app:layout_constraintTop_toTopOf="parent"
+            app:srcCompat="@drawable/ic_info_outline_white_24dp" />
+
+        <android.support.design.widget.FloatingActionButton
+            android:id="@+id/opCenter"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:visibility="invisible"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:srcCompat="@drawable/ic_info_outline_white_24dp" />
+
+        <android.support.design.widget.FloatingActionButton
+            android:id="@+id/opRight"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/opCenter"
+            app:layout_constraintTop_toTopOf="parent"
+            app:srcCompat="@drawable/ic_info_outline_white_24dp" />
+
+        <android.support.design.widget.FloatingActionButton
+            android:id="@+id/opDown"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/opCenter"
+            app:srcCompat="@drawable/ic_info_outline_white_24dp" />
+    </android.support.constraint.ConstraintLayout>
+
+    <com.joanzapata.iconify.widget.IconTextView
+        android:id="@+id/noDevice"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:background="@android:color/white"
+        android:gravity="center"
+        android:text="{fa-hand-pointer-o 64sp}\n\n点击连接设备"
+        android:textSize="20sp"
+        android:textStyle="bold" />
+
+</RelativeLayout>