def __init__(self): settings.configure(type(self).__name__.lower()) self.reader = None self.writer = None self.loop = None self.running = True signal.signal(signal.SIGUSR1, self.signal_handler)
def __init__(self, nabio): settings.configure(type(self).__name__.lower()) self.nabio = nabio self.idle_cv = asyncio.Condition() self.idle_queue = collections.deque() # Current position of ears in idle mode self.ears = { "left": Nabd.INIT_EAR_POSITION, "right": Nabd.INIT_EAR_POSITION, } self.info = {} # Info persists across service connections. self.state = State.IDLE # Dictionary of writers, i.e. connected services # For each writer, value is the list of registered events self.service_writers = {} self.interactive_service_writer = None # Events registered in interactive mode self.interactive_service_events = [] self.running = True self.loop = None self._ears_moved_task = None self.playing_cancelable = False self.playing_request_id = None self.boot = True Nabd.leds_boot(self.nabio, 2) if self.nabio.has_sound_input(): from . import i18n from .asr import ASR from .nlu import NLU config = i18n.Config.load() self._asr_locale = ASR.get_locale(config.locale) self.asr = ASR(self._asr_locale) Nabd.leds_boot(self.nabio, 3) self._nlu_locale = NLU.get_locale(config.locale) self.nlu = NLU(self._nlu_locale) Nabd.leds_boot(self.nabio, 4)