This commit is contained in:
geeksville 2020-01-27 16:58:47 -08:00
parent 456014dd5f
commit d2f6156841
4 changed files with 46 additions and 18 deletions

View file

@ -120,6 +120,27 @@ class MainActivity : AppCompatActivity(), Logging {
)
}
})
Button(text = "send packets",
onClick = {
// FIXME - don't do these operations until we are informed we have a connection, otherwise
// the radio interface service might not yet be connected to the mesh service
val m = meshService!!
// Do some test operations
m.setOwner("+16508675309", "Kevin Xter", "kx")
val testPayload = "hello world".toByteArray()
m.sendData(
"+16508675310",
testPayload,
MeshProtos.Data.Type.SIGNAL_OPAQUE_VALUE
)
m.sendData(
"+16508675310",
testPayload,
MeshProtos.Data.Type.CLEAR_TEXT_VALUE
)
})
}
}
}
@ -157,15 +178,6 @@ class MainActivity : AppCompatActivity(), Logging {
val m = IMeshService.Stub.asInterface(service)
meshService = m
// FIXME - don't do these operations until we are informed we have a connection, otherwise
// the radio interface service might not yet be connected to the mesh service
// Do some test operations
m.setOwner("+16508675309", "Kevin Xter", "kx")
val testPayload = "hello world".toByteArray()
m.sendData("+16508675310", testPayload, MeshProtos.Data.Type.SIGNAL_OPAQUE_VALUE)
m.sendData("+16508675310", testPayload, MeshProtos.Data.Type.CLEAR_TEXT_VALUE)
// FIXME this doesn't work because the model has already been copied into compose land?
// runOnUiThread { // FIXME - this can be removed?
meshServiceState.connected = m.isConnected