Exemple #1
0
    def send_msg_cmd_with_return(self, cmd):
        """Send a command message to the remote Spec server, and return the reply id.

        Arguments:
        cmd -- command string, i.e. '1+1'
        """
        if self.isSpecConnected():
            try:
                caller = sys._getframe(1).f_locals['self']
            except KeyError:
                caller = None

            return self.__send_msg_with_reply(replyReceiverObject = caller, *SpecMessage.msg_cmd_with_return(cmd, version = self.serverVersion))
        else:
            raise SpecClientNotConnectedError
    def send_msg_cmd_with_return(self, cmd):
        """Send a command message to the remote Spec server, and return the reply id.

        Arguments:
        cmd -- command string, i.e. '1+1'
        """
        if self.isSpecConnected():
            try:
                caller = sys._getframe(1).f_locals['self']
            except KeyError:
                caller = None

            return self.__send_msg_with_reply(replyReceiverObject=caller,
                                              *SpecMessage.msg_cmd_with_return(
                                                  cmd,
                                                  version=self.serverVersion))
        else:
            raise SpecClientNotConnectedError
Exemple #3
0
    def send_msg_cmd_with_return(self, cmd, caller=None):
        """Send a command message to the remote Spec server, and return the reply id.

        Arguments:
        cmd -- command string, i.e. '1+1'
        """
        if not self.is_connected():
            raise SpecClientNotConnectedError

        if not caller:
            try:
                caller = sys._getframe(1).f_locals['self']
            except KeyError:
                log.log(2, "caller not identified")
                caller = None
        log.log(2,
                "executing command. reply to be informed to %s" % str(caller))

        reply, msg = SpecMessage.msg_cmd_with_return(
            cmd, version=self.server_version)
        reply_id = self.__send_msg_with_reply(reply, msg, receiver_obj=caller)

        return reply_id