mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
provide current ID to service consumers
This commit is contained in:
parent
0f1a19aeae
commit
ccdca3b146
2 changed files with 12 additions and 1 deletions
|
|
@ -21,6 +21,9 @@ interface IMeshService {
|
|||
*/
|
||||
void setOwner(String myId, String longName, String shortName);
|
||||
|
||||
/// Return my unique user ID string
|
||||
String getMyId();
|
||||
|
||||
/*
|
||||
Send an opaque packet to a specified node name
|
||||
|
||||
|
|
|
|||
|
|
@ -403,12 +403,18 @@ class MeshService : Service(), Logging {
|
|||
broadcastNodeChange(info)
|
||||
}
|
||||
|
||||
/// My node num
|
||||
private val myNodeNum get() = myNodeInfo!!.myNodeNum
|
||||
|
||||
/// My node ID string
|
||||
private val myNodeID get() = toNodeID(myNodeNum)
|
||||
|
||||
/// Generate a new mesh packet builder with our node as the sender, and the specified node num
|
||||
private fun newMeshPacketTo(idNum: Int) = MeshPacket.newBuilder().apply {
|
||||
if (myNodeInfo == null)
|
||||
throw RadioNotConnectedException()
|
||||
|
||||
from = myNodeInfo!!.myNodeNum
|
||||
from = myNodeNum
|
||||
to = idNum
|
||||
}
|
||||
|
||||
|
|
@ -659,6 +665,8 @@ class MeshService : Service(), Logging {
|
|||
clientPackages[receiverName] = packageName
|
||||
}
|
||||
|
||||
override fun getMyId() = toRemoteExceptions { myNodeID }
|
||||
|
||||
override fun setOwner(myId: String?, longName: String, shortName: String) =
|
||||
toRemoteExceptions {
|
||||
debug("SetOwner $myId : $longName : $shortName")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue