def next(self, log_func): # Increase gdNIT until find valid minislot config and symbol window while self.gdNIT < 580: self.gdSymbolWindow = 580 - self.gdNIT if 0 <= self.gdSymbolWindow <= 162: gdMinislot, gNumberOfMinislots = self.caclulate_params( log_func) if gdMinislot != 0 and gNumberOfMinislots != 0: break self.gdNIT += 1 if self.gdNIT >= 580: return None self.cur_config['gdMinislot'] = gdMinislot self.cur_config['gNumberOfMinislots'] = gNumberOfMinislots self.cur_config['gdNIT'] = self.gdNIT self.cur_config['gdSymbolWindow'] = self.gdSymbolWindow # Assume a fixed adOffsetCorrection adOffsetCorrection = self.gdNIT - 1 self.cur_config[ 'gOffsetCorrectionStart'] = self.gMacroPerCycle - adOffsetCorrection ok, err = verify_config(self.cur_config) if not ok: if type(err) == str: log_func('gdNIT: {}, invalid config: {}'.format( self.gdNIT, err)) elif type(err) == tuple: log_func('gdNIT: {}, invalid config: {} should be {}'.format( self.gdNIT, err[0], err[1])) return None self.gdNIT += 1 return self.cur_config
def next(self, log_func): if len(self.values) <= 0: return None while self.progress < len(self.values): self.gdStaticSlot, self.gdTSSTransmitter, self.gdActionPointOffset = self.values[ self.progress] self.progress += 1 gdMinislot, gNumberOfMinislots = self.caclulate_params(log_func) if gdMinislot != 0 and gNumberOfMinislots != 0: break if self.progress >= len(self.values): # No more values return None self.cur_config['gdMinislot'] = gdMinislot self.cur_config['gNumberOfMinislots'] = gNumberOfMinislots self.cur_config['gdTSSTransmitter'] = self.gdTSSTransmitter self.cur_config['gdActionPointOffset'] = self.gdActionPointOffset self.cur_config['gdStaticSlot'] = self.gdStaticSlot # Assume a fixed adOffsetCorrection adOffsetCorrection = self.cur_config['gdNIT'] - 1 self.cur_config[ 'gOffsetCorrectionStart'] = self.gMacroPerCycle - adOffsetCorrection while True: ok, err = verify_config(self.cur_config) if ok: break if type(err) == str: log_func( 'gdActionPointOffset: {}, gdTSSTransmitter: {}, invalid config: {}' .format(self.gdActionPointOffset, self.gdTSSTransmitter, err)) return None elif type(err) == tuple: log_func( 'gdActionPointOffset: {}, gdTSSTransmitter: {}, correct params: {} should be {}' .format(self.gdActionPointOffset, self.gdTSSTransmitter, err[0], err[1])) self.cur_config[err[0]] = err[1] return self.cur_config