bluez_peripheral.gatt.base module

class bluez_peripheral.gatt.base.HierarchicalServiceInterface[source]

Bases: BaseServiceInterface

Base class for a member of a hierarchy of ServiceInterfaces which should be exported and unexported as a group.

add_child(child)[source]

Adds a child service interface.

Parameters:

child (HierarchicalServiceInterface)

Return type:

None

export(bus, *, num=0, path=None)[source]

Attempts to export this component and all registered children. Either num or path must be provided.

Parameters:
  • bus (MessageBus) – The message bus to export this and all children on.

  • num (int | None) – An optional index of this component within it’s parent.

  • path (str | None) – An optional absolute path indicating where this component should be exported. If no path is specified then this component must have been registered using another components HierarchicalServiceInterface.add_child() method.

Return type:

None

remove_child(child)[source]

Removes a child service interface.

Parameters:

child (HierarchicalServiceInterface)

Return type:

None

unexport()[source]

Attempts to unexport this component and all registered children from the specified message bus.

Return type:

None

class bluez_peripheral.gatt.base.ReadOptionsT

The type of options supplied by a dbus ReadValue access.

alias of TypeVar(‘ReadOptionsT’)

class bluez_peripheral.gatt.base.ServiceAttribute(*args, **kwargs)[source]

Bases: Generic[ReadOptionsT, WriteOptionsT], ABC

Base class for service components with a ReadValue and WriteValue dbus interface.

Parameters:
property service: Service | None

Gets the service that this attribute is a child of.

setter(setter_func)[source]

Decorator for specifying a setter to be called by the ReadValue interface.

Parameters:

setter_func (Callable[[Any, bytes, WriteOptionsT], None] | Callable[[Any, bytes, WriteOptionsT], Awaitable[None]])

Return type:

ServiceAttribute[ReadOptionsT, WriteOptionsT]

class bluez_peripheral.gatt.base.WriteOptionsT

The type of options supplied by a dbus WriteValue access.

alias of TypeVar(‘WriteOptionsT’)