add option to request remote nodes position

This commit is contained in:
andrekir 2022-11-06 17:46:57 -03:00
parent 8a03603ef8
commit 6894883362
6 changed files with 43 additions and 13 deletions

View file

@ -152,10 +152,6 @@ class UIViewModel @Inject constructor(
fun sendMessage(str: String, channel: Int = 0, dest: String = DataPacket.ID_BROADCAST) {
val p = DataPacket(dest, channel, str)
sendDataPacket(p)
}
fun sendDataPacket(p: DataPacket) {
try {
meshService?.send(p)
} catch (ex: RemoteException) {
@ -163,6 +159,14 @@ class UIViewModel @Inject constructor(
}
}
fun requestPosition(destNum: Int) {
try {
meshService?.requestPosition(destNum)
} catch (ex: RemoteException) {
errormsg("Request position error: ${ex.message}")
}
}
fun deleteAllLogs() = viewModelScope.launch(Dispatchers.IO) {
meshLogRepository.deleteAll()
}