diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 85f202b36..42cf9f729 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,9 @@ + + + + + + { + InterfaceService.RADIO_CONNECTED_ACTION -> { try { val connected = intent.getBooleanExtra(EXTRA_CONNECTED, false) val permanent = intent.getBooleanExtra(EXTRA_PERMANENT, false) @@ -1143,7 +1143,7 @@ class MeshService : Service(), Logging { } } - RadioInterfaceService.RECEIVE_FROMRADIO_ACTION -> { + InterfaceService.RECEIVE_FROMRADIO_ACTION -> { val proto = MeshProtos.FromRadio.parseFrom( intent.getByteArrayExtra( @@ -1348,7 +1348,7 @@ class MeshService : Service(), Logging { val parsed = MeshProtos.RadioConfig.parseFrom(payload) // Update our device - if (RadioInterfaceService.isOldApi!!) + if (BluetoothInterfaceService.isOldApi!!) connectedRadio.writeRadioConfig(payload) else sendToRadio(ToRadio.newBuilder().apply { @@ -1378,7 +1378,7 @@ class MeshService : Service(), Logging { } // set my owner info - if (RadioInterfaceService.isOldApi!!) + if (BluetoothInterfaceService.isOldApi!!) connectedRadio.writeOwner(user.toByteArray()) else sendToRadio(ToRadio.newBuilder().apply { this.setOwner = user @@ -1449,7 +1449,8 @@ class MeshService : Service(), Logging { // Run in the IO thread val filename = firmwareUpdateFilename ?: throw Exception("No update filename") val safe = - RadioInterfaceService.safe ?: throw Exception("Can't update - no bluetooth connected") + BluetoothInterfaceService.safe + ?: throw Exception("Can't update - no bluetooth connected") serviceScope.handledLaunch { SoftwareUpdateService.doUpdate(this@MeshService, safe, filename) diff --git a/app/src/main/java/com/geeksville/mesh/service/SimRadio.kt b/app/src/main/java/com/geeksville/mesh/service/SimRadio.kt index 883308445..ccc391b8e 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SimRadio.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SimRadio.kt @@ -1,7 +1,7 @@ package com.geeksville.mesh import android.content.Context -import com.geeksville.mesh.service.RadioInterfaceService +import com.geeksville.mesh.service.InterfaceService class SimRadio(private val context: Context) { @@ -45,7 +45,7 @@ class SimRadio(private val context: Context) { }.build() }.build() - RadioInterfaceService.broadcastReceivedFromRadio(context, fromRadio.toByteArray()) + InterfaceService.broadcastReceivedFromRadio(context, fromRadio.toByteArray()) } } } \ No newline at end of file diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt index cbbdd879a..e0f65616c 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -29,8 +29,8 @@ import com.geeksville.concurrent.handledLaunch import com.geeksville.mesh.MainActivity import com.geeksville.mesh.R import com.geeksville.mesh.model.UIViewModel +import com.geeksville.mesh.service.BluetoothInterfaceService import com.geeksville.mesh.service.MeshService -import com.geeksville.mesh.service.RadioInterfaceService import com.geeksville.util.anonymize import com.geeksville.util.exceptionReporter import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -176,7 +176,7 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging { */ fun startScan(): Boolean { debug("BTScan component active") - selectedMacAddr = RadioInterfaceService.getBondedDeviceAddress(context) + selectedMacAddr = BluetoothInterfaceService.getBondedDeviceAddress(context) return if (bluetoothAdapter == null) { warn("No bluetooth adapter. Running under emulation?") @@ -212,7 +212,7 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging { // filter and only accept devices that have a sw update service val filter = ScanFilter.Builder() - .setServiceUuid(ParcelUuid(RadioInterfaceService.BTM_SERVICE_UUID)) + .setServiceUuid(ParcelUuid(BluetoothInterfaceService.BTM_SERVICE_UUID)) .build() val settings = @@ -301,7 +301,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { private val hasCompanionDeviceApi: Boolean by lazy { - RadioInterfaceService.hasCompanionDeviceApi(requireContext()) + BluetoothInterfaceService.hasCompanionDeviceApi(requireContext()) } private val deviceManager: CompanionDeviceManager by lazy { @@ -507,7 +507,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { } val hasBonded = - RadioInterfaceService.getBondedDeviceAddress(requireContext()) != null + BluetoothInterfaceService.getBondedDeviceAddress(requireContext()) != null // get rid of the warning text once at least one device is paired warningNotPaired.visibility = if (hasBonded) View.GONE else View.VISIBLE @@ -571,7 +571,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { deviceRadioGroup.visibility = View.GONE changeRadioButton.visibility = View.VISIBLE - val curRadio = RadioInterfaceService.getBondedDeviceAddress(requireContext()) + val curRadio = BluetoothInterfaceService.getBondedDeviceAddress(requireContext()) if (curRadio != null) { scanStatusText.text = getString(R.string.current_pair).format(curRadio)