From 6306d19f6dfc5873df135a4ccf7bad8863805a02 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 29 Jul 2020 15:48:21 -0700 Subject: [PATCH 1/3] low memory samsung phones that have lots of boot receiver can run real slow Thus exposing the google startup bug: https://issuetracker.google.com/issues/76112072#comment56 https://console.firebase.google.com/u/0/project/meshutil/crashlytics/app/android:com.geeksville.mesh/issues/78d68909d65bf62fa9d4d3b5b42cddc6?time=last-seven-days&sessionId=5F203DB903DC000146028E3DAF71631D_DNE_0_v2 --- .../main/java/com/geeksville/mesh/service/MeshService.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index 819f9b592..ef0d4a683 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -97,10 +97,10 @@ class MeshService : Service(), Logging { */ fun startLater(context: Context) { // No point in even starting the service if the user doesn't have a device bonded - info("Received boot complete announcement, starting mesh service in one minute") + info("Received boot complete announcement, starting mesh service in two minutes") val delayRequest = OneTimeWorkRequestBuilder() - .setInitialDelay(1, TimeUnit.MINUTES) - .setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 1, TimeUnit.MINUTES) + .setInitialDelay(2, TimeUnit.MINUTES) + .setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 2, TimeUnit.MINUTES) .addTag("startLater") .build() From f3be13f0fbd6bda94d6479e5b5b1be2ae4eb2ceb Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 29 Jul 2020 16:16:29 -0700 Subject: [PATCH 2/3] don't leak macaddrs into logs --- app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt index 284ca7f80..af7269367 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -69,7 +69,7 @@ private fun requestBonding( device: BluetoothDevice, onComplete: (Int) -> Unit ) { - SLogging.info("Starting bonding for $device") + SLogging.info("Starting bonding for ${device.anonymize}") // We need this receiver to get informed when the bond attempt finished val bondChangedReceiver = object : BroadcastReceiver() { From 617655b8f78b2870404707de6814b85eb7365b0f Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 11 Aug 2020 19:31:57 -0700 Subject: [PATCH 3/3] improve API docs --- .../com/geeksville/mesh/IMeshService.aidl | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl index c8c5d09e7..bf13bc7aa 100644 --- a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl +++ b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl @@ -7,7 +7,30 @@ parcelable NodeInfo; parcelable MyNodeInfo; /** -* Note - these calls might throw RemoteException to indicate mesh error states +This is the public android API for talking to meshtastic radios. + +To connect to meshtastic you should bind to it per https://developer.android.com/guide/components/bound-services + +The intent you use to reach the service should look like this: + + val intent = Intent().apply { + setClassName( + "com.geeksville.mesh", + "com.geeksville.mesh.service.MeshService" + ) + } + +Once you have bound to the service you should register your broadcast receivers per https://developer.android.com/guide/components/broadcasts#context-registered-receivers + + // com.geeksville.com.geeksville.mesh.x broadcast intents, where x is: + // RECEIVED_DATA for data received from other nodes. payload will contain a DataPacket + // NODE_CHANGE for new IDs appearing or disappearing + // CONNECTION_CHANGED for losing/gaining connection to the packet radio + // MESSAGE_STATUS_CHANGED for any message status changes (for sent messages only, other messages come via RECEIVED_DATA. payload will contain a message ID and a MessageStatus) + +At the very least you will probably want to receive RECEIVED_DATA. + +Note - these calls might throw RemoteException to indicate mesh error states */ interface IMeshService { /// Tell the service where to send its broadcasts of received packets @@ -76,11 +99,4 @@ interface IMeshService { Return a number 0-100 for progress. -1 for completed and success, -2 for failure */ int getUpdateStatus(); - - // see com.geeksville.com.geeksville.mesh broadcast intents - // RECEIVED_DATA for data received from other nodes. payload will contain a DataPacket - // NODE_CHANGE for new IDs appearing or disappearing - // CONNECTION_CHANGED for losing/gaining connection to the packet radio - // MESSAGE_STATUS_CHANGED for any message status changes (for sent messages only, other messages come via RECEIVED_DATA. payload will contain a message ID and a MessageStatus) - }