style(core): Fix detekt linting errors after code extraction

This commit is contained in:
James Rich 2026-03-17 12:34:25 -05:00
parent 9cff9bc5c9
commit e39d2e2be9
6 changed files with 48 additions and 29 deletions

View file

@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("TooManyFunctions", "TooGenericExceptionCaught")
package org.meshtastic.core.network.radio
import android.annotation.SuppressLint

View file

@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("SwallowedException")
package org.meshtastic.core.network.repository
import android.annotation.SuppressLint

View file

@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("MagicNumber")
package org.meshtastic.core.network.repository
import com.hoho.android.usbserial.driver.CdcAcmSerialDriver

View file

@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("MagicNumber")
package org.meshtastic.core.network.repository
import android.hardware.usb.UsbManager

View file

@ -27,12 +27,8 @@ import co.touchlab.kermit.Logger
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.koin.android.ext.android.inject
import org.meshtastic.core.common.hasLocationPermission
import org.meshtastic.core.common.util.handledLaunch
import org.meshtastic.core.common.util.toRemoteExceptions
import org.meshtastic.core.model.DataPacket
import org.meshtastic.core.model.DeviceVersion
@ -43,18 +39,12 @@ import org.meshtastic.core.model.Position
import org.meshtastic.core.model.RadioNotConnectedException
import org.meshtastic.core.repository.CommandSender
import org.meshtastic.core.repository.MeshConnectionManager
import org.meshtastic.core.repository.MeshLocationManager
import org.meshtastic.core.repository.MeshMessageProcessor
import org.meshtastic.core.repository.MeshRouter
import org.meshtastic.core.repository.MeshServiceNotifications
import org.meshtastic.core.repository.NodeManager
import org.meshtastic.core.repository.PacketHandler
import org.meshtastic.core.repository.RadioInterfaceService
import org.meshtastic.core.repository.SERVICE_NOTIFY_ID
import org.meshtastic.core.repository.ServiceBroadcasts
import org.meshtastic.core.repository.ServiceRepository
import org.meshtastic.core.service.IMeshService
import org.meshtastic.proto.PortNum
@Suppress("TooManyFunctions", "LargeClass")
@ -64,14 +54,10 @@ class MeshService : Service() {
private val serviceRepository: ServiceRepository by inject()
private val packetHandler: PacketHandler by inject()
private val serviceBroadcasts: ServiceBroadcasts by inject()
private val nodeManager: NodeManager by inject()
private val messageProcessor: MeshMessageProcessor by inject()
private val commandSender: CommandSender by inject()
private val locationManager: MeshLocationManager by inject()

View file

@ -1,13 +1,37 @@
/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.meshtastic.core.service
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.flow.MutableSharedFlow
import org.meshtastic.core.repository.CommandSender
import org.meshtastic.core.repository.MeshConnectionManager
import org.meshtastic.core.repository.MeshMessageProcessor
import org.meshtastic.core.repository.MeshRouter
import org.meshtastic.core.repository.MeshServiceNotifications
import org.meshtastic.core.repository.NodeManager
import org.meshtastic.core.repository.PacketHandler
import org.meshtastic.core.repository.RadioInterfaceService
import org.meshtastic.core.repository.ServiceRepository
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import org.meshtastic.core.repository.*
class MeshServiceOrchestratorTest {
@ -22,30 +46,31 @@ class MeshServiceOrchestratorTest {
val connectionManager = mockk<MeshConnectionManager>(relaxed = true)
val router = mockk<MeshRouter>(relaxed = true)
val serviceNotifications = mockk<MeshServiceNotifications>(relaxed = true)
every { radioInterfaceService.receivedData } returns MutableSharedFlow()
every { serviceRepository.serviceAction } returns MutableSharedFlow()
val orchestrator = MeshServiceOrchestrator(
radioInterfaceService,
serviceRepository,
packetHandler,
nodeManager,
messageProcessor,
commandSender,
connectionManager,
router,
serviceNotifications
)
val orchestrator =
MeshServiceOrchestrator(
radioInterfaceService,
serviceRepository,
packetHandler,
nodeManager,
messageProcessor,
commandSender,
connectionManager,
router,
serviceNotifications,
)
assertFalse(orchestrator.isRunning)
orchestrator.start()
assertTrue(orchestrator.isRunning)
verify { serviceNotifications.initChannels() }
verify { packetHandler.start(any()) }
verify { nodeManager.loadCachedNodeDB() }
orchestrator.stop()
assertFalse(orchestrator.isRunning)
}