added a lot of enums for SMP parameters

This commit is contained in:
2023-10-25 16:24:03 +02:00
parent b60d89ce0a
commit 2d0a5c2974
3 changed files with 349 additions and 99 deletions

View File

@@ -13,18 +13,27 @@ pw = "123mzsmp"
def print_tn(tn_response):
"""
Prints the given TN response, decoding it if necessary.
Args:
tn_response (bytes or str): The TN response to print.
Returns:
None
"""
if isinstance(tn_response, bytes):
print(tn_response.decode("ascii").rstrip())
else:
print(str(tn_response).rstrip())
def run_cmd(tn, cmd, timeout=1):
tn.write(cmd)
out = tn.read_until_non_empty_line()
def run_cmd(telnet_con, cmd, _timeout=1):
telnet_con.write(cmd)
out = telnet_con.read_until_non_empty_line()
res = out
while out is not None and out != "":
out = tn.read_until_non_empty_line()
out = telnet_con.read_until_non_empty_line()
print(out)
res += out
return res