def __init__(self, uuid, primary, type='peripheral'):
"""Default initialiser.
1. Registers the service on the D-Bus.
2. Sets up the service UUID and primary flags.
3. Initialises the list of characteristics associated with the service.
:param uuid: service BLE UUID
:param primary: whether or not the service is a primary service
"""
# Setup D-Bus object paths and register service
self.index = id(self)
self.path = self.PATH_BASE + str(self.index)
self.bus = dbus.SystemBus()
dbus.service.Object.__init__(self, self.bus, self.path)
# Setup UUID, primary flag
self.uuid = uuid
self.primary = primary
self.type = type
self.service_data = None
# Initialise characteristics within the service
self.characteristics = []
评论列表
文章目录