|
|
@@ -569,6 +569,11 @@ object BusinessManager {
|
|
|
}
|
|
|
isPreparing = true
|
|
|
val listener = connectListeners[0]
|
|
|
+ if (ActivityUtils.currentActivity() == null) {
|
|
|
+ LogUtil.w("Ignore connectKey : ${listener.mac} no current activity")
|
|
|
+ isPreparing = false
|
|
|
+ return
|
|
|
+ }
|
|
|
prepareBle(listener.mac, ActivityUtils.currentActivity() as BaseActivity<*>, false) { isDone, bleBean ->
|
|
|
Executor.runOnMain {
|
|
|
isPreparing = false
|
|
|
@@ -654,7 +659,7 @@ object BusinessManager {
|
|
|
}
|
|
|
|
|
|
override fun onScanFinished(scanResultList: MutableList<BleDevice>?) {
|
|
|
- LogUtil.i("onScanFinished: $mac")
|
|
|
+ LogUtil.i("onScanFinished: $mac - ${scanResultList?.none { it.mac == mac }}")
|
|
|
if (isNeedLoading) sendEventMsg(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, null, null)))
|
|
|
// 没有扫描到
|
|
|
if (scanResultList?.none { it.mac == mac } == true) {
|
|
|
@@ -673,6 +678,7 @@ object BusinessManager {
|
|
|
isNeedLoading: Boolean = false,
|
|
|
prepareDoneCallBack: ((Boolean, BleBean?) -> Unit)?
|
|
|
) {
|
|
|
+ LogUtil.i("doConnect : ${bleDevice.mac}")
|
|
|
if (!checkProcess(bleDevice.mac)) {
|
|
|
LogUtil.e("Prepare is canceled : ${bleDevice.mac}")
|
|
|
return
|