fun Context.disconnectBondedDevice(){
Const.blSocket?.let {
MyBluetoothService(BluetoothUtil.handler).ConnectedThread(it).cancel() //소켓 연결 해제
Const.blDevice!!::class.java.getMethod("removeBond").invoke(Const.blDevice!!) // 연결된 device 연결 해제
}
}
fun cancel() {
if (mmSocket.isConnected) {
try {
mmSocket.close() //소켓 close
} catch (e: IOException) {
Log.e(TAG, "Could not close the connect socket", e)
}
}
}