kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
impl set owner/set radio
rodzic
85a0ea7286
commit
31a106039b
|
@ -1323,9 +1323,22 @@ class MeshService : Service(), Logging {
|
||||||
*/
|
*/
|
||||||
private fun sendRadioConfig(c: MeshProtos.RadioConfig) {
|
private fun sendRadioConfig(c: MeshProtos.RadioConfig) {
|
||||||
// Update our device
|
// Update our device
|
||||||
sendToRadio(ToRadio.newBuilder().apply {
|
val payload = AdminProtos.AdminMessage.newBuilder().also {
|
||||||
this.setRadio = c
|
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
|
// Update our cached copy
|
||||||
this@MeshService.radioConfig = c
|
this@MeshService.radioConfig = c
|
||||||
|
@ -1365,9 +1378,22 @@ class MeshService : Service(), Logging {
|
||||||
handleReceivedUser(myNode.myNodeNum, user)
|
handleReceivedUser(myNode.myNodeNum, user)
|
||||||
|
|
||||||
// set my owner info
|
// set my owner info
|
||||||
sendToRadio(ToRadio.newBuilder().apply {
|
val payload = AdminProtos.AdminMessage.newBuilder().also {
|
||||||
this.setOwner = user
|
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
|
} else
|
||||||
throw Exception("Can't set user without a node info") // this shouldn't happen
|
throw Exception("Can't set user without a node info") // this shouldn't happen
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 83e00e564d3973b594a46e786b62eed2823e02ed
|
Subproject commit 564b488695da6bee7bb9c4553872268595a0f77d
|
Ładowanie…
Reference in New Issue