Ejemplo n.º 1
0
    def __init__(self, instance):
        GObject.GObject.__init__(self)

        self.Properties = {}
        self.Temp = False

        if hasattr(instance, "format") and hasattr(instance, "upper"):
            self.Device = BluezDevice(instance)
        else:
            self.Device = instance

        #set fallback icon, fixes lp:#327718
        self.Device.Icon = "blueman"
        self.Device.Class = "unknown"

        self.Valid = True

        dprint("caching initial properties")
        self.Properties = self.Device.get_properties()

        w = weakref.ref(self)
        self._obj_path = self.Device.get_object_path()
        self.Device.connect_signal('property-changed',
                                   lambda _device, key, value: w() and w().property_changed(key, value))
        self._any_adapter = Adapter()
        self._any_adapter.connect_signal('device-removed',
                                         lambda _adapter, path: w() and w().on_device_removed(path))
Ejemplo n.º 2
0
    def RfcommDisconnect(self, device, rfdevice):
        dev = Device(BluezDevice(device))
        dev.Services["serial"].Disconnect(rfdevice)

        self.Applet.Plugins.Run("on_rfcomm_disconnect", rfdevice)

        dprint("Disonnecting rfcomm device")
Ejemplo n.º 3
0
    def __init__(self, instance):
        GObject.GObject.__init__(self)

        self.Properties = {}
        self.Fake = True
        self.Temp = False

        if isinstance(instance, str) or isinstance(instance, unicode):
            self.Device = BluezDevice(instance)
        else:
            self.Device = instance

        #set fallback icon, fixes lp:#327718
        self.Device.Icon = "blueman"
        self.Device.Class = "unknown"

        self.__services = {}

        self.Valid = True

        self.Signals = SignalTracker()

        dprint("caching initial properties")
        self.Properties = self.Device.get_properties()

        if not "Fake" in self.Properties:
            self.Fake = False

        w = weakref.ref(self)
        if not self.Fake:
            self._obj_path = self.Device.get_object_path()
            self.Signals.Handle(
                "bluez", self.Device,
                lambda key, value: w() and w().property_changed(key, value),
                "PropertyChanged")
            object_path = self.Device.get_object_path()
            adapter = Adapter(
                object_path.replace("/" + os.path.basename(object_path), ""))
            self.Signals.Handle(
                "bluez", adapter,
                lambda path: w() and w().on_device_removed(path),
                "DeviceRemoved")
Ejemplo n.º 4
0
 def on_network_property_changed(self, key, value, path):
     dprint(key, value, path)
     if key == "Interface" and value != "":
         d = BluezDevice(path)
         d = Device(d)
         self.monitor_interface(Monitor, d, value)
Ejemplo n.º 5
0
 def _on_network_property_changed(self, network, key, value):
     if key == "Interface" and value != "":
         d = BluezDevice(network.get_object_path())
         d = Device(d)
         self.monitor_interface(Monitor, d, value)