Skip to content

Commit 775f844

Browse files
author
Anton Schieber
committed
tools: bt_log: inform when connection established
Add logging for when a connection is successfully established, since log messages may arrive intermittently and it can otherwise be unclear whether the connection was actually made.
1 parent effdddc commit 775f844

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/infuse_iot/tools/bt_log.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
default_multicast_address,
1818
)
1919
from infuse_iot.tdf import TDF
20+
from infuse_iot.util.console import Console
2021

2122

2223
class SubCommand(InfuseCommand):
@@ -45,12 +46,13 @@ def run(self):
4546
if self._data:
4647
types |= GatewayRequestConnectionRequest.DataType.DATA
4748
with self._client.connection(self._id, types, self._conn_timeout) as _:
49+
Console.log_info(f"Connected to {self._id:016x} ({types.name})")
4850
while True:
4951
evt = self._client.receive()
5052
if evt is None:
5153
continue
5254
if isinstance(evt, ClientNotificationConnectionDropped):
53-
print(f"Connection to {self._id:016x} lost")
55+
Console.log_error(f"Connection to {self._id:016x} lost")
5456
break
5557
if not isinstance(evt, ClientNotificationEpacketReceived):
5658
continue

0 commit comments

Comments
 (0)