move admin messages to nodes tab

This commit is contained in:
andrekir 2022-09-30 15:57:04 -03:00
parent a60013e2dd
commit b401c8bac3
9 changed files with 189 additions and 116 deletions

View file

@ -234,11 +234,6 @@ class UIViewModel @Inject constructor(
// We consider hasWifi = ESP32
fun isESP32() = myNodeInfo.value?.hasWifi == true
fun hasAXP(): Boolean {
val hasAXP = listOf(4, 7, 9) // mesh.proto 'HardwareModel' enums with AXP192 chip
return hasAXP.contains(nodeDB.ourNodeInfo?.user?.hwModel?.number)
}
/// hardware info about our local device (can be null)
private val _myNodeInfo = MutableLiveData<MyNodeInfo?>()
val myNodeInfo: LiveData<MyNodeInfo?> get() = _myNodeInfo
@ -357,16 +352,36 @@ class UIViewModel @Inject constructor(
}
}
fun requestShutdown() {
meshService?.requestShutdown(DataPacket.ID_LOCAL)
fun requestShutdown(idNum: Int) {
try {
meshService?.requestShutdown(idNum)
} catch (ex: RemoteException) {
errormsg("RemoteException: ${ex.message}")
}
}
fun requestReboot() {
meshService?.requestReboot(DataPacket.ID_LOCAL)
fun requestReboot(idNum: Int) {
try {
meshService?.requestReboot(idNum)
} catch (ex: RemoteException) {
errormsg("RemoteException: ${ex.message}")
}
}
fun requestFactoryReset() {
meshService?.requestFactoryReset(DataPacket.ID_LOCAL)
fun requestFactoryReset(idNum: Int) {
try {
meshService?.requestFactoryReset(idNum)
} catch (ex: RemoteException) {
errormsg("RemoteException: ${ex.message}")
}
}
fun requestNodedbReset(idNum: Int) {
try {
meshService?.requestNodedbReset(idNum)
} catch (ex: RemoteException) {
errormsg("RemoteException: ${ex.message}")
}
}
/**