From 62992feac3a3471a241af6cb0c1108ec6cb65456 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Wed, 17 Oct 2018 20:40:53 +0200 Subject: [PATCH] Move struct output generation into Gcd class. --- gcdstruct.py | 3 +-- grmn/gcd.py | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcdstruct.py b/gcdstruct.py index eff8883..ad1af93 100644 --- a/gcdstruct.py +++ b/gcdstruct.py @@ -14,5 +14,4 @@ print("Opening {}".format(FILE)) gcd = Gcd(FILE) -for i, tlv in enumerate(gcd.struct): - print("#{:03d}: {}".format(i, tlv)) +gcd.print_struct() diff --git a/grmn/gcd.py b/grmn/gcd.py index 2835466..c751882 100644 --- a/grmn/gcd.py +++ b/grmn/gcd.py @@ -196,3 +196,9 @@ class Gcd: elif tlv.type_id == 0x0007: tlv.set_tlv6(last_tlv6) f.close() + + def print_struct(self): + last_tlv = 0xffff + tlv_count = 0 + for i, tlv in enumerate(self.struct): + print("#{:03d}: {}".format(i, tlv))