Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def sendText(
channelIndex: int = 0,
portNum: portnums_pb2.PortNum.ValueType = portnums_pb2.PortNum.TEXT_MESSAGE_APP,
replyId: Optional[int]=None,
hopLimit: Optional[int]=None,
):
"""Send a utf8 string to some other node, if the node has a display it
will also be shown on the device.
Expand All @@ -432,6 +433,7 @@ def sendText(
portNum -- the application portnum (similar to IP port numbers)
of the destination, see portnums.proto for a list
replyId -- the ID of the message that this packet is a response to
hopLimit -- hop limit to use
Returns the sent packet. The id field will be populated in this packet
and can be used to track future message acks/naks.
Expand All @@ -445,7 +447,8 @@ def sendText(
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
replyId=replyId
replyId=replyId,
hopLimit=hopLimit
)


Expand All @@ -455,13 +458,15 @@ def sendAlert(
destinationId: Union[int, str] = BROADCAST_ADDR,
onResponse: Optional[Callable[[dict], Any]] = None,
channelIndex: int = 0,
hopLimit: Optional[int]=None,
):
"""Send an alert text to some other node. This is similar to a text message,
but carries a higher priority and is capable of generating special notifications
on certain clients.
Arguments:
text {string} -- The text of the alert to send
hopLimit -- hop limit to use
Keyword Arguments:
destinationId {nodeId or nodeNum} -- where to send this
Expand All @@ -479,7 +484,8 @@ def sendAlert(
wantResponse=False,
onResponse=onResponse,
channelIndex=channelIndex,
priority=mesh_pb2.MeshPacket.Priority.ALERT
priority=mesh_pb2.MeshPacket.Priority.ALERT,
hopLimit=hopLimit
)

def sendMqttClientProxyMessage(self, topic: str, data: bytes):
Expand Down Expand Up @@ -581,6 +587,7 @@ def sendPosition(
wantAck: bool = False,
wantResponse: bool = False,
channelIndex: int = 0,
hopLimit: Optional[int]=None,
):
"""
Send a position packet to some other node (normally a broadcast)
Expand Down Expand Up @@ -617,6 +624,7 @@ def sendPosition(
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForPosition()
Expand Down Expand Up @@ -722,7 +730,8 @@ def sendTelemetry(
destinationId: Union[int, str] = BROADCAST_ADDR,
wantResponse: bool = False,
channelIndex: int = 0,
telemetryType: str = "device_metrics"
telemetryType: str = "device_metrics",
hopLimit: Optional[int]=None
):
"""Send telemetry and optionally ask for a response"""
r = telemetry_pb2.Telemetry()
Expand Down Expand Up @@ -769,6 +778,7 @@ def sendTelemetry(
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForTelemetry()
Expand Down Expand Up @@ -837,6 +847,7 @@ def sendWaypoint(
wantAck: bool = True,
wantResponse: bool = False,
channelIndex: int = 0,
hopLimit: Optional[int]=None,
): # pylint: disable=R0913
"""
Send a waypoint packet to some other node (normally a broadcast)
Expand Down Expand Up @@ -876,6 +887,7 @@ def sendWaypoint(
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForWaypoint()
Expand All @@ -888,6 +900,7 @@ def deleteWaypoint(
wantAck: bool = True,
wantResponse: bool = False,
channelIndex: int = 0,
hopLimit: Optional[int]=None,
):
"""
Send a waypoint deletion packet to some other node (normally a broadcast)
Expand All @@ -914,6 +927,7 @@ def deleteWaypoint(
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForWaypoint()
Expand Down