mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
This required creation of new interfaces in order to break the static coupling. This also allowed for the removal of some plumbing of dependencies of these implementations since they are now directly injected.
This commit is contained in:
parent
121376201d
commit
a7b0d70c03
25 changed files with 370 additions and 220 deletions
|
|
@ -38,7 +38,8 @@ import com.geeksville.mesh.model.UIViewModel
|
|||
import com.geeksville.mesh.model.primaryChannel
|
||||
import com.geeksville.mesh.model.toChannelSet
|
||||
import com.geeksville.mesh.repository.radio.BluetoothInterface
|
||||
import com.geeksville.mesh.repository.radio.SerialInterface
|
||||
import com.geeksville.mesh.repository.radio.InterfaceId
|
||||
import com.geeksville.mesh.repository.radio.RadioInterfaceService
|
||||
import com.geeksville.mesh.service.*
|
||||
import com.geeksville.mesh.ui.*
|
||||
import com.geeksville.mesh.ui.map.MapFragment
|
||||
|
|
@ -121,6 +122,9 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
@Inject
|
||||
internal lateinit var serviceRepository: ServiceRepository
|
||||
|
||||
@Inject
|
||||
internal lateinit var radioInterfaceService: RadioInterfaceService
|
||||
|
||||
private val bluetoothPermissionsLauncher =
|
||||
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { result ->
|
||||
if (result.entries.all { it.value }) {
|
||||
|
|
@ -462,9 +466,9 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
try {
|
||||
usbDevice?.let { usb ->
|
||||
debug("Switching to USB radio ${usb.deviceName}")
|
||||
service.setDeviceAddress(SerialInterface.toInterfaceName(usb.deviceName))
|
||||
usbDevice =
|
||||
null // Only switch once - thereafter it should be stored in settings
|
||||
val address = radioInterfaceService.toInterfaceAddress(InterfaceId.SERIAL, usb.deviceName)
|
||||
service.setDeviceAddress(address)
|
||||
usbDevice = null // Only switch once - thereafter it should be stored in settings
|
||||
}
|
||||
|
||||
val connectionState =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue