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

Bluetooth: Mesh: Persistent storage of Virtual Addresses #19799

Merged
merged 1 commit into from
Oct 17, 2019
Merged

Bluetooth: Mesh: Persistent storage of Virtual Addresses #19799

merged 1 commit into from
Oct 17, 2019

Conversation

LingaoM
Copy link
Collaborator

@LingaoM LingaoM commented Oct 14, 2019

The 16-bit format group addresses will be stored,
but we don't store (or restore) the virtual label UUIDs,
i.e. after a power cycle the 16-bit group addresses
would be meaningless.

Fixes #19342

Signed-off-by: Lingao Meng mengabc1086@gmail.com

@jhedberg
Copy link
Member

jhedberg commented Oct 14, 2019

How does this relate to #19499? Why did you open a new PR instead of continuing with the existing one?

@zephyrbot
Copy link
Collaborator

zephyrbot commented Oct 14, 2019

All checks are passing now.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@LingaoM
Copy link
Collaborator Author

LingaoM commented Oct 14, 2019

This PR should be more concise than before.

Copy link
Contributor

@trond-snekvik trond-snekvik left a comment

Choose a reason for hiding this comment

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

All my comments from the previous PR have been resolved 👍

I think the get_label() function in cfg_srv.c is a code smell, and it'd be better to take the index as a parameter to that function. That way, we'd encapsulate the array and its boundary. We'd still be manipulating another module's data though, but this is kind of the nature of the settings module.

@jhedberg: Perhaps the settings module should be restructured to only be a multiplexer for the "bt/mesh" settings directory, and the handlers should go into their respective modules? In a separate task, of course.

@jhedberg
Copy link
Member

@jhedberg: Perhaps the settings module should be restructured to only be a multiplexer for the "bt/mesh" settings directory, and the handlers should go into their respective modules? In a separate task, of course.

@trond-snekvik yes, sounds like a good idea

subsys/bluetooth/mesh/cfg_srv.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/settings.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/settings.c Outdated Show resolved Hide resolved
@LingaoM LingaoM requested a review from trond-snekvik October 16, 2019 12:22
Copy link
Member

@jhedberg jhedberg left a comment

Choose a reason for hiding this comment

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

Could you please squash these 5 patches into a single one (using e.g. git rebase -i and then git push --force to update this PR? Otherwise the result looks good and mergeable to me.

Copy link
Member

@jhedberg jhedberg 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 doing the squashing. I have a few more coding-style related comments, sorry about missing those issues earlier!

subsys/bluetooth/mesh/settings.c Outdated Show resolved Hide resolved
@@ -112,12 +112,25 @@
#define STATUS_UNSPECIFIED 0x10
#define STATUS_INVALID_BINDING 0x11

enum label_flag {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you necessarily need a name for this enum, at least I don't think I saw you use the name anywhere

subsys/bluetooth/mesh/foundation.h Outdated Show resolved Hide resolved

if (err) {
BT_ERR("Failed to %s %s value",
IS_VA_DEL(lab)?"delete":"store",
Copy link
Member

Choose a reason for hiding this comment

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

Minor coding style: there should be spaces before & after ? and :

subsys/bluetooth/mesh/settings.c Outdated Show resolved Hide resolved
@LingaoM LingaoM requested a review from jhedberg October 17, 2019 07:14
The 16-bit format group addresses will be stored,
but we don't store (or restore) the virtual label UUIDs,
i.e. after a power cycle the 16-bit group addresses
would be meaningless.

Fixes #19342

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
@jhedberg
Copy link
Member

@LingoMeng please stop pushing to this PR, I've fixed up some coding style issues and pushed them to it, and I've approved the PR, so let's just wait for CI to finish so we can merge it.

@jhedberg jhedberg merged commit 101ad56 into zephyrproject-rtos:master Oct 17, 2019
@LingaoM LingaoM deleted the fix_store_virtual branch October 18, 2019 07:50
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jan 13, 2021
The mesh settings.c module is a giant piece of code responsible for
storing the mesh stack configuration. Such approach makes it difficult
to control the data to be stored, breaks the stack modules'
encapsulation by forcing them to reveal the internal kitchen, which
leads to unpleasant issues such as zephyrproject-rtos#19799.

This commit moves the responsibility of storing the configuration
to corresponding modules while keeping control of the moment of storing
the configuration and of starting the stack after the settingss loading
is completed.

This doesn't introduce any abstraction between the mesh settings.c and
other modules as it will add more complexity and overhead than necessary
for the actual task.

Fixes zephyrproject-rtos#19850

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
jhedberg pushed a commit that referenced this pull request Jan 14, 2021
The mesh settings.c module is a giant piece of code responsible for
storing the mesh stack configuration. Such approach makes it difficult
to control the data to be stored, breaks the stack modules'
encapsulation by forcing them to reveal the internal kitchen, which
leads to unpleasant issues such as #19799.

This commit moves the responsibility of storing the configuration
to corresponding modules while keeping control of the moment of storing
the configuration and of starting the stack after the settingss loading
is completed.

This doesn't introduce any abstraction between the mesh settings.c and
other modules as it will add more complexity and overhead than necessary
for the actual task.

Fixes #19850

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluetooth: Mesh: Persistent storage of Virtual Addresses
4 participants