Skip to content

Commit e7e072e

Browse files
committed
tools: tdf_list: device ID filtering
Add the option to filter TDFs by Infuse device ID. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 07a5bbf commit e7e072e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/infuse_iot/tools/tdf_list.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ class SubCommand(InfuseCommand):
3030
@classmethod
3131
def add_parser(cls, parser):
3232
parser.add_argument("--array-all", action="store_true", help="Display all array values, not just the last")
33+
parser.add_argument(
34+
"--id", type=lambda x: int(x, 0), action="append", default=[], help="Limit displayed TDFs by device ID"
35+
)
3336

3437
def __init__(self, args):
3538
self._client = LocalClient(default_multicast_address(), 1.0)
3639
self._decoder = TDF()
3740
self._array_all = args.array_all
41+
self._ids = args.id
3842

3943
def append_tdf(
4044
self,
@@ -111,13 +115,16 @@ def run(self) -> None:
111115
continue
112116
source = msg.epacket.route[0]
113117

118+
if len(self._ids) > 0 and source.infuse_id not in self._ids:
119+
continue
120+
114121
table: list[tuple[str | None, str | None, str, str, str]] = []
115122

116123
tdf: TDF.Reading
117124
for tdf in self._decoder.decode(msg.epacket.payload):
118125
self.append_readings(table, tdf)
119126

120-
print(f"Infuse ID: {source.infuse_id:016x}")
127+
print(f"Infuse ID: 0x{source.infuse_id:016x}")
121128
print(f"Interface: {source.interface.name}")
122129
print(f" Address: {source.interface_address}")
123130
print(f" RSSI: {source.rssi} dBm")

0 commit comments

Comments
 (0)