新增:自动任务·快捷指令 —— 触发条件:蓝牙设备(状态变化、设备发现、连接断开) #388

This commit is contained in:
pppscn 2024-03-17 19:30:47 +08:00
parent a4aade94c5
commit 86d0c35ea9

View File

@ -11,6 +11,7 @@ import com.idormy.sms.forwarder.utils.ACTION_RESTART
import com.idormy.sms.forwarder.utils.ACTION_START
import com.idormy.sms.forwarder.utils.ACTION_STOP
import com.idormy.sms.forwarder.utils.Log
import com.idormy.sms.forwarder.utils.task.TaskUtils
@Suppress("PrivatePropertyName", "DEPRECATION")
class BluetoothScanService : Service() {
@ -47,6 +48,8 @@ class BluetoothScanService : Service() {
return
}
if (isRunning) return
// 清空已发现设备
TaskUtils.discoveredDevices = mutableMapOf()
bluetoothAdapter?.startDiscovery()
isRunning = true
}