Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions src/infuse_iot/rpc_wrappers/data_logger_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ def handle_response(self, return_code, response):

if response.sent_len != len(self.output):
print(f"Unexpected received length ({response.sent_len} != {len(self.output)})")
return

if response.sent_crc != binascii.crc32(self.output):
print(f"Unexpected received length ({response.sent_crc:08x} != {binascii.crc32(self.output)}:08x)")
return
print(f"Unexpected received CRC ({response.sent_crc:08x} != {binascii.crc32(self.output):08x})")

output_file = f"{self.infuse_id:016x}_{self.logger.name}.bin"
file_prefix = f"{self.infuse_id:016x}" if self.infuse_id else "gateway"
output_file = f"{file_prefix}_{self.logger.name}.bin"
with open(output_file, "wb") as f:
f.write(self.output)
print(f"Wrote {response.sent_len:d} bytes to {output_file}")
2 changes: 1 addition & 1 deletion src/infuse_iot/tools/csv_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def run(self):
app = Dash()
app.layout = html.Div([dcc.Graph(figure=fig)])

app.run_server(debug=True)
app.run(debug=True)
6 changes: 3 additions & 3 deletions src/infuse_iot/tools/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _handle_epacket_send(self, req: GatewayRequestEpacketSend):
pkt = req.epacket

# Construct routed output
if pkt.infuse_id == InfuseID.GATEWAY:
if pkt.infuse_id == InfuseID.GATEWAY or pkt.infuse_id == self._common.ddb.gateway:
routed = PacketOutputRouted(
[HopOutput(self._common.ddb.gateway, interface.ID.SERIAL, pkt.auth)],
pkt.ptype,
Expand Down Expand Up @@ -301,7 +301,7 @@ def _bt_connect_cb(self, pkt: PacketReceived, rc: int, response: bytes):
def _handle_conn_request(self, req: GatewayRequestConnectionRequest):
assert self._common.server is not None

if req.infuse_id == InfuseID.GATEWAY:
if req.infuse_id == InfuseID.GATEWAY or req.infuse_id == self._common.ddb.gateway:
# Local gateway always connected
self._common.server.broadcast(ClientNotificationConnectionCreated(req.infuse_id, 512))
return
Expand Down Expand Up @@ -336,7 +336,7 @@ def _handle_conn_request(self, req: GatewayRequestConnectionRequest):
self._common.port.write(encrypted)

def _handle_conn_release(self, req: GatewayRequestConnectionRelease):
if req.infuse_id == InfuseID.GATEWAY:
if req.infuse_id == InfuseID.GATEWAY or req.infuse_id == self._common.ddb.gateway:
# Local gateway always connected
return

Expand Down