Commit 430e6c92eb993490ddc0b0622fa7b1034aaa53c9

Authored by Etienne Pallier
1 parent 7e82f0aa
Exists in dev

do_init() ok avec serveur de test

sockets_tele/README.txt
... ... @@ -125,6 +125,12 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
125 125 ********************************************************************************************
126 126 6) TODO LIST
127 127  
  128 + - Remplacer:
  129 + def get_timezone(self): return self.execute_generic_cmd('get_timezone')
  130 + par un decorateur:
  131 + @execute_generic_cmd
  132 + def get_timezone(self): pass
  133 +
128 134 - interpreteur de cde generique (avec celme pour les values) : set ra 20:00:00
129 135  
130 136 - Tele MEADE ETX (altaz) : cf doc pdf (from page 1)
... ... @@ -134,6 +140,8 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110):
134 140 - cette config doit être fait dans do_init()
135 141 - doc page 1 : x=implémenté, p=partial, - = pas implémenté
136 142  
  143 + - Position class
  144 +
137 145 - POSITION (p103):
138 146 - (100) MOVE() (p104-105)
139 147 => en altaz ou radec
... ...
sockets_tele/client_gemini_run.py
... ... @@ -84,7 +84,7 @@ def main():
84 84 if ack.ko: print("ack is ko")
85 85  
86 86 # Initialize telescope config (ack, date, time)
87   - ###tele_client.do_init()
  87 + tele_client.do_init()
88 88  
89 89 #_mes_tests_temporaires_avirer(tele_client)
90 90  
... ...
sockets_tele/server_run.py
1 1 #!/usr/bin/env python3
2 2  
3   -from src.server.server_udp_or_tcp import get_SocketServer_UDP_TCP
  3 +from src_socket.server.server_udp_or_tcp import get_SocketServer_UDP_TCP
4 4  
5 5 HOST, PORT = "localhost", 11110
6 6 #HOST, PORT = "localhost", 9999
... ...
sockets_tele/src_socket/client/socket_client_telescope_abstract.py
... ... @@ -187,7 +187,8 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
187 187 # ex: "set_radec"
188 188 generic_cmd = cmd_splitted[0] + '_' + cmd_splitted[1]
189 189 # Check this generic command exists
190   - if generic_cmd not in self._cmd.keys(): return False,False
  190 + if (generic_cmd not in self._cmd.keys()) and ():
  191 + return False,False
191 192 # Is there value(s) passed ?
192 193 if len(cmd_splitted) > 2:
193 194 values_to_set = cmd_splitted[2:]
... ... @@ -293,7 +294,13 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
293 294 # Get corresponding native command:
294 295 native_cmd = native_cmd_infos[0]
295 296 if not native_cmd: raise NotImplementedError
296   - native_cmd = self.formated_cmd(native_cmd,values_to_set)
  297 + # ex: native_cmd == "do_init"
  298 + if native_cmd == generic_cmd:
  299 + res = getattr(self, native_cmd)(values_to_set)
  300 + return GenericResult(res)
  301 + # ex: native_cmd == "GR"
  302 + else:
  303 + native_cmd = self.formated_cmd(native_cmd,values_to_set)
297 304  
298 305 awaited_res_if_ok = None
299 306 if len(native_cmd_infos) > 1: awaited_res_if_ok = native_cmd_infos[1]
... ... @@ -415,8 +422,9 @@ class SocketClientTelescopeAbstract(SocketClientAbstract):
415 422 def set_RADEC(self, radec): return self._set("RADEC", radec)
416 423  
417 424 #def set_TIMEZONE_IS_UTC(self): return self._set('TIMEZONE_IS_UTC')
418   - def get_timezone(self): return self._get('timezone')
419   - def set_timezone(self, hh): return self._set('timezone', hh)
  425 + def get_timezone(self): return self.execute_generic_cmd('get_timezone')
  426 + def set_timezone(self, hh): return self.execute_generic_cmd('set_timezone', hh)
  427 +
420 428 def get_DATE(self): return self._get('DATE')
421 429 def set_DATE(self, mmddyy): return self._set('DATE', mmddyy)
422 430 def get_TIME(self): return self._get('TIME')
... ...
sockets_tele/src_socket/client/socket_client_telescope_gemini.py
... ... @@ -64,13 +64,20 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract):
64 64 _cmd = {
65 65 # GET @ SET commands
66 66 'get_ack': [COMMAND6, 'G', 'B','b','S'], # B# while the initial startup message is being displayed (new in L4), b# while waiting for the selection of the Startup Mode, S# during a Cold Start (new in L4), G# after completed startup.
  67 +
67 68 'get_ra': ['GR'],
68 69 'set_ra': ['Sr'],
  70 +
69 71 'get_dec': ['GD'],
70 72  
  73 + 'get_timezone': ['GG'],
  74 + 'set_timezone': ['SG', '1'],
  75 +
  76 +
71 77 # DO commands
72 78 'do_move': [':MS#', '0', '1Object below horizon.#', '2No object selected.#', '3Manual Control.#', '4Position unreachable.#', '5Not aligned.#', '6Outside Limits.#' ],
73 79 'do_stop': [':Q#'],
  80 + 'do_init': ['do_init'],
74 81 }
75 82  
76 83 """
... ...
sockets_tele/src_socket/server/server_udp_or_tcp.py
... ... @@ -130,6 +130,7 @@ def get_SocketServer_UDP_TCP(myhost:str="localhost", myport:int=11110, PROTOCOL:
130 130 #elif useful_request == 'GD': answer = "+12:28"
131 131 elif command == ':GD#': answer = "+12:28"
132 132 elif command == ':SG+00#': answer = "1"
  133 + elif command == ':GG#': answer = "+00"
133 134  
134 135 else:
135 136 command = command[0:-1]
... ...