示例#1
0
    def _get_regstatus(self, first_time=False):
        self.device.GetRegistrationInfo(dbus_interface=NET_INTFACE,
                            reply_handler=self._get_regstatus_cb,
                            error_handler=lambda e:
                                logger.warn("Error getting registration "
                                            "status: %s " % get_error_msg(e)))

        if not first_time and self.status != _("Scanning"):
            return False
示例#2
0
    def _get_config(self):
        uuid = self.conf.get('profile', 'uuid')
        if uuid and not self.profile:
            from wader.gtk.profiles import manager
            try:
                profile = manager.get_profile_by_uuid(uuid)
                if profile:
                    profiles_model = self.preferences_model.profiles_model
                    model = ProfileModel(profiles_model, profile=profile,
                                         device_callable=lambda: self.device)
                    profiles_model.add_profile(model)
                    self.profile = model

                return
            except Exception, e:
                logger.warn("Error loading initial profile %s %s" % (uuid, e))

            logger.warn("No profile, creating one")
            # ugly and breaks MVC but necessary
            self.ctrl.ask_for_new_profile()
示例#3
0
    def _get_devices_cb(self, opaths):
        if len(opaths):
            if self.device_opath:
                logger.warn("Device %s is already active" % self.device_opath)
                return

            self.device_opath = opaths[0]
            logger.info("Setting up device %s" % self.device_opath)
            self.device = self.bus.get_object(WADER_SERVICE, self.device_opath)

            self.pin_required = False
            self.puk_required = False
            self.puk2_required = False
            self.total_bytes = self.conf.get('statistics', 'total_bytes', 0)

            self.enable_device()
        else:
            logger.warn("No devices found")

        # connecting to signals is safe now
        self._connect_to_signals()
示例#4
0
    def _enable_device_cb(self):
        logger.info("Device enabled")

        self.pin_required = False
        self.puk_required = False
        self.puk2_required = False

        self.device.connect_to_signal(S.SIG_RSSI, self._rssi_changed_cb)
        self.device.connect_to_signal(S.SIG_NETWORK_MODE,
                                      self._network_mode_changed_cb)

        self.device.GetSignalQuality(dbus_interface=NET_INTFACE,
                                     reply_handler=self._rssi_changed_cb,
                                     error_handler=lambda m:
                                        logger.warn("Cannot get RSSI %s" % m))

        self._start_network_registration()
        # delay the profile creation till the device is completely enabled
        self._get_config()