transform into static method

This commit is contained in:
Robin Müller 2022-05-23 22:24:10 +02:00
parent f30913b24b
commit 51bbeaa693
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 9 additions and 8 deletions

View File

@ -104,7 +104,15 @@ class DevicesInfoParser:
current_idx += 1
return current_idx
def map_idx_to_type(self, devtype: int) -> str:
def print(self, pw: PrintWrapper):
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
for i in range(len(self.dev_types)):
pw.dlog(
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
)
@staticmethod
def map_idx_to_type(devtype: int) -> str:
if devtype == 0:
return "Reserved"
if devtype == 1:
@ -123,13 +131,6 @@ class DevicesInfoParser:
return "FRAM"
return "Unknown Type"
def print(self, pw: PrintWrapper):
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
for i in range(len(self.dev_types)):
pw.dlog(
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
)
def handle_pdu_data(
printer: FsfwTmTcPrinter, pdu_idx: int, set_id: int, hk_data: bytes