张海江
2018-03-26 b4f0e07335e97d66d5a40c396f15a772619066b0
app/src/main/java/com/moral/yunfushao/activity/BLESearchActivity.java
@@ -21,6 +21,7 @@
import com.clj.fastble.data.ScanResult;
import com.moral.andbrickslib.baseadapter.headandfooter.DividerItemDecoration;
import com.moral.andbrickslib.baseadapter.recyclerview.MultiItemTypeAdapter;
import com.moral.yunfushao.MainApp;
import com.moral.yunfushao.R;
import com.moral.yunfushao.adapter.BleDeviceAdapter;
import com.moral.yunfushao.base.BaseActivity;
@@ -93,6 +94,12 @@
                 */
                if (mBluetoothService != null) {
                    mBluetoothService.cancelScan();
                    /**
                     * 如果连接状态,断开重新连接
                     */
                    if(MainApp.theApp.bleManager!=null&&MainApp.theApp.bleManager.isConnected()){
                        mBluetoothService.closeConnect();
                    }
                    mBluetoothService.connectDevice(scanResultList.get(position));
                }
            }
@@ -210,7 +217,7 @@
            progressDialog.dismiss();
            EventMessage msg = new EventMessage();
            msg.setType(AppConfig.GET_BLE_SERVICE);
            EventBus.getDefault().post(msg);
            EventBus.getDefault().postSticky(msg);
            finish();
        }
    };