def executeCommand(self, command): if self.connection.serverVersion < 3: connectionCommand = 'send_msg_cmd_with_return' else: if type(command) == types.StringType: connectionCommand = 'send_msg_cmd_with_return' else: connectionCommand = 'send_msg_func_with_return' return SpecWaitObject.waitReply(self.connection, connectionCommand, (command, ), self.__timeout)
def read(self, timeout=3, force_read=False): """Read the channel value If channel is registered, just return the internal value, else obtain the channel value and return it. """ if not force_read and self.registered: if self.value is not None: #we check 'value is not None' because the #'registered' flag could be set, but before #the message with the channel value arrived return self.value connection = self.connection() if connection is not None: # make sure spec is connected, we give a short timeout # because it is supposed to be the case already value = SpecWaitObject.waitReply(connection, 'send_msg_chan_read', (self.spec_chan_name, ), timeout=timeout) if value is None: raise RuntimeError("could not read channel %r" % self.spec_chan_name) self.update(value) return self.value