张海江
2018-01-26 04b72977be56e9cca1eb66883d7217237fb8ab9a
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();
        }
    };