mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
commit
026f80c5e1
10 changed files with 76 additions and 32 deletions
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
|
|
@ -26,5 +26,10 @@
|
|||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://jitpack.io" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="maven" />
|
||||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://api.mapbox.com/downloads/v2/releases/maven" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -30,8 +30,8 @@ android {
|
|||
applicationId "com.geeksville.mesh"
|
||||
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
|
||||
targetSdkVersion 29
|
||||
versionCode 20120 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "1.1.20"
|
||||
versionCode 20122 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "1.1.22"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
|
@ -152,7 +152,7 @@ dependencies {
|
|||
implementation 'com.github.mik3y:usb-serial-for-android:v3.0.0'
|
||||
|
||||
// mapbox
|
||||
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1'
|
||||
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0'
|
||||
|
||||
// mapbox specifies a really old version of okhttp3 which causes lots of API warnings. trying a newer version
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||
|
|
|
|||
|
|
@ -715,7 +715,7 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
model.messagesState.addMessage(payload)
|
||||
}
|
||||
else ->
|
||||
errormsg("Unhandled dataType ${payload.dataType}")
|
||||
warn("Ignored dataType ${payload.dataType}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -798,8 +798,8 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
// We don't start listening for packets until after we are connected to the service
|
||||
registerMeshReceiver()
|
||||
|
||||
// Init our messages table with the service's record of past text messages
|
||||
val msgs = service.oldMessages
|
||||
// Init our messages table with the service's record of past text messages (ignore all other message types)
|
||||
val msgs = service.oldMessages.filter { p -> p.dataType == Portnums.PortNum.TEXT_MESSAGE_APP_VALUE }
|
||||
debug("Service provided ${msgs.size} messages")
|
||||
model.messagesState.setMessages(msgs)
|
||||
val connectionState =
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import android.graphics.Bitmap
|
|||
import android.net.Uri
|
||||
import android.util.Base64
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
import com.google.protobuf.ByteString
|
||||
import com.google.zxing.BarcodeFormat
|
||||
import com.google.zxing.MultiFormatWriter
|
||||
import com.journeyapps.barcodescanner.BarcodeEncoder
|
||||
|
|
@ -52,9 +53,26 @@ data class Channel(
|
|||
|
||||
constructor(url: Uri) : this(urlToSettings(url))
|
||||
|
||||
val name: String get() = settings.name
|
||||
/// Return the name of our channel as a human readable string. If empty string, assume "Default" per mesh.proto spec
|
||||
val name: String get() = if(settings.name.isEmpty()) defaultChannelName else settings.name
|
||||
val modemConfig: MeshProtos.ChannelSettings.ModemConfig get() = settings.modemConfig
|
||||
|
||||
val psk get() = if(settings.psk.size() != 1)
|
||||
settings.psk // A standard PSK
|
||||
else {
|
||||
// One of our special 1 byte PSKs, see mesh.proto for docs.
|
||||
val pskIndex = settings.psk.byteAt(0).toInt()
|
||||
|
||||
if(pskIndex == 0)
|
||||
ByteString.EMPTY // Treat as an empty PSK (no encryption)
|
||||
else {
|
||||
// Treat an index of 1 as the old channelDefaultKey and work up from there
|
||||
val bytes = channelDefaultKey.clone()
|
||||
bytes[bytes.size - 1] = (0xff and (bytes[bytes.size - 1] + pskIndex - 1)).toByte()
|
||||
ByteString.copyFrom(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a name that is formatted as #channename-suffix
|
||||
*
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ class MeshService : Service(), Logging {
|
|||
if (dataPacket != null) {
|
||||
|
||||
if (myInfo.myNodeNum == packet.from)
|
||||
debug("Ignoring retransmission of our packet ${bytes.size}")
|
||||
debug("Ignoring packet sent from our node")
|
||||
else {
|
||||
debug("Received data from $fromId, portnum=${data.portnumValue} ${bytes.size} bytes")
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,10 @@ class RadioInterfaceService : Service(), Logging {
|
|||
var address = prefs.getString(DEVADDR_KEY, null)
|
||||
|
||||
if (address == null) { /// Check for the old preferences name we used to use
|
||||
val rest = prefs.getString(DEVADDR_KEY_OLD, null)
|
||||
var rest = prefs.getString(DEVADDR_KEY_OLD, null)
|
||||
if(rest == "null")
|
||||
rest = null
|
||||
|
||||
if (rest != null)
|
||||
address = "x$rest" // Add the bluetooth prefix
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
open class DeviceListEntry(val name: String, val address: String, val bonded: Boolean) {
|
||||
val bluetoothAddress
|
||||
get() =
|
||||
if (address[0] == 'x')
|
||||
if (isBluetooth)
|
||||
address.substring(1)
|
||||
else
|
||||
null
|
||||
|
|
@ -367,27 +367,30 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
// Handle requestng USB or bluetooth permissions for the device
|
||||
debug("Requesting permissions for the device")
|
||||
|
||||
if (it.isBluetooth) {
|
||||
// Request bonding for bluetooth
|
||||
// We ignore missing BT adapters, because it lets us run on the emulator
|
||||
bluetoothAdapter
|
||||
?.getRemoteDevice(it.bluetoothAddress)?.let { device ->
|
||||
requestBonding(activity, device) { state ->
|
||||
if (state == BOND_BONDED) {
|
||||
errorText.value = activity.getString(R.string.pairing_completed)
|
||||
changeScanSelection(
|
||||
activity,
|
||||
it.address
|
||||
)
|
||||
} else {
|
||||
errorText.value =
|
||||
activity.getString(R.string.pairing_failed_try_again)
|
||||
}
|
||||
exceptionReporter {
|
||||
val bleAddress = it.bluetoothAddress
|
||||
if (bleAddress != null) {
|
||||
// Request bonding for bluetooth
|
||||
// We ignore missing BT adapters, because it lets us run on the emulator
|
||||
bluetoothAdapter
|
||||
?.getRemoteDevice(bleAddress)?.let { device ->
|
||||
requestBonding(activity, device) { state ->
|
||||
if (state == BOND_BONDED) {
|
||||
errorText.value = activity.getString(R.string.pairing_completed)
|
||||
changeScanSelection(
|
||||
activity,
|
||||
it.address
|
||||
)
|
||||
} else {
|
||||
errorText.value =
|
||||
activity.getString(R.string.pairing_failed_try_again)
|
||||
}
|
||||
|
||||
// Force the GUI to redraw
|
||||
devices.value = devices.value
|
||||
// Force the GUI to redraw
|
||||
devices.value = devices.value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (it.isSerial) {
|
||||
|
|
@ -453,6 +456,7 @@ class BTScanModel(app: Application) : AndroidViewModel(app), Logging {
|
|||
class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
|
||||
private var _binding: SettingsFragmentBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit aac0044b2dcca5daa86c6532c1d8c43475956d31
|
||||
Subproject commit 8729bad7f6cfa461be02e3ea65fbde29435b3fe3
|
||||
16
build.gradle
16
build.gradle
|
|
@ -1,7 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.4.20'
|
||||
ext.kotlin_version = '1.4.21'
|
||||
ext.coroutines_version = "1.3.9"
|
||||
|
||||
repositories {
|
||||
|
|
@ -33,6 +33,20 @@ buildscript {
|
|||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven {
|
||||
// Per https://docs.mapbox.com/android/maps/guides/install/ we now need to signin to download mapbox lib
|
||||
url 'https://api.mapbox.com/downloads/v2/releases/maven'
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
credentials {
|
||||
// Do not change the username below.
|
||||
// This should always be `mapbox` (not your username).
|
||||
username = 'mapbox'
|
||||
// Use the secret token you stored in gradle.properties as the password
|
||||
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
|
||||
}
|
||||
}
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 534f0e192bbbaaa6c32a981534b00451ed708ddc
|
||||
Subproject commit eeeab655618ea3e978caa1ed5fdfb9b68a503d38
|
||||
Loading…
Add table
Add a link
Reference in a new issue