Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
Address Detekt's warnings in Kotlin code
  • Loading branch information
MGaetan89 committed May 19, 2024
1 parent c629ef9 commit 9f3318d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BluetoothProvisioner(applicationContext: Context) {
object : ScanCallback() {
override fun onScanResult(callbackType: Int, result: ScanResult?) {
if (result?.device != null) {
val unused = trySend(result.device)
trySend(result.device)
}
}

Expand All @@ -49,15 +49,15 @@ class BluetoothProvisioner(applicationContext: Context) {
object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt?, status: Int, newState: Int) {
if (newState == BluetoothProfile.STATE_CONNECTED) {
val unused = gatt!!.discoverServices()
gatt!!.discoverServices()
} else {
cancel("Connect Failed", null)
}
}

override fun onServicesDiscovered(gatt: BluetoothGatt?, status: Int) {
if (status == BluetoothGatt.GATT_SUCCESS) {
val unused = trySend(gatt!!)
trySend(gatt!!)
} else {
cancel("Service discovery failed", null)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import org.robolectric.shadows.ShadowBluetoothLeScanner
@Config(sdk = [S])
class BluetoothProvisionerTest {

val BLUETOOTH_MAC = "00:11:22:33:AA:BB"

val context = RuntimeEnvironment.getApplication()

val bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
Expand Down Expand Up @@ -80,4 +78,8 @@ class BluetoothProvisionerTest {

executor.runAll()
}

private companion object {
private const val BLUETOOTH_MAC = "00:11:22:33:AA:BB"
}
}

0 comments on commit 9f3318d

Please sign in to comment.