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

have a way to detect BTstack version at compile time #640

Closed
ricardoquesada opened this issue Oct 31, 2024 · 3 comments
Closed

have a way to detect BTstack version at compile time #640

ricardoquesada opened this issue Oct 31, 2024 · 3 comments

Comments

@ricardoquesada
Copy link
Contributor

ricardoquesada commented Oct 31, 2024

Is your feature request related to a problem? Please describe.
Recently the API to use the btstack_hid_parser_t changed in a way that is not backward compatible.
In added usage_iterator.

Libraries that depend on BTstack (like Bluepad32) might use latest BTstack version (when bundled with Bluepad32), or might use the BTstack bundled with PicoSDK (which uses the old API).

For example, Bluepad32 (and other libraries) could use something like:

#if defined __has_include
#  if __has_include (<btstack_version.h>)
#    include <btstack_version.h>
#    ... compare-version
#    ... define use_new_api..
#  else
#   ... define use_old_api...
#endif

And btstack_version.h could have something like:

#define BTSTACK_VERSION_MAJOR 1
#define BTSTACK_VERSION_MINOR 6
#define BTSTACK_VERSION_PATCH 1

// optional: but useful to print in the logs
#define BTSTACK_VERSION_STRING "1.6.1"

Describe the solution you'd like
Before releasing a new stable version, it would be great to have a header file that has the BTstack version defined.
Based on that I can either use one API, or the other.

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

@mringwal
Copy link
Member

Hi @ricardoquesada Fair request. There's already another feature request on the issue tracker.

Ideally, it would use the version and git hash, however, that's not possible across any all platforms.

However, updating a version file manually per release sounds doable.

@mringwal
Copy link
Member

We've added a btstack_version.h on develop branch file that's included by btstack_defines.h to simplify the transition.
If BTSTACK_VERSION_MAJOR is not defined, it's v1.6.1 or older. Otherwise you can check the version.

@ricardoquesada
Copy link
Contributor Author

Thanks!

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

No branches or pull requests

2 participants