bluetooth_mesh.application¶
Application¶
- class bluetooth_mesh.application.CompositionDataMixin[source]¶
Provides propertied to company id, product id, version id and replay protection list size.
These are used by
bluetooth_mesh.interfaces.ApplicationInterface
to expose them via D-Bus.- COMPANY_ID = 65253¶
- CRPL = 32767¶
- PRODUCT_ID = 66¶
- VERSION_ID = 1¶
- property company_id: int¶
- property crpl: int¶
- property product_id: int¶
- property version_id: int¶
- class bluetooth_mesh.application.TokenRingMixin[source]¶
Provides a token ring handler based on application UUID.
The handler is responsible for token ring persistence: the framework expects that tokens for nodes of a single application are stored & reused with subsequent launches.
- TOKEN_RING¶
alias of
TokenRing
- property token_ring: TokenRing¶
- class bluetooth_mesh.application.MachineUUIDMixin[source]¶
Provides uuid property based on systemd’s machine-id.
- property uuid: UUID¶
- class bluetooth_mesh.application.PathMixin[source]¶
Provides path property under which py:class:bluetooth_mesh.interfaces.ApplicationInterface will be registered on D-Bus.
- PATH = '/com/silvair/application'¶
- property path: str¶
- class bluetooth_mesh.application.DeviceKeyMixin[source]¶
- property dev_key: DeviceKey¶
Application’s device_key. Used when creating a new node, see
Application.import_node()
.
- class bluetooth_mesh.application.NetworkKeyMixin[source]¶
- property primary_net_key: Tuple[int, NetworkKey]¶
Index and key of the network that the application belongs to. Used when creating a new node, see
Application.import_node()
.
- property subnet_keys: List[Tuple[int, NetworkKey]]¶
Indexes and keys of the subnets.
- class bluetooth_mesh.application.Application(loop)[source]¶
Base class for mesh applications.
- DBUS_SERVICE¶
alias of
MeshService
- ELEMENTS = {}¶
- async add_app_key(net_key_index, app_key_index, app_key)[source]¶
Imports an application key into daemon’s keyring.
- Parameters:
net_key_index (
int
) – Index of the network key the new application key is bound toapp_key_index (
int
) – Index of the new application keyapp_key (
ApplicationKey
) – Value of the new application key
- Return type:
AppKeyStatus
- async add_net_key(net_key_index, net_key)[source]¶
Imports a network key into daemon’s keyring.
- Parameters:
net_key_index (
int
) – Index of the network keynet_key (
NetworkKey
) – Value of the new network key
- Return type:
Any
- async attach(token, *, socket_pair=False, socket_path=None)[source]¶
Attach to existing node using a token.
Returns current node configuration, see documentation for Attach() method in mesh-api.txt_.
- async bind_app_key(app_key_index, model)[source]¶
See
Model.bind()
instead.- Return type:
ModelBindStatus
- async clear_subscriptions(model)[source]¶
See
Model.unsubscribe_all()
instead.- Return type:
ModelSubscriptionStatus
- async connect(join_callback=None, **kwargs)[source]¶
Connect to BlueZ. If a node doesn’t exist yet, it gets created via Import() call, using self.dev_key, self.primary_net_key, self.address and self.iv_index.
Returns current node configuration, see documentation for Attach() method in mesh-api.txt_.
- Return type:
Mapping
[int
,Dict
[Tuple
[int
,int
],Dict
[str
,Tuple
[Any
,int
]]]]
- async delete_app_key(net_key_index, app_key_index)[source]¶
Removes an application key from daemon’s keyring.
- Parameters:
net_key_index (
int
) – Index of the network key the deleted application key is bound toapp_key_index (
int
) – Index of the deleted application key
- Return type:
AppKeyStatus
- async delete_net_key(net_key_index)[source]¶
Removes a network key from daemon’s keyring.
- Parameters:
net_key_index (
int
) – Index of the network keynet_key – Value of the new network key
- Return type:
Any
- async import_node(join_callback=None, key_refresh=False)[source]¶
Create a self-provisioned node.
- Return type:
int
- async join()[source]¶
Try to join a mesh network by broadcasting Unprovisioned Device Beacons, waiting for PB-ADV based provisioner.
Element¶
- class bluetooth_mesh.application.LocationMixin[source]¶
Provides location property.
- LOCATION = None¶
- property location: int¶
- class bluetooth_mesh.application.Element(application, index)[source]¶
Base class for elements.
- MODELS = []¶
- dev_key_message_received(source, remote, net_index, data)[source]¶
Called by
bluetooth_mesh.interfaces.ElementInterface
when receiving a message encrypted with device key.The message is parsed using
bluetooth_mesh.messages.AccessMessage
and (depending on the opcode) passed to relevant models’bluetooth_mesh.models.Model.dev_key_message_received()
.
- message_received(source, app_index, destination, data)[source]¶
Called by
bluetooth_mesh.interfaces.ElementInterface
when receiving a message encrypted with application key.The message is parsed using
bluetooth_mesh.messages.AccessMessage
and (depending on the opcode) passed to relevant models’message_received()
.
- property models: List[Tuple[int, bool, bool]]¶
Used by
bluetooth_mesh.interfaces.ApplicationInterface
to expose a list of supported SIG models via D-Bus.
- update_model_configuration(model_id, configuration)[source]¶
Called by
bluetooth_mesh.interfaces.ElementInterface
when model configuration is updated via daemon’s internal Config Server model.Passes the configuration to relevant model’s
bluetooth_mesh.models.Model.update_configuration()
.
- property vendor_models: List[Tuple[Tuple[int, int], bool, bool]]¶
Used by
bluetooth_mesh.interfaces.ApplicationInterface
to expose a list of supported vendor models via D-Bus.