diff --git a/app/build.gradle b/app/build.gradle
index 81a005e77..e83225dfd 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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 20109 // format is Mmmss (where M is 1+the numeric major number
- versionName "1.1.9"
+ versionCode 20120 // format is Mmmss (where M is 1+the numeric major number
+ versionName "1.1.20"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@@ -166,7 +166,7 @@ dependencies {
implementation 'com.google.android.gms:play-services-auth:19.0.0'
// Add the Firebase SDK for Crashlytics.
- implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
+ implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
// alas implementation bug deep in the bowels when I tried it for my SyncBluetoothDevice class
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5422c73bc..69e08be69 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -133,7 +133,7 @@
diff --git a/app/src/main/java/com/geeksville/mesh/DataPacket.kt b/app/src/main/java/com/geeksville/mesh/DataPacket.kt
index df8e3adfc..96ce62a21 100644
--- a/app/src/main/java/com/geeksville/mesh/DataPacket.kt
+++ b/app/src/main/java/com/geeksville/mesh/DataPacket.kt
@@ -22,7 +22,7 @@ enum class MessageStatus : Parcelable {
data class DataPacket(
var to: String? = ID_BROADCAST, // a nodeID string, or ID_BROADCAST for broadcast
val bytes: ByteArray?,
- val dataType: Int, // A value such as MeshProtos.Data.Type.OPAQUE_VALUE
+ val dataType: Int, // A port number for this packet (formerly called DataType, see portnums.proto for new usage instructions)
var from: String? = ID_LOCAL, // a nodeID string, or ID_LOCAL for localhost
var time: Long = System.currentTimeMillis(), // msecs since 1970
var id: Int = 0, // 0 means unassigned
@@ -39,14 +39,14 @@ data class DataPacket(
*/
constructor(to: String? = ID_BROADCAST, text: String) : this(
to, text.toByteArray(utf8),
- MeshProtos.Data.Type.CLEAR_TEXT_VALUE
+ Portnums.PortNum.TEXT_MESSAGE_APP_VALUE
)
/**
* If this is a text message, return the string, otherwise null
*/
val text: String?
- get() = if (dataType == MeshProtos.Data.Type.CLEAR_TEXT_VALUE)
+ get() = if (dataType == Portnums.PortNum.TEXT_MESSAGE_APP_VALUE)
bytes?.toString(utf8)
else
null
diff --git a/app/src/main/java/com/geeksville/mesh/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt
index ff77040c4..555a887e3 100644
--- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt
+++ b/app/src/main/java/com/geeksville/mesh/MainActivity.kt
@@ -324,14 +324,14 @@ class MainActivity : AppCompatActivity(), Logging,
DataPacket(
"+16508675310",
testPayload,
- MeshProtos.Data.Type.OPAQUE_VALUE
+ Portnums.PortNum.PRIVATE_APP_VALUE
)
)
m.send(
DataPacket(
"+16508675310",
testPayload,
- MeshProtos.Data.Type.CLEAR_TEXT_VALUE
+ Portnums.PortNum.TEXT_MESSAGE_APP_VALUE
)
)
}
@@ -707,7 +707,7 @@ class MainActivity : AppCompatActivity(), Logging,
intent.getParcelableExtra(EXTRA_PAYLOAD)!!
when (payload.dataType) {
- MeshProtos.Data.Type.CLEAR_TEXT_VALUE -> {
+ Portnums.PortNum.TEXT_MESSAGE_APP_VALUE -> {
model.messagesState.addMessage(payload)
}
else ->
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 0c54748b1..ef983d06d 100644
--- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt
+++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt
@@ -547,7 +547,7 @@ class MeshService : Service(), Logging {
to = toId,
time = rxTime * 1000L,
id = packet.id,
- dataType = data.typValue,
+ dataType = data.portnumValue,
bytes = bytes
)
}
@@ -558,7 +558,7 @@ class MeshService : Service(), Logging {
private fun toMeshPacket(p: DataPacket): MeshPacket {
return buildMeshPacket(p.to!!, id = p.id, wantAck = true) {
data = MeshProtos.Data.newBuilder().also {
- it.typ = MeshProtos.Data.Type.forNumber(p.dataType)
+ it.portnumValue = p.dataType
it.payload = ByteString.copyFrom(p.bytes)
}.build()
}
@@ -596,25 +596,33 @@ class MeshService : Service(), Logging {
dataPacket.status = MessageStatus.RECEIVED
rememberDataPacket(dataPacket)
- when (data.typValue) {
- MeshProtos.Data.Type.CLEAR_TEXT_VALUE -> {
+ when (data.portnumValue) {
+ Portnums.PortNum.TEXT_MESSAGE_APP_VALUE -> {
debug("Received CLEAR_TEXT from $fromId")
recentReceivedTextPacket = dataPacket
updateNotification()
- serviceBroadcasts.broadcastReceivedData(dataPacket)
}
- MeshProtos.Data.Type.CLEAR_READACK_VALUE ->
- warn(
- "TODO ignoring CLEAR_READACK from $fromId"
- )
+ // Handle new style position info
+ Portnums.PortNum.POSITION_APP_VALUE -> {
+ val rxTime = if (packet.rxTime != 0) packet.rxTime else currentSecond()
+ val u = MeshProtos.Position.parseFrom(data.payload)
+ handleReceivedPosition(packet.from, u, rxTime)
+ }
- MeshProtos.Data.Type.OPAQUE_VALUE ->
- serviceBroadcasts.broadcastReceivedData(dataPacket)
+ // Handle new style user info
+ Portnums.PortNum.NODEINFO_APP_VALUE -> {
+ val u = MeshProtos.User.parseFrom(data.payload)
+ handleReceivedUser(packet.from, u)
+ }
- else -> TODO()
- }
+ else -> {
+ debug("Received other data packet")
+ }}
+
+ // We always tell other apps when new data packets arrive
+ serviceBroadcasts.broadcastReceivedData(dataPacket)
GeeksvilleApplication.analytics.track(
"num_data_receive",
@@ -624,7 +632,7 @@ class MeshService : Service(), Logging {
GeeksvilleApplication.analytics.track(
"data_receive",
DataPair("num_bytes", bytes.size),
- DataPair("type", data.typValue)
+ DataPair("type", data.portnumValue)
)
}
}
diff --git a/app/src/main/proto b/app/src/main/proto
index a36b31a43..aac0044b2 160000
--- a/app/src/main/proto
+++ b/app/src/main/proto
@@ -1 +1 @@
-Subproject commit a36b31a43c53cab8e62ba04dfbb1fdcc9ecfe821
+Subproject commit aac0044b2dcca5daa86c6532c1d8c43475956d31
diff --git a/geeksville-androidlib b/geeksville-androidlib
index af1a758b0..534f0e192 160000
--- a/geeksville-androidlib
+++ b/geeksville-androidlib
@@ -1 +1 @@
-Subproject commit af1a758b0d4ed0b98e412d0aa03195d30f95127a
+Subproject commit 534f0e192bbbaaa6c32a981534b00451ed708ddc