-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Refactor NimBLEAdvertisementData/NimBLEExtAdvertising #274
Conversation
thekurtovic
commented
Dec 21, 2024
•
edited
Loading
edited
- NimBLEUtils added method to get UUID type from size.
- NimBLEUtils added method to get service data UUID type from size.
- NimBLEUUID added method to get location within payload.
- NimBLEUUID added method as wrapper for NimBLEUtils::getUUIDType().
67ca9bc
to
b431f7f
Compare
Thanks! Good idea, I think changing the name to |
b431f7f
to
48cf5f3
Compare
Done. |
2164ed0
to
ae270ac
Compare
1d504bf
to
133a242
Compare
* NimBLEUtils added method to get UUID type from size. * NimBLEUtils added method to get service data UUID type from size. * NimBLEUUID added method to get location within payload. * NimBLEUUID added method as wrapper for NimBLEUtils::getType().
133a242
to
c853340
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the consolidation idea, I think another approach may be better though.
I'm thinking these utility functions belong more in the advertising data class and that extended advertising should use or inherit from the class to keep the code all in one place to reduce the duplication.
return 0; | ||
} | ||
} // getServiceType | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the return value of these only relates to and is only used for advertising I feel they would be better placed in the advertising classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also rename getServiceType
to getServiceDataType
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points
} | ||
return -1; | ||
} // getLoc | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure these belong in the uuid class since the type returned is an advertisement uuid type and not the actual uuid type and getLoc
probably isnt useful outside of advertising data. Not sure what the use case is as a public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly this one didn't really make sense to me, but was purely in the pursuit of avoiding duplicate code. I put it in NimBLEUUID
since the snippet was accessing accessing a UUID object originally.
Has no business being public really.
I had considered the same, and thought that would be more appropriate but didn't want to go down that route in case you had any objections to a big change. |
Since this isn't really essential at the moment I think it best to refactor with the larger scale approach so the changes make more sense to the overall classes. Not sure yet if inheritance is the best approach or if the extended advertising class should just have a member variable of |