def is_connection_ok(self): try: s = self.sock.get_connection() if isinstance(self.server.address, dict): self.server.address = Serializable.get_deserialized(self.server.address) s.connect((self.server.address.address, self.server.address.port)) return True except Exception as e: print(e) return False
def get_status(self): status_cmd = CommandStruct(cmd=ServerCommand.Com_Status) response = self.processor.check_response_ex(status_cmd) response_data = response[1].data if isinstance(response_data, dict): response_data = Serializable.get_deserialized(response_data) if not response[0]: raise ValueError("get status failed") elif response_data is not None and isinstance(response_data, ServerStatus): if isinstance(self.out_data, list): self.out_data.append(response_data) self.server.status = response_data
def parse_command(command: str) ->CommandStruct: j = json.loads(command) return Serializable.get_deserialized(j)
def parse_command(command: str) -> CommandStruct: j = json.loads(command) return Serializable.get_deserialized(j)