diff --git a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl index a73a9a14..4efffd93 100644 --- a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl +++ b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl @@ -168,4 +168,7 @@ interface IMeshService { /// Stop providing location (from phone GPS) to mesh void stopProvideLocation(); + + /// Send request for node UserInfo + void requestUserInfo(in int destNum); } diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt index 50bebf72..60c90ca3 100644 --- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt +++ b/app/src/main/java/com/geeksville/mesh/model/UIState.kt @@ -58,10 +58,10 @@ import java.util.concurrent.TimeUnit import javax.inject.Inject import kotlin.math.roundToInt -/// Given a human name, strip out the first letter of the first three words and return that as the initials for -/// that user. If the original name is only one word, strip vowels from the original name and if the result is -/// 3 or more characters, use the first three characters. If not, just take the first 3 characters of the -/// original name. +// / Given a human name, strip out the first letter of the first three words and return that as the initials for +// / that user. If the original name is only one word, strip vowels from the original name and if the result is +// / 3 or more characters, use the first three characters. If not, just take the first 3 characters of the +// / original name. fun getInitials(nameIn: String): String { val nchars = 4 val minchars = 2 @@ -411,6 +411,15 @@ class UIViewModel @Inject constructor( } } + fun requestUserInfo(destNum: Int) { + info("Requesting UserInfo for '$destNum'") + try { + meshService?.requestUserInfo( destNum ) + } catch (ex: RemoteException) { + errormsg("Request NodeInfo error: ${ex.message}") + } + } + fun requestPosition(destNum: Int, position: Position = Position(0.0, 0.0, 0)) { info("Requesting position for '$destNum'") try { 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 bbecf112..a2cdab6c 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -1928,7 +1928,18 @@ class MeshService : Service(), Logging { removeByNodenum = nodeNum }) } - + override fun requestUserInfo( destNum: Int ) = toRemoteExceptions { + if (destNum != myNodeNum) { + sendToRadio(newMeshPacketTo(destNum + ).buildMeshPacket( + channel = nodeDBbyNodeNum[destNum]?.channel ?: 0 + ) { + portnumValue = Portnums.PortNum.NODEINFO_APP_VALUE + wantResponse = true + payload = nodeDBbyNodeNum[myNodeNum]!!.user.toByteString() + }) + } + } override fun requestPosition(destNum: Int, position: Position) = toRemoteExceptions { sendToRadio(newMeshPacketTo(destNum).buildMeshPacket( channel = nodeDBbyNodeNum[destNum]?.channel ?: 0, diff --git a/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt index bcb9bb21..5847bf75 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/UsersFragment.kt @@ -85,6 +85,10 @@ class UsersFragment : ScreenFragment("Users"), Logging { R.id.metrics -> { navigateToMetrics(node.num) } + + R.id.request_userinfo -> { + model.requestUserInfo(node.num) + } } } } diff --git a/app/src/main/res/menu/menu_nodes.xml b/app/src/main/res/menu/menu_nodes.xml index 345fdd5e..3de66d8d 100644 --- a/app/src/main/res/menu/menu_nodes.xml +++ b/app/src/main/res/menu/menu_nodes.xml @@ -6,6 +6,10 @@ android:id="@+id/direct_message" android:title="@string/direct_message" app:showAsAction="withText" /> + Direct messages are using the new public key infrastructure for encryption. Requires firmware version 2.5 or greater. Public key mismatch The public key does not match the recorded key. You may remove the node and let it exchange keys again, but this may indicate a more serious security problem. Contact the user through another trusted channel, to determine if the key change was due to a factory reset or other intentional action. + Request user info