kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
expose channel settings via an URL
rodzic
7cfcda2a30
commit
227450528d
10
TODO.md
10
TODO.md
|
@ -1,12 +1,14 @@
|
|||
# High priority
|
||||
MVP features required for first public alpha
|
||||
|
||||
* make chat pretty and functional
|
||||
* let user set name and shortname
|
||||
* take video
|
||||
|
||||
* stop scan when we start the service
|
||||
* set the radio by using the service
|
||||
* startforegroundservice only if we have a valid radio
|
||||
* if no radio is selected, launch app on the radio select screen
|
||||
* provide gps location for devices that don't have it
|
||||
* let user send texts
|
||||
* when we select a new radio, restart the service
|
||||
* show bt scan progress centered and towards the bottom of the screen
|
||||
|
@ -17,14 +19,12 @@ MVP features required for first public alpha
|
|||
* on onStop somehow stop the BT scan (to prevent burning battery)
|
||||
* add alphatest screen at boot
|
||||
* have the foreground service's notification show a summary of network status, add (individually maskable) notifications for received texts or new positions
|
||||
* prompt user to turnon bluetooth and bind
|
||||
* test bt boot behavior
|
||||
* fix BT device scanning - make a setup screen
|
||||
* when a text arrives, move that node info card to the bottom on the window - put the text to the left of the card. with a small arrow/distance/shortname
|
||||
* let the user type texts somewhere
|
||||
* include a background behind our cloud graphics, so redraws work properly
|
||||
* show direction and distance on the nodeinfo cards
|
||||
* show radio config screen, it shows past channels (and the current one)
|
||||
* use this for preferences? https://developer.android.com/guide/topics/ui/settings/
|
||||
* do setOwner every time we connect to the radio, use our settings, radio should ignore if unchanged
|
||||
* send location data for devices that don't have a GPS - https://developer.android.com/training/location/change-location-settings
|
||||
|
@ -122,4 +122,6 @@ Don't leave device discoverable. Don't let unpaired users do things with device
|
|||
* all chat in the app defaults to group chat
|
||||
* start bt receive on boot
|
||||
* warn user to bt pair
|
||||
* suppress logging output if running a release build (required for play store)
|
||||
* suppress logging output if running a release build (required for play store)
|
||||
* provide gps location for devices that don't have it
|
||||
* prompt user to turnon bluetooth and bind
|
|
@ -102,7 +102,7 @@
|
|||
<data
|
||||
android:scheme="http"
|
||||
android:host="www.meshtastic.org"
|
||||
android:pathPrefix="/s" />
|
||||
android:pathPrefix="/c/" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.geeksville.mesh.service.*
|
|||
import com.geeksville.mesh.ui.MeshApp
|
||||
import com.geeksville.mesh.ui.TextMessage
|
||||
import com.geeksville.mesh.ui.UIState
|
||||
import com.geeksville.mesh.ui.getInitials
|
||||
import com.geeksville.util.exceptionReporter
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
|
||||
|
@ -152,7 +153,8 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
|
||||
private fun setOwner() {
|
||||
// Note: we are careful to not set a new unique ID
|
||||
meshService!!.setOwner(null, "Kevin Xter", "kx")
|
||||
val name = UIState.ownerName.value
|
||||
meshService!!.setOwner(null, name, getInitials(name))
|
||||
}
|
||||
|
||||
private fun sendTestPackets() {
|
||||
|
@ -263,12 +265,25 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
}
|
||||
}
|
||||
|
||||
/// Read the config bytes from the radio so we can show them in our GUI, the radio's copy is ground truth
|
||||
private fun readRadioConfig() {
|
||||
val bytes = meshService!!.radioConfig
|
||||
|
||||
val config = MeshProtos.RadioConfig.parseFrom(bytes)
|
||||
UIState.radioConfig.value = config
|
||||
|
||||
debug("Read config from radio, channel URL ${UIState.channelUrl}")
|
||||
}
|
||||
|
||||
/// Called when we gain/lose a connection to our mesh radio
|
||||
private fun onMeshConnectionChanged(connected: Boolean) {
|
||||
UIState.isConnected.value = connected
|
||||
debug("connchange ${UIState.isConnected.value}")
|
||||
if (connected) {
|
||||
// everytime the radio reconnects, we slam in our current owner data
|
||||
// always get the current radio config when we connect
|
||||
readRadioConfig()
|
||||
|
||||
// everytime the radio reconnects, we slam in our current owner data, the radio is smart enough to only broadcast if needed
|
||||
setOwner()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.util.Base64
|
||||
import androidx.compose.Model
|
||||
import androidx.compose.mutableStateOf
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
import com.geeksville.mesh.MeshUser
|
||||
import com.geeksville.mesh.NodeInfo
|
||||
import com.geeksville.mesh.Position
|
||||
|
@ -72,8 +74,23 @@ object UIState {
|
|||
val messages = mutableStateOf(testTexts)
|
||||
|
||||
/// Are we connected to our radio device
|
||||
var isConnected = mutableStateOf(false)
|
||||
val isConnected = mutableStateOf(false)
|
||||
|
||||
/// various radio settings (including the channel)
|
||||
val radioConfig = mutableStateOf(MeshProtos.RadioConfig.getDefaultInstance())
|
||||
|
||||
/// our name in hte radio
|
||||
/// Note, we generate owner initials automatically for now
|
||||
val ownerName = mutableStateOf("fixme readfromprefs")
|
||||
|
||||
/// Return an URL that represents the current channel values
|
||||
val channelUrl
|
||||
get(): String {
|
||||
val channelBytes = radioConfig.value.channelSettings.toByteArray()
|
||||
val enc = Base64.encodeToString(channelBytes, Base64.URL_SAFE + Base64.NO_WRAP)
|
||||
|
||||
return "https://www.meshtastic.org/c/$enc"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue