Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement bluetooth mesh support #60

Merged
merged 15 commits into from
Jun 20, 2023
Merged

Implement bluetooth mesh support #60

merged 15 commits into from
Jun 20, 2023

Conversation

dejanb
Copy link
Contributor

@dejanb dejanb commented Nov 23, 2022

This is an initial implementation of the support for Bluetooth mesh API as discussed in issue #37

It supports at the moment:

  • Joining and provisioning mesh networks
  • Sending and receiving messages

Some functionalities that are not implemented yet:

  • Scanning
  • Importing/Exporting
  • Managing keys

Currently implemented features are quite stable and we used them to implement the gateway for the EclipseCon Hackathon. They should be a good base for the further development.

The implementation depends on the btmesh crate for representing Bluetooth mesh models. We'll release this crate shortly, so that git dependency can be removed.

Please let me know if you have any further questions about this. Any feedback is more than welcomed.

@surban surban self-requested a review December 14, 2022 18:57
@surban surban self-assigned this Dec 14, 2022
Copy link
Collaborator

@surban surban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the effort to implement support for mesh networks!

However, a bit more work is required before I can merge this.

The main issue is the exposure of D-Bus paths, which we treat as internals in BlueR. See how the GATT server is implemented on how to do it without exposing D-Bus paths to the user.

Also we target stable Rust, thus you must remove the use of nightly features. However, we can bump the minimum supported Rust version to the newest stable version, so GATs should be usable by now.

In general, a bit more documentation is required. Explain what the functions do from the Bluetooth side of things and how they interact.

I haven't tested your code yet. Please make the above changes and then I will have a more in-depth look and provide further comments.

Also, what would I require for testing? Would it be possible to make a Bluetooth Mesh out of some Raspberry Pis?

bluer/src/mesh/agent.rs Outdated Show resolved Hide resolved
bluer/src/mesh/agent.rs Outdated Show resolved Hide resolved
bluer/src/mesh/application.rs Outdated Show resolved Hide resolved
pub version: u16,
}

impl Default for Properties {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not provide such defaults for identifiers that should be unique.

bluer/src/mesh/application.rs Outdated Show resolved Hide resolved
bluer/src/mesh/types.rs Outdated Show resolved Hide resolved
bluer/src/lib.rs Outdated Show resolved Hide resolved
bluer/Cargo.toml Outdated Show resolved Hide resolved
@@ -0,0 +1,168 @@
#![feature(generic_associated_types)]
//! Attach and send/receive BT Mesh messages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be useful as a standalone tool?
Then consider moving it to bluer-tools and properly documenting the CLI arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is just an example for now (as it is tied to the predefined model) ... The proper tool needs more work

@@ -46,3 +46,4 @@ libc = "0.2"
log = "0.4"
hex = { version = "0.4" }
rand = "0.8"
uuid = { version = "1", features = ["v4"] }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary

Copy link
Collaborator

@surban surban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the effort to implement support for mesh networks!

However, a bit more work is required before I can merge this.

The main issue is the exposure of D-Bus paths, which we treat as internals in BlueR. See how the GATT server is implemented on how to do it without exposing D-Bus paths to the user.

Also we target stable Rust, thus you must remove the use of nightly features. However, we can bump the minimum supported Rust version to the newest stable version, so GATs should be usable by now.

In general, a bit more documentation is required. Explain what the functions do from the Bluetooth side of things and how they interact.

I haven't tested your code yet. Please make the above changes and then I will have a more in-depth look and provide further comments.

Also, what would I require for testing? Would it be possible to make a Bluetooth Mesh out of some Raspberry Pis?

@surban surban added the enhancement New feature or request label Dec 15, 2022
@dejanb
Copy link
Contributor Author

dejanb commented Dec 16, 2022

Thanks for reviewing it and the valuable feedback, I'll start addressing the particular comments in the coming days. I was expecting some work to be done before the merge. I was developing it to meet our demo needs for a while and now that it looks stable to me, it made sense to continue development within the bluer project umbrella.

As for the testing, yes you can use rPi (or any other bluetooth-enabled Linux machine) to run and test everything. The descriptions in the examples should get you going

otaviojr added a commit to otaviojr/bluer that referenced this pull request May 10, 2023
# This is the 1st commit message:

BLE Passive Scanning

# This is the commit message #2:

monitor

# This is the commit message bluez#3:

monitor

# This is the commit message bluez#4:

monitor

# This is the commit message bluez#5:

monitor

# This is the commit message bluez#6:

monitor

# This is the commit message bluez#7:

monitor

# This is the commit message bluez#8:

monitor

# This is the commit message bluez#9:

monitor

# This is the commit message bluez#10:

monitor

# This is the commit message bluez#11:

monitor

# This is the commit message bluez#12:

monitor

# This is the commit message bluez#13:

monitor

# This is the commit message bluez#14:

monitor

# This is the commit message bluez#15:

monitor

# This is the commit message bluez#16:

monitor

# This is the commit message bluez#17:

monitor

# This is the commit message bluez#18:

monitor

# This is the commit message bluez#19:

monitor

# This is the commit message bluez#20:

monitor

# This is the commit message bluez#21:

monitor

# This is the commit message bluez#22:

monitor

# This is the commit message bluez#23:

monitor

# This is the commit message bluez#24:

monitor

# This is the commit message bluez#25:

monitor

# This is the commit message bluez#26:

monitor

# This is the commit message bluez#27:

monitor

# This is the commit message bluez#28:

monitor

# This is the commit message bluez#29:

monitor

# This is the commit message bluez#30:

monitor

# This is the commit message bluez#31:

monitor

# This is the commit message bluez#32:

monitor

# This is the commit message bluez#33:

monitor

# This is the commit message bluez#34:

monitor

# This is the commit message bluez#35:

monitor

# This is the commit message bluez#36:

monitor

# This is the commit message bluez#37:

monitor

# This is the commit message bluez#38:

monitor

# This is the commit message bluez#39:

monitor

# This is the commit message bluez#40:

monitor

# This is the commit message bluez#41:

monitor

# This is the commit message bluez#42:

monitor

# This is the commit message bluez#43:

monitor

# This is the commit message bluez#44:

monitor

# This is the commit message bluez#45:

monitor

# This is the commit message bluez#46:

monitor

# This is the commit message bluez#47:

monitor

# This is the commit message bluez#48:

monitor

# This is the commit message bluez#49:

monitor

# This is the commit message bluez#50:

monitor

# This is the commit message bluez#51:

monitor

# This is the commit message bluez#52:

monitor

# This is the commit message bluez#53:

monitor

# This is the commit message bluez#54:

monitor

# This is the commit message bluez#55:

monitor

# This is the commit message bluez#56:

monitor

# This is the commit message bluez#57:

monitor

# This is the commit message bluez#58:

monitor

# This is the commit message bluez#59:

monitor

# This is the commit message bluez#60:

monitor

# This is the commit message bluez#61:

monitor

# This is the commit message bluez#62:

monitor
@surban surban linked an issue Jun 13, 2023 that may be closed by this pull request
@surban
Copy link
Collaborator

surban commented Jun 20, 2023

I've revised the Pull Request to align with BlueR's API style and am preparing to merge it now.

I've eliminated the dependency on the btmesh-* crates temporarily. This means message generation and parsing responsibilities will now fall on the user. In my view, an optimal solution would be to introduce extension traits in btmesh for the BlueR types Node and ReceivedMessage. This would then facilitate message generation and parsing via these traits. As such, BlueR would solely manage the API-surface exposed by BlueZ, treating mesh messages as binary data.

For the time being, the mesh examples have been deactivated. Could you kindly update them and submit a follow-up PR?

@surban surban merged commit 1173222 into bluez:master Jun 20, 2023
1 check passed
@dejanb
Copy link
Contributor Author

dejanb commented Jun 23, 2023

@surban Thanks for picking it up ... My work priorities shifted lately and I didn't have time to commit to it.

I'll try to introduce btmesh through extension traits as you suggested and make examples work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Mesh API
2 participants