Skip to content

Commit 706d064

Browse files
authored
Merge pull request #801 from Cyclic3/master
Plumb reply_id into sendText and sendData
2 parents 1670449 + ca82e1c commit 706d064

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

meshtastic/mesh_interface.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,8 @@ def sendText(
411411
wantResponse: bool = False,
412412
onResponse: Optional[Callable[[dict], Any]] = None,
413413
channelIndex: int = 0,
414-
portNum: portnums_pb2.PortNum.ValueType = portnums_pb2.PortNum.TEXT_MESSAGE_APP
414+
portNum: portnums_pb2.PortNum.ValueType = portnums_pb2.PortNum.TEXT_MESSAGE_APP,
415+
replyId: Optional[int]=None,
415416
):
416417
"""Send a utf8 string to some other node, if the node has a display it
417418
will also be shown on the device.
@@ -428,6 +429,7 @@ def sendText(
428429
send an application layer response
429430
portNum -- the application portnum (similar to IP port numbers)
430431
of the destination, see portnums.proto for a list
432+
replyId -- the ID of the message that this packet is a response to
431433
432434
Returns the sent packet. The id field will be populated in this packet
433435
and can be used to track future message acks/naks.
@@ -441,6 +443,7 @@ def sendText(
441443
wantResponse=wantResponse,
442444
onResponse=onResponse,
443445
channelIndex=channelIndex,
446+
replyId=replyId
444447
)
445448

446449

@@ -451,7 +454,7 @@ def sendAlert(
451454
onResponse: Optional[Callable[[dict], Any]] = None,
452455
channelIndex: int = 0,
453456
):
454-
"""Send an alert text to some other node. This is similar to a text message,
457+
"""Send an alert text to some other node. This is similar to a text message,
455458
but carries a higher priority and is capable of generating special notifications
456459
on certain clients.
457460
@@ -503,6 +506,7 @@ def sendData(
503506
pkiEncrypted: Optional[bool]=False,
504507
publicKey: Optional[bytes]=None,
505508
priority: mesh_pb2.MeshPacket.Priority.ValueType=mesh_pb2.MeshPacket.Priority.RELIABLE,
509+
replyId: Optional[int]=None,
506510
): # pylint: disable=R0913
507511
"""Send a data packet to some other node
508512
@@ -527,6 +531,7 @@ def sendData(
527531
will implicitly be true.
528532
channelIndex -- channel number to use
529533
hopLimit -- hop limit to use
534+
replyId -- the ID of the message that this packet is a response to
530535
531536
Returns the sent packet. The id field will be populated in this packet
532537
and can be used to track future message acks/naks.
@@ -554,6 +559,8 @@ def sendData(
554559
meshPacket.decoded.portnum = portNum
555560
meshPacket.decoded.want_response = wantResponse
556561
meshPacket.id = self._generatePacketId()
562+
if replyId is not None:
563+
meshPacket.decoded.reply_id = replyId
557564
if priority is not None:
558565
meshPacket.priority = priority
559566

@@ -884,7 +891,7 @@ def deleteWaypoint(
884891
Send a waypoint deletion packet to some other node (normally a broadcast)
885892
886893
NB: The id must be the waypoint's id and not the id of the packet creation.
887-
894+
888895
Returns the sent packet. The id field will be populated in this packet and
889896
can be used to track future message acks/naks.
890897
"""

0 commit comments

Comments
 (0)