Skip to content

Commit

Permalink
Fix up/add some more types
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcorvidae committed May 31, 2024
1 parent 3b112d2 commit 4d67e7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def sendText(
destinationId: Union[int, str]=BROADCAST_ADDR,
wantAck: bool=False,
wantResponse: bool=False,
onResponse: Optional[Callable[[mesh_pb2.MeshPacket], Any]]=None,
onResponse: Optional[Callable[[dict], Any]]=None,
channelIndex: int=0,
):
"""Send a utf8 string to some other node, if the node has a display it
Expand Down Expand Up @@ -290,7 +290,7 @@ def sendData(
portNum: portnums_pb2.PortNum.ValueType=portnums_pb2.PortNum.PRIVATE_APP,
wantAck: bool=False,
wantResponse: bool=False,
onResponse: Optional[Callable[[mesh_pb2.MeshPacket], Any]]=None,
onResponse: Optional[Callable[[dict], Any]]=None,
channelIndex: int=0,
):
"""Send a data packet to some other node
Expand Down Expand Up @@ -446,7 +446,7 @@ def sendTraceRoute(self, dest: Union[int, str], hopLimit: int, channelIndex: int
waitFactor = min(len(self.nodes) - 1 if self.nodes else 0, hopLimit)
self.waitForTraceRoute(waitFactor)

def onResponseTraceRoute(self, p):
def onResponseTraceRoute(self, p: dict):
"""on response for trace route"""
routeDiscovery = mesh_pb2.RouteDiscovery()
routeDiscovery.ParseFromString(p["decoded"]["payload"])
Expand Down Expand Up @@ -500,7 +500,7 @@ def sendTelemetry(self, destinationId: Union[int,str]=BROADCAST_ADDR, wantRespon
if wantResponse:
self.waitForTelemetry()

def onResponseTelemetry(self, p):
def onResponseTelemetry(self, p: dict):
"""on response for telemetry"""
if p["decoded"]["portnum"] == 'TELEMETRY_APP':
self._acknowledgment.receivedTelemetry = True
Expand All @@ -523,7 +523,7 @@ def onResponseTelemetry(self, p):
if p["decoded"]["routing"]["errorReason"] == 'NO_RESPONSE':
our_exit("No response from node. At least firmware 2.1.22 is required on the destination node.")

def _addResponseHandler(self, requestId: int, callback: Callable):
def _addResponseHandler(self, requestId: int, callback: Callable[[dict], Any]):
self.responseHandlers[requestId] = ResponseHandler(callback)

def _sendPacket(self, meshPacket: mesh_pb2.MeshPacket, destinationId: Union[int,str]=BROADCAST_ADDR, wantAck: bool=False):
Expand Down

0 comments on commit 4d67e7f

Please sign in to comment.