using reflection to get models
This commit is contained in:
@@ -72,10 +72,10 @@ class TelnetAdapter(ABC):
|
||||
elif self.tn is None:
|
||||
self.login()
|
||||
self.tn.write(cmd)
|
||||
out = tn.read_until_non_empty_line()
|
||||
out = self.tn.read_until_non_empty_line()
|
||||
res = out
|
||||
while out is not None and out != "":
|
||||
out = tn.read_until_non_empty_line()
|
||||
out = self.tn.read_until_non_empty_line()
|
||||
print(out)
|
||||
res += out
|
||||
return res
|
||||
|
||||
@@ -3,6 +3,8 @@ import sys
|
||||
from abc import ABC, abstractmethod
|
||||
from backend.recorder_adapters import telnetlib, TelnetAdapter
|
||||
|
||||
RECORDER_MODEL_NAME = "SMP 351 / 352"
|
||||
|
||||
# HOST = "localhost"
|
||||
# HOST = "129.13.51.102" # Audimax SMP 351
|
||||
# HOST = "129.13.51.106" # Tulla SMP 351
|
||||
@@ -728,41 +730,47 @@ class SMP(TelnetAdapter):
|
||||
return TelnetAdapter.get_response_str(self.tn.read_until_non_empty_line())
|
||||
|
||||
|
||||
smp = SMP(HOST, PW)
|
||||
print(smp)
|
||||
smp.login()
|
||||
print(smp.get_version(verbose_info=False))
|
||||
|
||||
print(smp.get_bootstrap_version())
|
||||
print(smp.get_part_number())
|
||||
print(smp.get_model_name())
|
||||
print(smp.get_model_description())
|
||||
def main():
|
||||
smp = SMP(HOST, PW)
|
||||
print(smp)
|
||||
smp.login()
|
||||
print(smp.get_version(verbose_info=False))
|
||||
|
||||
print(smp.get_system_memory_usage())
|
||||
print(smp.get_bootstrap_version())
|
||||
print(smp.get_part_number())
|
||||
print(smp.get_model_name())
|
||||
print(smp.get_model_description())
|
||||
|
||||
print(smp.get_file_transfer_config())
|
||||
print(smp.get_system_memory_usage())
|
||||
|
||||
# print(smp.get_unit_name())
|
||||
# print(smp.set_unit_name("mzsmp"))
|
||||
# print(smp.get_unit_name())
|
||||
# print(smp.reset_unit_name())
|
||||
print(smp.get_file_transfer_config())
|
||||
|
||||
print(smp.set_front_panel_lock(0))
|
||||
print(smp.get_front_panel_lock())
|
||||
# print(smp.get_unit_name())
|
||||
# print(smp.set_unit_name("mzsmp"))
|
||||
# print(smp.get_unit_name())
|
||||
# print(smp.reset_unit_name())
|
||||
|
||||
print(smp.get_input_name(1))
|
||||
print(smp.get_input_selction_per_channel())
|
||||
print(smp.get_recording_status())
|
||||
print("Preset Name: " + smp.get_user_preset_name(2))
|
||||
print(smp.get_user_presets(1))
|
||||
print(smp.get_input_presets())
|
||||
print(smp.get_layout_preset_name(2))
|
||||
print(smp.get_encoder_preset_name(1))
|
||||
print(smp.get_streaming_preset_name(2))
|
||||
print(smp.recall_encoder_preset(3, 1))
|
||||
print(smp.set_front_panel_lock(0))
|
||||
print(smp.get_front_panel_lock())
|
||||
|
||||
print(smp.get_input_name(1))
|
||||
print(smp.get_input_selction_per_channel())
|
||||
print(smp.get_recording_status())
|
||||
print("Preset Name: " + smp.get_user_preset_name(2))
|
||||
print(smp.get_user_presets(1))
|
||||
print(smp.get_input_presets())
|
||||
print(smp.get_layout_preset_name(2))
|
||||
print(smp.get_encoder_preset_name(1))
|
||||
print(smp.get_streaming_preset_name(2))
|
||||
print(smp.recall_encoder_preset(3, 1))
|
||||
|
||||
print(smp.is_muted(2))
|
||||
print(smp.mute_output(2))
|
||||
print(smp.is_muted(2))
|
||||
print(smp.unmute_output(2))
|
||||
print(smp.is_muted(2))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
print(smp.is_muted(2))
|
||||
print(smp.mute_output(2))
|
||||
print(smp.is_muted(2))
|
||||
print(smp.unmute_output(2))
|
||||
print(smp.is_muted(2))
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
import getpass
|
||||
import sys
|
||||
from abc import ABC, abstractmethod
|
||||
from backend.recorder_adapters import telnetlib
|
||||
|
||||
# HOST = "localhost"
|
||||
# HOST = "129.13.51.102" # Audimax SMP 351
|
||||
# HOST = "129.13.51.106" # Tulla SMP 351
|
||||
HOST = "172.22.246.207" # Test SMP MZ
|
||||
|
||||
user = "admin"
|
||||
pw = "123mzsmp"
|
||||
|
||||
|
||||
def print_tn(tn_response):
|
||||
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()
|
||||
res = out
|
||||
while out is not None and out != "":
|
||||
out = tn.read_until_non_empty_line()
|
||||
print(out)
|
||||
res += out
|
||||
return res
|
||||
|
||||
|
||||
tn = telnetlib.Telnet(HOST)
|
||||
tn.read_until("\r\nPassword:")
|
||||
# password = getpass.getpass()
|
||||
password = pw
|
||||
tn.write(password + "\n\r")
|
||||
|
||||
if not tn.assert_string_in_output("Login Administrator")[0]:
|
||||
print("WRONG (admin) password!! Exiting!")
|
||||
exit(1)
|
||||
|
||||
print("OK, we have admin rights!")
|
||||
|
||||
tn.write("1Q\n")
|
||||
|
||||
# print_tn(read_line(tn))
|
||||
print_tn(tn.read_until_non_empty_line())
|
||||
print("test")
|
||||
|
||||
|
||||
# print(run_cmd(tn, "I\n"))
|
||||
# run_cmd(tn, "X1CERT\n")
|
||||
# tn.write(chr(27)+"X1CERT")
|
||||
# tn.write("WX1CERT\n")
|
||||
# tn.write(chr(27)+"1BOOT")
|
||||
# tn.write("W1BOOT\n")
|
||||
# print_tn(tn.read_until_non_empty_line())
|
||||
# tn.write("I\n")
|
||||
# print_tn(tn.read_some())
|
||||
|
||||
# tn.write("exit\n\r".encode("ascii"))
|
||||
|
||||
# print_tn(tn.read_eager())
|
||||
|
||||
Reference in New Issue
Block a user