File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ def run(self):
2828 passcode_lenth = response [9 ]
2929 passcode_raw = response [10 : 10 + passcode_lenth ]
3030 passcode = passcode_raw .decode ("utf-8" )
31+ print (passcode )
3132
3233 data = bytes .fromhex ('000000030f00000800' ) + passcode_lenth .to_bytes (1 , 'little' ) + passcode_raw
3334 self .socket .sendall (data )
@@ -146,14 +147,3 @@ def __enter__(self):
146147
147148 def __exit__ (self , type , value , traceback ):
148149 self .socket .close ()
149-
150-
151- if __name__ == '__main__' :
152- #with Device('192.168.1.89') as d:
153- # print(d.get_result())
154-
155- loop = asyncio .get_event_loop ()
156- device = Device ('192.168.1.89' )
157- loop .run_until_complete (device .run_async ())
158- print (device .get_result ())
159- loop .close ()
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def run(self):
6868 version_raw = data [idx_start : idx ]
6969 self .result ['result' ]['version_server' ] = version_raw .decode ("utf-8" )
7070
71- self .result ['status' ] = ['success ' ]
71+ self .result ['status' ] = ['Success ' ]
7272
7373 def close (self ):
7474 self .socket .close ()
@@ -82,13 +82,3 @@ def __enter__(self):
8282
8383 def __exit__ (self , type , value , traceback ):
8484 self .close ()
85-
86- if __name__ == '__main__' :
87- with Discovery () as d :
88- print (d .get_result ())
89-
90- loop = asyncio .get_event_loop ()
91- discovery = Discovery ()
92- loop .run_until_complete (discovery .run_async ())
93- print (discovery .get_result ())
94- loop .close ()
Original file line number Diff line number Diff line change 88result = discover .get_result ()
99print (result )
1010
11+ if result ['status' ][0 ] != 'Success' :
12+ print (result )
13+ exit (1 )
14+
1115dev = device .Device (result ['result' ]['ip' ])
1216# listener = loop.create_task(dev.run_async())
1317# asyncio.wait([listener])
You can’t perform that action at this time.
0 commit comments