mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
handle missing contactKey digit
This commit is contained in:
parent
9e5cffbfb1
commit
1e95c200e6
2 changed files with 9 additions and 14 deletions
|
|
@ -159,8 +159,12 @@ class UIViewModel @Inject constructor(
|
|||
.filter { it.value.port_num == Portnums.PortNum.WAYPOINT_APP_VALUE }
|
||||
}.asLiveData()
|
||||
|
||||
fun sendMessage(str: String, channel: Int = 0, dest: String = DataPacket.ID_BROADCAST) {
|
||||
val p = DataPacket(dest, channel, str)
|
||||
fun sendMessage(str: String, contactKey: String = "0${DataPacket.ID_BROADCAST}") {
|
||||
// contactKey: unique contact key filter (channel)+(nodeId)
|
||||
val channel = contactKey[0].digitToIntOrNull()
|
||||
val dest = if (channel != null) contactKey.substring(1) else contactKey
|
||||
|
||||
val p = DataPacket(dest, channel ?: 0, str)
|
||||
try {
|
||||
meshService?.send(p)
|
||||
} catch (ex: RemoteException) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue