def on_transfer_started(self, session, filename, local_path, total_bytes): session.transfer["progress_dialog"] = BluetoothProgressDialog() session.transfer["progress_dialog"].set_keep_above(True) info = session.server.GetServerSessionInfo(session.object_path) try: dev = Device(Adapter(Manager().get_default_adapter()).create_device(info["BluetoothAddress"])) name = dev.get_alias() except Exception, e: print e name = info["BluetoothAddress"]
def on_transfer_started(self, session, filename, local_path, total_bytes): session.transfer["progress_dialog"] = BluetoothProgressDialog() session.transfer["progress_dialog"].set_keep_above(True) info = session.server.GetServerSessionInfo(session.object_path) try: dev = Device( Adapter(Manager().get_default_adapter()).create_device( info["BluetoothAddress"])) name = dev.get_alias() except Exception, e: print e name = info["BluetoothAddress"]
def __device_found(self, adapter, address, values): print "address", address if address not in adapter.get_address_records(): device_path = adapter.create_device(address) if device_path == "None": return device = Device(device_path) items = [] if not values.has_key("Name"): return print bluetooth_class_to_type(device.get_class()) items.append(DeviceItem(values['Name'], app_theme.get_pixbuf("bluetooth/%s.png" % bluetooth_class_to_type(device.get_class())).get_pixbuf(), device, adapter)) self.device_iconview.add_items(items)
def __device_found(self, adapter, address, values): print "address", address if address not in adapter.get_address_records(): device_path = adapter.create_device(address) if device_path == "None": return device = Device(device_path) items = [] if not values.has_key("Name"): return print bluetooth_class_to_type(device.get_class()) items.append( DeviceItem( values['Name'], app_theme.get_pixbuf( "bluetooth/%s.png" % bluetooth_class_to_type( device.get_class())).get_pixbuf(), device, adapter)) self.device_iconview.add_items(items)
def get_devices(self): ret = [] if self.adapter == None: return ret devices = self.adapter.get_devices() i = 0 ret = [] while i < len(devices): ret.append(Device(devices[i])) i += 1 return ret
def _add_device(self, path): """ method called when a new DBUS devices is detected :param path: dbus path :type path: str :return: None """ if path not in self._map_devices: dbus_obj = self._bus.get_object(Consts.Bt.SVC_NAME, path) dev = Device(dbus_obj, Consts.Bt.DEV_IFACE) self._devices[str(dev.address)] = dev self._map_devices[path] = str(dev.address) self._events.DeviceAdded(path, dev.address) else: self.logger.debug("device %s already scanned" % str(self._map_devices[path]))