progress on file debug logs

pull/8/head
geeksville 2020-01-24 17:47:32 -08:00
rodzic 559795b796
commit b6166fbd33
3 zmienionych plików z 18 dodań i 2 usunięć

Wyświetl plik

@ -24,6 +24,9 @@
-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Only for debug log writing, disable for production FIXME -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="true" />

Wyświetl plik

@ -57,7 +57,8 @@ class MainActivity : AppCompatActivity(), Logging {
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.BLUETOOTH,
Manifest.permission.BLUETOOTH_ADMIN,
Manifest.permission.WAKE_LOCK
Manifest.permission.WAKE_LOCK,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
val missingPerms = perms.filter {

Wyświetl plik

@ -3,6 +3,7 @@ package com.geeksville.mesh
import android.content.Context
import android.content.Intent
import androidx.core.app.JobIntentService
import com.geeksville.android.DebugLogFile
import com.geeksville.android.Logging
const val EXTRA_CONNECTED = "$prefix.Connected"
@ -59,6 +60,8 @@ class RadioInterfaceService : JobIntentService(), Logging {
}
}
val sentPacketsLog = DebugLogFile(this, "sent_log.json")
private fun broadcastReceivedFromRadio(payload: ByteArray) {
val intent = Intent(RECEIVE_FROMRADIO_ACTION)
intent.putExtra("$prefix.Payload", payload)
@ -73,7 +76,11 @@ class RadioInterfaceService : JobIntentService(), Logging {
/// Send a packet/command out the radio link
private fun sendToRadio(p: ByteArray) {
info("Simulating sending to radio size=$p.size")
// For debugging/logging purposes ONLY we convert back into a protobuf for readability
val proto = MeshProtos.ToRadio.parseFrom(p)
info("TODO sending to radio: $proto")
sentPacketsLog.log("FIXME JSON")
}
// Handle an incoming packet from the radio, broadcasts it as an android intent
@ -81,6 +88,11 @@ class RadioInterfaceService : JobIntentService(), Logging {
broadcastReceivedFromRadio(p)
}
override fun onDestroy() {
sentPacketsLog.close()
super.onDestroy()
}
override fun onHandleWork(intent: Intent) { // We have received work to do. The system or framework is already
// holding a wake lock for us at this point, so we can just go.
debug("Executing work: $intent")