From 35328a53451fa4ed74aee35ff2f205a7cf493db8 Mon Sep 17 00:00:00 2001 From: Zhengyu Peng Date: Mon, 21 Feb 2022 22:42:39 -0500 Subject: [PATCH] Update BluetoothService.kt --- .../com/rookiedev/hexapod/network/BluetoothService.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/software/android/app/src/main/java/com/rookiedev/hexapod/network/BluetoothService.kt b/software/android/app/src/main/java/com/rookiedev/hexapod/network/BluetoothService.kt index 7c35e55..1bc3aa8 100644 --- a/software/android/app/src/main/java/com/rookiedev/hexapod/network/BluetoothService.kt +++ b/software/android/app/src/main/java/com/rookiedev/hexapod/network/BluetoothService.kt @@ -1,16 +1,13 @@ package com.rookiedev.hexapod.network -import android.Manifest import android.annotation.SuppressLint import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothServerSocket import android.bluetooth.BluetoothSocket import android.content.Context -import android.content.pm.PackageManager import android.os.Bundle import android.os.Handler -import androidx.core.app.ActivityCompat import java.io.IOException import java.io.InputStream import java.io.OutputStream @@ -23,7 +20,7 @@ import java.util.* * incoming connections, a thread for connecting with a device, and a * thread for performing data transmissions when connected. */ -class BluetoothChatService(context: Context?, handler: Handler) { +class BluetoothService(context: Context?, handler: Handler) { // Member fields private val mAdapter: BluetoothAdapter private val mHandler: Handler @@ -276,7 +273,7 @@ class BluetoothChatService(context: Context?, handler: Handler) { // If a connection was accepted if (socket != null) { - synchronized(this@BluetoothChatService) { + synchronized(this@BluetoothService) { when (mState) { STATE_LISTEN, STATE_CONNECTING -> // Situation normal. Start the connected thread. connected( @@ -376,7 +373,7 @@ class BluetoothChatService(context: Context?, handler: Handler) { } // Reset the ConnectThread because we're done - synchronized(this@BluetoothChatService) { mConnectThread = null } + synchronized(this@BluetoothService) { mConnectThread = null } // Start the connected thread connected(mmSocket, mmDevice, mSocketType)