示例#1
0
    def get_data(self, message):
        """

        Parameters
        ----------
        message

        Returns
        -------

        """
        messg = ThreadCommand(message)

        if message == 'set_info':
            list_len = get_int(self.socket)
            path = []
            for ind in range(list_len):
                path.append(get_string(self.socket))
            param_xml = get_string(self.socket)
            messg.attributes = [path, param_xml]

        elif message == 'move_abs':
            position = get_scalar(self.socket)
            messg.attributes = [position]

        elif message == 'move_rel':
            position = get_scalar(self.socket)
            messg.attributes = [position]

        self.cmd_signal.emit(messg)
示例#2
0
    def command_to_from_client(self, command):
        sock = self.find_socket_within_connected_clients(self.client_type)
        if sock is not None:  # if client 'ACTUATOR' is connected then send it the command

            if command == 'position_is':
                pos = get_scalar(sock)

                pos = self.get_position_with_scaling(pos)
                self.current_position = pos
                self.emit_status(ThreadCommand('check_position', [pos]))

            elif command == 'move_done':
                pos = get_scalar(sock)
                pos = self.get_position_with_scaling(pos)
                self.current_position = pos
                self.emit_status(ThreadCommand('move_done', [pos]))