kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
progress on file debug logs
rodzic
559795b796
commit
b6166fbd33
|
@ -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" />
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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")
|
||||
|
|
Ładowanie…
Reference in New Issue