def _handle_timeout(self): if self.__timeouts == 0: if _arming.get() and self.__rings >= 3: return _Online() self.__timeouts = 1 self._timeout = 5.0 elif self.__timeouts == 1: self.__rings = 0 self.__timeouts = 2 self._timeout = 30.0 else: self.__allow_unlock = False self.__timeouts = -1 self._timeout = None return self
def _modem_main(): state = None while True: previous = state state = _modem.read(timeout=30.0) if state is None: if _exit_requested: break state = previous if state == _modem.State.IDLE: lock_out, local, remote = _arming.get( ('lock_out', 'local', 'remote') ) _indicator.set( _indicator.RED if lock_out else _indicator.GREEN if local else _indicator.CYAN if remote else _indicator.ORANGE ) elif state == _modem.State.ONLINE: _indicator.set(_indicator.BLUE) elif state == _modem.State.OFF_HOOK: _indicator.set(_indicator.MAGENTA) elif state == _modem.State.UNLOCKING: _indicator.set(_indicator.WHITE)