kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
add network ping testing
rodzic
b9848c458c
commit
637c37bc9b
2
TODO.md
2
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
# High priority
|
# High priority
|
||||||
MVP features required for first public alpha
|
MVP features required for first public alpha
|
||||||
|
|
||||||
|
* make a boot screen explaining this is an early alpha
|
||||||
* describe user experience: devices always point to each other and show distance, you can send texts between nodes
|
* describe user experience: devices always point to each other and show distance, you can send texts between nodes
|
||||||
the channel is encrypted, you can share the the channel key with others by qr code or by sharing a special link
|
the channel is encrypted, you can share the the channel key with others by qr code or by sharing a special link
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ Do this "Signal app compatible" release relatively soon after the alpha release
|
||||||
# Medium priority
|
# Medium priority
|
||||||
Things for the betaish period.
|
Things for the betaish period.
|
||||||
|
|
||||||
|
* Use LocationRequest.setSmallestDisplacement to save battery and decrease net activity
|
||||||
* MeshService.reinitFromRadio can take 300 ms, run it in a worker thread instead
|
* MeshService.reinitFromRadio can take 300 ms, run it in a worker thread instead
|
||||||
* show user icons in chat
|
* show user icons in chat
|
||||||
* keep past messages in db, one db per channel
|
* keep past messages in db, one db per channel
|
||||||
|
|
|
@ -106,6 +106,8 @@ class MeshService : Service(), Logging {
|
||||||
}
|
}
|
||||||
|
|
||||||
private val locationCallback = object : LocationCallback() {
|
private val locationCallback = object : LocationCallback() {
|
||||||
|
private var lastSendMsec = 0L
|
||||||
|
|
||||||
override fun onLocationResult(locationResult: LocationResult) {
|
override fun onLocationResult(locationResult: LocationResult) {
|
||||||
super.onLocationResult(locationResult)
|
super.onLocationResult(locationResult)
|
||||||
var l = locationResult.lastLocation
|
var l = locationResult.lastLocation
|
||||||
|
@ -122,7 +124,17 @@ class MeshService : Service(), Logging {
|
||||||
if (l.hasAccuracy() && l.accuracy >= 200) // if more than 200 meters off we won't use it
|
if (l.hasAccuracy() && l.accuracy >= 200) // if more than 200 meters off we won't use it
|
||||||
warn("accuracy ${l.accuracy} is too poor to use")
|
warn("accuracy ${l.accuracy} is too poor to use")
|
||||||
else {
|
else {
|
||||||
sendPosition(l.latitude, l.longitude, l.altitude.toInt())
|
val now = System.currentTimeMillis()
|
||||||
|
|
||||||
|
// we limit our sends onto the lora net to a max one once every FIXME
|
||||||
|
val sendLora = (now - lastSendMsec >= 30 * 1000)
|
||||||
|
if (sendLora)
|
||||||
|
lastSendMsec = now
|
||||||
|
sendPosition(
|
||||||
|
l.latitude, l.longitude, l.altitude.toInt(),
|
||||||
|
destNum = if (sendLora) NODENUM_BROADCAST else myNodeNum,
|
||||||
|
wantResponse = sendLora
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,10 +700,14 @@ class MeshService : Service(), Logging {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send a position (typically from our built in GPS) into the mesh
|
/// Send a position (typically from our built in GPS) into the mesh
|
||||||
private fun sendPosition(lat: Double, lon: Double, alt: Int) {
|
private fun sendPosition(
|
||||||
debug("Sending our position into mesh lat=$lat, lon=$lon, alt=$alt")
|
lat: Double,
|
||||||
|
lon: Double,
|
||||||
val destNum = NODENUM_BROADCAST
|
alt: Int,
|
||||||
|
destNum: Int = NODENUM_BROADCAST,
|
||||||
|
wantResponse: Boolean = false
|
||||||
|
) {
|
||||||
|
debug("Sending our position to=$destNum lat=$lat, lon=$lon, alt=$alt")
|
||||||
|
|
||||||
val position = MeshProtos.Position.newBuilder().also {
|
val position = MeshProtos.Position.newBuilder().also {
|
||||||
it.latitude = lat
|
it.latitude = lat
|
||||||
|
@ -705,6 +721,7 @@ class MeshService : Service(), Logging {
|
||||||
|
|
||||||
packet.payload = MeshProtos.SubPacket.newBuilder().also {
|
packet.payload = MeshProtos.SubPacket.newBuilder().also {
|
||||||
it.position = position
|
it.position = position
|
||||||
|
it.wantResponse = wantResponse
|
||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
// Also update our own map for our nodenum, by handling the packet just like packets from other users
|
// Also update our own map for our nodenum, by handling the packet just like packets from other users
|
||||||
|
|
|
@ -122,6 +122,10 @@ message SubPacket {
|
||||||
Data data = 3;
|
Data data = 3;
|
||||||
User user = 4;
|
User user = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Not normally used, but for testing a sender can request that recipient responds in kind (i.e. if it received a position, it should unicast back its position).
|
||||||
|
// Note: that if you set this on a broadcast you will receive many replies.
|
||||||
|
bool want_response = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: For simplicity reasons (and that we want to keep over the radio packets very small, we now assume that there is only _one_
|
// Note: For simplicity reasons (and that we want to keep over the radio packets very small, we now assume that there is only _one_
|
||||||
|
|
Ładowanie…
Reference in New Issue