Ejemplo n.º 1
0
    def __init__(self, ttx_interface, dictionary_manager, Nano=False):
        self.__current_tuner = CurrentTuner(ttx_interface)
        self.__power_tuner = PowerTuner()
        config = System.Configuration()
        if Nano:  # NANO
            status_dictionary = {
                '11': 'CHANNEL_LOCK',
                '10': 'STABILIZE',
                '13': 'MZM_STATE',
                '12': 'FINE_TUNE',
                '1': 'IDLE',
                '0': 'COLD_START',
                '3': 'TEMPERATURE',
                '2': 'DARK',
                '5': 'ADJUSTMENT',
                '4': 'GAIN_MEDIUM',
                '7': 'CAVITY_LOCK',
                '6': 'FIRST_LIGHT',
                '9': 'CAVITY_OFFSET_LOCK',
                '8': 'POWER_LEVEL'
            }
            state_dictionary = {
                '1': 'POWER_STATE_LASER_PHOTODIODE',
                '0': 'POWER_STATE_DISABLE',
                '3': 'POWER_STATE_LOCK',
                '2': 'POWER_STATE_MZM_PHOTODIODE'
            }
            self.__current_tuner.statusDictionary(status_dictionary)
            self.__current_tuner.powerStateDictionary(state_dictionary)
            self.__power_tuner.statusDictionary(status_dictionary)
            self.__power_tuner.powerStateDictionary(state_dictionary)
            return
        status_dictionary = config.restore(ttx_interface.firmwareVersion(),
                                           'TunerStatus')
        #        print ttx_interface.firmwareVersion()
        if len(status_dictionary) == 0:
            raise 'TunerStatus undefined!'

        state_dictionary = config.restore(ttx_interface.firmwareVersion(),
                                          'PowerState')
        if len(state_dictionary) == 0:
            raise 'Power States undefined!'

        dm = dictionary_manager
        d = Dictionary.Dictionary()
        #        d.memory(dm.dictionary('MODEL_DICTIONARY').memory())
        #        d.addEntry('model', dm.dictionary('MODEL_DICTIONARY'))
        ###d.addEntry('ambient_compensator', dm.dictionary('AMBIENT_COMPENSATOR_DICTIONARY'))
        self.__current_tuner.statusDictionary(status_dictionary)
        self.__current_tuner.powerStateDictionary(state_dictionary)
        self.__current_tuner.dictionary(d)

        d1 = Dictionary.Dictionary()
        #        d1.memory(dm.dictionary('MODEL_DICTIONARY').memory())
        #        d1.addEntry('model', dm.dictionary('MODEL_DICTIONARY'))
        ###d1.addEntry('power', dm.dictionary('POWER_DICTIONARY'))
        ###d1.addEntry('ambient_compensator', dm.dictionary('AMBIENT_COMPENSATOR_DICTIONARY'))
        self.__power_tuner.statusDictionary(status_dictionary)
        self.__power_tuner.powerStateDictionary(state_dictionary)
        self.__power_tuner.dictionary(d1)