sendText

fun sendText(text: String, to: NodeId = NodeId.BROADCAST, channel: ChannelIndex = ChannelIndex(0), replyId: Int = 0): MessageHandle(source)

Convenience: send a text message.

Wraps the text in a MeshPacket with decoded.portnum = TEXT_MESSAGE_APP and decoded.payload = text.encodeToByteArray(), then calls send.

Sets want_ack = true so the firmware provides delivery feedback:

  • Unicast: the recipient sends a Routing ACK back to the sender.

  • Broadcast: the firmware generates an implicit ACK when it overhears a neighbor relay the packet. This confirms at least one mesh node retransmitted the message.

The returned MessageHandle will resolve to SendOutcome.Success on ACK, or SendOutcome.Failure if the firmware exhausts retransmissions without confirmation.

Parameter order matches sendReaction (to before channel) as of 0.2.0.

Return

a handle tracking delivery state

Parameters

text

the message text (UTF-8 encoded)

to

the destination NodeId (default: NodeId.BROADCAST)

channel

the channel index (default: 0)

replyId

the packet ID of the message this text replies to (threaded reply), or 0 (default) for a standalone message (parameter added in 0.2.0)

Throws

if not currently connected

if the encoded text exceeds the device limit