feat: add getChannelSet method to IMeshService

pull/593/head
andrekir 2023-02-20 21:48:55 -03:00
rodzic 967e4634a8
commit 566fdd3344
2 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -116,6 +116,9 @@ interface IMeshService {
/// Send NodedbReset admin packet to nodeNum
void requestNodedbReset(in int idNum);
/// Returns a ChannelSet protobuf
byte []getChannelSet();
/**
Is the packet radio currently connected to the phone? Returns a ConnectionState string.
*/

Wyświetl plik

@ -252,6 +252,8 @@ class MeshService : Service(), Logging {
.launchIn(serviceScope)
localConfigRepository.localConfigFlow.onEach { localConfig = it }
.launchIn(serviceScope)
channelSetRepository.channelSetFlow.onEach { channelSet = it }
.launchIn(serviceScope)
// the rest of our init will happen once we are in radioConnection.onServiceConnected
}
@ -364,6 +366,7 @@ class MeshService : Service(), Logging {
var myNodeInfo: MyNodeInfo? = null
private var localConfig: LocalConfig = LocalConfig.getDefaultInstance()
private var channelSet: AppOnlyProtos.ChannelSet = AppOnlyProtos.ChannelSet.getDefaultInstance()
/// True after we've done our initial node db init
@Volatile
@ -1721,6 +1724,10 @@ class MeshService : Service(), Logging {
})
}
override fun getChannelSet(): ByteArray = toRemoteExceptions {
this@MeshService.channelSet.toByteArray()
}
override fun getNodes(): MutableList<NodeInfo> = toRemoteExceptions {
val r = nodeDBbyID.values.toMutableList()
info("in getOnline, count=${r.size}")