diff --git a/sockets_tele/README.txt b/sockets_tele/README.txt index ef7bd0e..93570b8 100644 --- a/sockets_tele/README.txt +++ b/sockets_tele/README.txt @@ -125,6 +125,12 @@ Pour lancer le client sur le "simulateur" de telescope (localhost, port 11110): ******************************************************************************************** 6) TODO LIST + - Remplacer: + def get_timezone(self): return self.execute_generic_cmd('get_timezone') + par un decorateur: + @execute_generic_cmd + def get_timezone(self): pass + - interpreteur de cde generique (avec celme pour les values) : set ra 20:00:00 - 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): - cette config doit être fait dans do_init() - doc page 1 : x=implémenté, p=partial, - = pas implémenté + - Position class + - POSITION (p103): - (100) MOVE() (p104-105) => en altaz ou radec diff --git a/sockets_tele/client_gemini_run.py b/sockets_tele/client_gemini_run.py index 7e60d30..10089eb 100755 --- a/sockets_tele/client_gemini_run.py +++ b/sockets_tele/client_gemini_run.py @@ -84,7 +84,7 @@ def main(): if ack.ko: print("ack is ko") # Initialize telescope config (ack, date, time) - ###tele_client.do_init() + tele_client.do_init() #_mes_tests_temporaires_avirer(tele_client) diff --git a/sockets_tele/server_run.py b/sockets_tele/server_run.py index 06ee79f..3bbee66 100755 --- a/sockets_tele/server_run.py +++ b/sockets_tele/server_run.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from src.server.server_udp_or_tcp import get_SocketServer_UDP_TCP +from src_socket.server.server_udp_or_tcp import get_SocketServer_UDP_TCP HOST, PORT = "localhost", 11110 #HOST, PORT = "localhost", 9999 diff --git a/sockets_tele/src_socket/client/socket_client_telescope_abstract.py b/sockets_tele/src_socket/client/socket_client_telescope_abstract.py index c00664c..5c25149 100755 --- a/sockets_tele/src_socket/client/socket_client_telescope_abstract.py +++ b/sockets_tele/src_socket/client/socket_client_telescope_abstract.py @@ -187,7 +187,8 @@ class SocketClientTelescopeAbstract(SocketClientAbstract): # ex: "set_radec" generic_cmd = cmd_splitted[0] + '_' + cmd_splitted[1] # Check this generic command exists - if generic_cmd not in self._cmd.keys(): return False,False + if (generic_cmd not in self._cmd.keys()) and (): + return False,False # Is there value(s) passed ? if len(cmd_splitted) > 2: values_to_set = cmd_splitted[2:] @@ -293,7 +294,13 @@ class SocketClientTelescopeAbstract(SocketClientAbstract): # Get corresponding native command: native_cmd = native_cmd_infos[0] if not native_cmd: raise NotImplementedError - native_cmd = self.formated_cmd(native_cmd,values_to_set) + # ex: native_cmd == "do_init" + if native_cmd == generic_cmd: + res = getattr(self, native_cmd)(values_to_set) + return GenericResult(res) + # ex: native_cmd == "GR" + else: + native_cmd = self.formated_cmd(native_cmd,values_to_set) awaited_res_if_ok = None if len(native_cmd_infos) > 1: awaited_res_if_ok = native_cmd_infos[1] @@ -415,8 +422,9 @@ class SocketClientTelescopeAbstract(SocketClientAbstract): def set_RADEC(self, radec): return self._set("RADEC", radec) #def set_TIMEZONE_IS_UTC(self): return self._set('TIMEZONE_IS_UTC') - def get_timezone(self): return self._get('timezone') - def set_timezone(self, hh): return self._set('timezone', hh) + def get_timezone(self): return self.execute_generic_cmd('get_timezone') + def set_timezone(self, hh): return self.execute_generic_cmd('set_timezone', hh) + def get_DATE(self): return self._get('DATE') def set_DATE(self, mmddyy): return self._set('DATE', mmddyy) def get_TIME(self): return self._get('TIME') diff --git a/sockets_tele/src_socket/client/socket_client_telescope_gemini.py b/sockets_tele/src_socket/client/socket_client_telescope_gemini.py index 20ae314..4a3bce4 100755 --- a/sockets_tele/src_socket/client/socket_client_telescope_gemini.py +++ b/sockets_tele/src_socket/client/socket_client_telescope_gemini.py @@ -64,13 +64,20 @@ class SocketClientTelescopeGEMINI(SocketClientTelescopeAbstract): _cmd = { # GET @ SET commands '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. + 'get_ra': ['GR'], 'set_ra': ['Sr'], + 'get_dec': ['GD'], + 'get_timezone': ['GG'], + 'set_timezone': ['SG', '1'], + + # DO commands 'do_move': [':MS#', '0', '1Object below horizon.#', '2No object selected.#', '3Manual Control.#', '4Position unreachable.#', '5Not aligned.#', '6Outside Limits.#' ], 'do_stop': [':Q#'], + 'do_init': ['do_init'], } """ diff --git a/sockets_tele/src_socket/server/server_udp_or_tcp.py b/sockets_tele/src_socket/server/server_udp_or_tcp.py index 76a583e..89c6022 100755 --- a/sockets_tele/src_socket/server/server_udp_or_tcp.py +++ b/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: #elif useful_request == 'GD': answer = "+12:28" elif command == ':GD#': answer = "+12:28" elif command == ':SG+00#': answer = "1" + elif command == ':GG#': answer = "+00" else: command = command[0:-1] -- libgit2 0.21.2