mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(transport): complete transport architecture overhaul — extract callback, wire BleReconnectPolicy, fix safety issues (#5080)
This commit is contained in:
parent
962c619c4c
commit
e85300531e
64 changed files with 1184 additions and 1018 deletions
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.meshtastic.core.testing
|
||||
|
||||
import org.meshtastic.core.model.ConnectionState
|
||||
import org.meshtastic.core.model.Node
|
||||
import org.meshtastic.core.repository.MeshServiceNotifications
|
||||
import org.meshtastic.proto.ClientNotification
|
||||
|
|
@ -28,10 +29,7 @@ class FakeMeshServiceNotifications : MeshServiceNotifications {
|
|||
|
||||
override fun initChannels() {}
|
||||
|
||||
override fun updateServiceStateNotification(
|
||||
state: org.meshtastic.core.model.ConnectionState,
|
||||
telemetry: Telemetry?,
|
||||
) {}
|
||||
override fun updateServiceStateNotification(state: ConnectionState, telemetry: Telemetry?) {}
|
||||
|
||||
override suspend fun updateMessageNotification(
|
||||
contactKey: String,
|
||||
|
|
|
|||
|
|
@ -19,8 +19,13 @@ package org.meshtastic.core.testing
|
|||
import kotlinx.coroutines.flow.StateFlow
|
||||
import org.meshtastic.core.model.ConnectionState
|
||||
import org.meshtastic.core.model.DataPacket
|
||||
import org.meshtastic.core.model.Position
|
||||
import org.meshtastic.core.model.RadioController
|
||||
import org.meshtastic.proto.Channel
|
||||
import org.meshtastic.proto.ClientNotification
|
||||
import org.meshtastic.proto.Config
|
||||
import org.meshtastic.proto.ModuleConfig
|
||||
import org.meshtastic.proto.User
|
||||
|
||||
/**
|
||||
* A test double for [RadioController] that provides a no-op implementation and tracks calls for assertions in tests.
|
||||
|
|
@ -79,19 +84,19 @@ class FakeRadioController :
|
|||
return true
|
||||
}
|
||||
|
||||
override suspend fun setLocalConfig(config: org.meshtastic.proto.Config) {}
|
||||
override suspend fun setLocalConfig(config: Config) {}
|
||||
|
||||
override suspend fun setLocalChannel(channel: org.meshtastic.proto.Channel) {}
|
||||
override suspend fun setLocalChannel(channel: Channel) {}
|
||||
|
||||
override suspend fun setOwner(destNum: Int, user: org.meshtastic.proto.User, packetId: Int) {}
|
||||
override suspend fun setOwner(destNum: Int, user: User, packetId: Int) {}
|
||||
|
||||
override suspend fun setConfig(destNum: Int, config: org.meshtastic.proto.Config, packetId: Int) {}
|
||||
override suspend fun setConfig(destNum: Int, config: Config, packetId: Int) {}
|
||||
|
||||
override suspend fun setModuleConfig(destNum: Int, config: org.meshtastic.proto.ModuleConfig, packetId: Int) {}
|
||||
override suspend fun setModuleConfig(destNum: Int, config: ModuleConfig, packetId: Int) {}
|
||||
|
||||
override suspend fun setRemoteChannel(destNum: Int, channel: org.meshtastic.proto.Channel, packetId: Int) {}
|
||||
override suspend fun setRemoteChannel(destNum: Int, channel: Channel, packetId: Int) {}
|
||||
|
||||
override suspend fun setFixedPosition(destNum: Int, position: org.meshtastic.core.model.Position) {}
|
||||
override suspend fun setFixedPosition(destNum: Int, position: Position) {}
|
||||
|
||||
override suspend fun setRingtone(destNum: Int, ringtone: String) {}
|
||||
|
||||
|
|
@ -125,7 +130,7 @@ class FakeRadioController :
|
|||
|
||||
override suspend fun removeByNodenum(packetId: Int, nodeNum: Int) {}
|
||||
|
||||
override suspend fun requestPosition(destNum: Int, currentPosition: org.meshtastic.core.model.Position) {}
|
||||
override suspend fun requestPosition(destNum: Int, currentPosition: Position) {}
|
||||
|
||||
override suspend fun requestUserInfo(destNum: Int) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class FakeRadioInterfaceService(override val serviceScope: CoroutineScope = Main
|
|||
val sentToRadio = mutableListOf<ByteArray>()
|
||||
var connectCalled = false
|
||||
|
||||
override fun isMockInterface(): Boolean = true
|
||||
override fun isMockTransport(): Boolean = true
|
||||
|
||||
override fun sendToRadio(bytes: ByteArray) {
|
||||
sentToRadio.add(bytes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue