impl set owner/set radio

1.2-legacy
Kevin Hester 2021-02-27 11:13:30 +08:00
rodzic 85a0ea7286
commit 31a106039b
2 zmienionych plików z 33 dodań i 7 usunięć

Wyświetl plik

@ -1323,9 +1323,22 @@ class MeshService : Service(), Logging {
*/
private fun sendRadioConfig(c: MeshProtos.RadioConfig) {
// Update our device
sendToRadio(ToRadio.newBuilder().apply {
this.setRadio = c
})
val payload = AdminProtos.AdminMessage.newBuilder().also {
it.setRadio = c
}.build()
// encapsulate our payload in the proper protobufs and fire it off
val packet = newMeshPacketTo(myNodeNum)
packet.decoded = MeshProtos.Data.newBuilder().also {
// Use the new position as data format
it.portnumValue = Portnums.PortNum.ADMIN_APP_VALUE
it.payload = payload.toByteString()
}.build()
// send the packet into the mesh
sendToRadio(packet.build())
// Update our cached copy
this@MeshService.radioConfig = c
@ -1365,9 +1378,22 @@ class MeshService : Service(), Logging {
handleReceivedUser(myNode.myNodeNum, user)
// set my owner info
sendToRadio(ToRadio.newBuilder().apply {
this.setOwner = user
})
val payload = AdminProtos.AdminMessage.newBuilder().also {
it.setOwner = user
}.build()
// encapsulate our payload in the proper protobufs and fire it off
val packet = newMeshPacketTo(myNodeNum)
packet.decoded = MeshProtos.Data.newBuilder().also {
// Use the new position as data format
it.portnumValue = Portnums.PortNum.ADMIN_APP_VALUE
it.payload = payload.toByteString()
}.build()
// send the packet into the mesh
sendToRadio(packet.build())
}
} else
throw Exception("Can't set user without a node info") // this shouldn't happen

@ -1 +1 @@
Subproject commit 83e00e564d3973b594a46e786b62eed2823e02ed
Subproject commit 564b488695da6bee7bb9c4553872268595a0f77d