def __init__(self, index, uuid, primary): self.bus = BleTools.get_bus() self.path = self.PATH_BASE + str(index) self.uuid = uuid self.primary = primary self.characteristics = [] self.next_index = 0 dbus.service.Object.__init__(self, self.bus, self.path)
def __init__(self): dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) self.mainloop = GObject.MainLoop() self.bus = BleTools.get_bus() self.path = "/" self.services = [] self.next_index = 0 dbus.service.Object.__init__(self, self.bus, self.path)
def unregister(self): bus = BleTools.get_bus() adapter = BleTools.find_adapter(bus) ad_manager = dbus.Interface( bus.get_object(BLUEZ_SERVICE_NAME, adapter), LE_ADVERTISING_MANAGER_IFACE) ad_manager.UnregisterAdvertisement(self.get_path()) print("GATT advertisement UNregistered")
def __init__(self, index, advertising_type): self.path = self.PATH_BASE + str(index) self.bus = BleTools.get_bus() self.ad_type = advertising_type self.local_name = None self.service_uuids = None self.solicit_uuids = None self.manufacturer_data = None self.service_data = None self.include_tx_power = None dbus.service.Object.__init__(self, self.bus, self.path)
def register(self): bus = BleTools.get_bus() adapter = BleTools.find_adapter(bus) ad_manager = dbus.Interface( bus.get_object(BLUEZ_SERVICE_NAME, adapter), LE_ADVERTISING_MANAGER_IFACE) ad_manager.RegisterAdvertisement( self.get_path(), {}, reply_handler=self.register_ad_callback, error_handler=self.register_ad_error_callback)