def send_request_with_response(self, cmd, unitnum, numretries=3): if debug > 2: print 'In TCS-LineHandler with %s' % cmd curtries = 0 while (1): curtries += 1 self.lock.acquire() try: frame.send_frame(cmd, unitnum, self.port) r = frame.receive_frame(self.port) if debug > 2: print 'TCSLineHandler received frame: ' + str(r) rsp = None if cmd.response_class: rsp = cmd.response_class(r, cmd) self.lock.release() return rsp except: self.lock.release() if debug > 1: msglog.log('tcs',msglog.types.INFO,'Caught exception trying to send_request_with_response.') msglog.exception() if (curtries >= numretries): raise ETimeout('ETimeout',str(unitnum)) # Re-raise the last exception we got
def send_request_with_response(self, cmd, unitnum, numretries=3): if debug > 2: print 'In TCS-LineHandler with %s' % cmd curtries = 0 while (1): curtries += 1 self.lock.acquire() try: frame.send_frame(cmd, unitnum, self.port) r = frame.receive_frame(self.port) if debug > 2: print 'TCSLineHandler received frame: ' + str(r) rsp = None if cmd.response_class: rsp = cmd.response_class(r, cmd) self.lock.release() return rsp except: self.lock.release() if debug > 1: msglog.log( 'tcs', msglog.types.INFO, 'Caught exception trying to send_request_with_response.' ) msglog.exception() if (curtries >= numretries): raise ETimeout( 'ETimeout', str(unitnum)) # Re-raise the last exception we got
def send_request_without_response(self, cmd, unitnum, numretries=1): if debug > 1: print 'In TCS-LineHandler with %s' % cmd curtries = 0 while (1): curtries += 1 self.lock.acquire() try: frame.send_frame(cmd, unitnum, self.port) r = frame.receive_ack(self.port) if debug > 2: print 'TCSLineHandler received ack: ' + str(r) self.lock.release() return r except: self.lock.release() if debug > 1: msglog.log('tcs',msglog.types.INFO,'Caught exception trying to send_request_without_response.') msglog.exception() if (curtries >= numretries): raise # Re-raise the last exception we got
def send_request_without_response(self, cmd, unitnum, numretries=1): if debug > 1: print 'In TCS-LineHandler with %s' % cmd curtries = 0 while (1): curtries += 1 self.lock.acquire() try: frame.send_frame(cmd, unitnum, self.port) r = frame.receive_ack(self.port) if debug > 2: print 'TCSLineHandler received ack: ' + str(r) self.lock.release() return r except: self.lock.release() if debug > 1: msglog.log( 'tcs', msglog.types.INFO, 'Caught exception trying to send_request_without_response.' ) msglog.exception() if (curtries >= numretries): raise # Re-raise the last exception we got