Merge pull request #828 from NekoCWD/nekocwd/hop-limits

FR: Add Hop Limits to send functions
This commit is contained in:
Ian McEwen
2026-03-02 10:20:34 -07:00
committed by GitHub

View File

@@ -419,6 +419,7 @@ class MeshInterface: # pylint: disable=R0902
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.
@@ -436,6 +437,7 @@ class MeshInterface: # pylint: disable=R0902
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 {int} -- 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.
@@ -449,7 +451,8 @@ class MeshInterface: # pylint: disable=R0902
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
replyId=replyId
replyId=replyId,
hopLimit=hopLimit,
)
@@ -459,6 +462,7 @@ class MeshInterface: # pylint: disable=R0902
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
@@ -470,6 +474,7 @@ class MeshInterface: # pylint: disable=R0902
Keyword Arguments:
destinationId {nodeId or nodeNum} -- where to send this
message (default: {BROADCAST_ADDR})
hopLimit {int} -- 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.
@@ -483,7 +488,8 @@ class MeshInterface: # pylint: disable=R0902
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):
@@ -585,6 +591,7 @@ class MeshInterface: # pylint: disable=R0902
wantAck: bool = False,
wantResponse: bool = False,
channelIndex: int = 0,
hopLimit: Optional[int]=None,
):
"""
Send a position packet to some other node (normally a broadcast)
@@ -621,6 +628,7 @@ class MeshInterface: # pylint: disable=R0902
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForPosition()
@@ -727,7 +735,8 @@ class MeshInterface: # pylint: disable=R0902
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()
@@ -774,6 +783,7 @@ class MeshInterface: # pylint: disable=R0902
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForTelemetry()
@@ -843,6 +853,7 @@ class MeshInterface: # pylint: disable=R0902
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)
@@ -883,6 +894,7 @@ class MeshInterface: # pylint: disable=R0902
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForWaypoint()
@@ -895,6 +907,7 @@ class MeshInterface: # pylint: disable=R0902
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)
@@ -921,6 +934,7 @@ class MeshInterface: # pylint: disable=R0902
wantResponse=wantResponse,
onResponse=onResponse,
channelIndex=channelIndex,
hopLimit=hopLimit,
)
if wantResponse:
self.waitForWaypoint()