kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
disable sim and switch back to protobuf lite
rodzic
27d0d2aa40
commit
9e83bfd790
4
TODO.md
4
TODO.md
|
@ -31,8 +31,6 @@
|
|||
* remove mixpanel analytics
|
||||
* require user auth to pair with the device (i.e. press button on device to allow a new phone to pair with it).
|
||||
Don't leave device discoverable. Don't let unpaired users do things with device
|
||||
* remove example code boilerplate from the service
|
||||
* switch from protobuf-java to protobuf-javalite - much faster and smaller, just no JSON debug printing
|
||||
* if the rxpacket queue on the device overflows (because android hasn't connected in a while) send a special packet to android which means 'X packets have been dropped because you were offline' -drop oldest packets first
|
||||
|
||||
# Low priority
|
||||
|
@ -69,3 +67,5 @@ Don't leave device discoverable. Don't let unpaired users do things with device
|
|||
* implement android side of mesh radio bluetooth link
|
||||
* use the lora net code on my current protoboard
|
||||
* investigate a 16 bit node number. If possible it would make collisions super rare. Much easier to just pick a nodenum and go.
|
||||
* remove example code boilerplate from the service
|
||||
* switch from protobuf-java to protobuf-javalite - much faster and smaller, just no JSON debug printing
|
||||
|
|
|
@ -54,7 +54,7 @@ protobuf {
|
|||
task.builtins {
|
||||
java {
|
||||
// turned off for now so I can use json printing
|
||||
// option "lite"
|
||||
option "lite"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,9 +74,9 @@ dependencies {
|
|||
|
||||
// You need to depend on the lite runtime library, not protobuf-java
|
||||
// For now I'm not using javalite, because I want JSON printing
|
||||
implementation 'com.google.protobuf:protobuf-java:3.11.1'
|
||||
implementation 'com.google.protobuf:protobuf-java-util:3.11.1'
|
||||
// implementation 'com.google.protobuf:protobuf-javalite:3.11.1'
|
||||
//implementation 'com.google.protobuf:protobuf-java:3.11.1'
|
||||
//implementation 'com.google.protobuf:protobuf-java-util:3.11.1'
|
||||
implementation 'com.google.protobuf:protobuf-javalite:3.11.1'
|
||||
|
||||
// You also need to include the following Compose toolkit dependencies.
|
||||
implementation("androidx.compose:compose-runtime:$compose_version")
|
||||
|
|
|
@ -8,11 +8,10 @@ import android.bluetooth.BluetoothManager
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import com.geeksville.android.DebugLogFile
|
||||
import com.geeksville.android.BinaryLogFile
|
||||
import com.geeksville.android.Logging
|
||||
import com.geeksville.concurrent.DeferredExecution
|
||||
import com.geeksville.util.toRemoteExceptions
|
||||
import com.google.protobuf.util.JsonFormat
|
||||
import java.util.*
|
||||
|
||||
/* Info for the esp32 device side code. See that source for the 'gold' standard docs on this interface.
|
||||
|
@ -138,10 +137,7 @@ class RadioInterfaceService : Service(), Logging {
|
|||
private lateinit var fromRadio: BluetoothGattCharacteristic
|
||||
private lateinit var fromNum: BluetoothGattCharacteristic
|
||||
|
||||
lateinit var sentPacketsLog: DebugLogFile // inited in onCreate
|
||||
|
||||
// for debug logging only
|
||||
private val jsonPrinter = JsonFormat.printer()
|
||||
lateinit var sentPacketsLog: BinaryLogFile // inited in onCreate
|
||||
|
||||
private var isConnected = false
|
||||
|
||||
|
@ -160,11 +156,12 @@ class RadioInterfaceService : Service(), Logging {
|
|||
private fun handleSendToRadio(p: ByteArray) {
|
||||
|
||||
// For debugging/logging purposes ONLY we convert back into a protobuf for readability
|
||||
val proto = MeshProtos.ToRadio.parseFrom(p)
|
||||
// al proto = MeshProtos.ToRadio.parseFrom(p)
|
||||
|
||||
val json = jsonPrinter.print(proto).replace('\n', ' ')
|
||||
info("TODO sending to radio: $json")
|
||||
sentPacketsLog.log(json)
|
||||
debug("sending to radio")
|
||||
doWrite(BTM_TORADIO_CHARACTER, p)
|
||||
sentPacketsLog.write(p)
|
||||
sentPacketsLog.flush()
|
||||
}
|
||||
|
||||
// Handle an incoming packet from the radio, broadcasts it as an android intent
|
||||
|
@ -242,7 +239,7 @@ class RadioInterfaceService : Service(), Logging {
|
|||
}
|
||||
}
|
||||
|
||||
sentPacketsLog = DebugLogFile(this, "sent_log.json")
|
||||
sentPacketsLog = BinaryLogFile(this, "sent_log.pb")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -301,7 +298,7 @@ class RadioInterfaceService : Service(), Logging {
|
|||
|
||||
override fun readMyNode() = doRead(BTM_MYNODE_CHARACTER)!!
|
||||
|
||||
override fun sendToRadio(a: ByteArray) = doWrite(BTM_TORADIO_CHARACTER, a)
|
||||
override fun sendToRadio(a: ByteArray) = handleSendToRadio(a)
|
||||
|
||||
override fun readRadioConfig() = doRead(BTM_RADIO_CHARACTER)!!
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue