diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 775b8e7..53751cc 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -13,6 +13,12 @@ influence the resulting point cloud. ### Removed +## [2.19.3] - 2021.04.13 + +### Changed +* Doc: Improve example descriptions +* Use only major and minor version for compatibility warning + ## [2.19.2] - 2021.03.25 ### Changed diff --git a/examples/cpp/ssl/README.md b/examples/cpp/ssl/README.md index 814661a..838a759 100644 --- a/examples/cpp/ssl/README.md +++ b/examples/cpp/ssl/README.md @@ -1,6 +1,6 @@ # SSL connection -This example shows how to connect to a device with a ssl certification. +This example shows how to connect to a device with SSL certification. ```.. literalinclude:: main.cpp :language: cpp diff --git a/examples/python/custom_trigger/README.md b/examples/python/custom_trigger/README.md index 4d4c2a3..e717036 100644 --- a/examples/python/custom_trigger/README.md +++ b/examples/python/custom_trigger/README.md @@ -1,6 +1,6 @@ # Custom Trigger -Configure custom triggers and retrieve a point cloud with these settings. +Configure custom triggers and retrieve a point cloud for the trigger set. This example will stop after 10 received frames. diff --git a/examples/python/custom_trigger/custom_trigger.py b/examples/python/custom_trigger/custom_trigger.py index d41e5ec..3af7c92 100644 --- a/examples/python/custom_trigger/custom_trigger.py +++ b/examples/python/custom_trigger/custom_trigger.py @@ -13,7 +13,7 @@ from blickfeld_scanner.protocol.config import scan_pattern_pb2 def custom_trigger(target, horizontal_angle): - """Configure custom triggers and retrieve a point cloud with these settings + """Configure custom triggers and retrieve a point cloud for the trigger set. This example will stop after 10 received frames. diff --git a/include/blickfeld/utils.h b/include/blickfeld/utils.h index b44a939..5221127 100644 --- a/include/blickfeld/utils.h +++ b/include/blickfeld/utils.h @@ -55,6 +55,8 @@ #define _USE_MATH_DEFINES #include +#include + namespace blickfeld { namespace os { @@ -80,6 +82,8 @@ int get_scanline_id_by_point_id(const Frame& frame, const uint32_t point_id); } // namespace data } // namespace protocol +const std::tuple parse_version(const std::string version_str); + } #endif // BLICKFELD_UTILS_H diff --git a/python/blickfeld_scanner/scanner.py b/python/blickfeld_scanner/scanner.py index b42abe9..4ecd86a 100644 --- a/python/blickfeld_scanner/scanner.py +++ b/python/blickfeld_scanner/scanner.py @@ -70,8 +70,18 @@ def __init__(self, hostname_or_ip="localhost", port=None, name=None, key_and_cer self._connection = self.create_connection() self._hello = self.hello() + # Compare library version of server and client if __version__ != self._hello.library_version: - warnings.warn("Warning: The client BSL version does not match the server BSL version. Client has '%s', server has '%s'." % (__version__, self._hello.library_version), DeprecationWarning, stacklevel=2) + def parse_version(version_str): + return [int(x) for x in version_str.split(".")] + + local_version = None + if self._hello.library_version and __version__: + local_version = [int(x) if x.isdecimal() else None for x in __version__.split(".")] + server_version = [int(x) if x.isdecimal() else None for x in self._hello.library_version.split(".")] + # Only warn if major or minor version does not match + if local_version is None or len(local_version) < 3 or len(server_version) < 3 or local_version[0] != server_version[0] or local_version[1] != server_version[1]: + warnings.warn("Warning: The client BSL version does not match the server BSL version. Client has '%s', server has '%s'." % (__version__, self._hello.library_version), DeprecationWarning, stacklevel=2) def __del__(self): if hasattr(self, "_connection"): diff --git a/src/scanner.cpp b/src/scanner.cpp index cdb6940..221a9f3 100644 --- a/src/scanner.cpp +++ b/src/scanner.cpp @@ -172,10 +172,18 @@ scanner::scanner(std::string hostname_or_ip, std::string cert_key_file) : protocol::Response::Hello _hello; __hello(&_hello); - if (std::string(BSL_VERSION) != _hello.library_version()) - log_warning("Warning: The client BSL version does not match the server BSL version. Client has '%s', server has '%s'.\n", - BSL_VERSION, - _hello.library_version().c_str()); + + // Compare library version of server and client + if (std::string(BSL_VERSION) != _hello.library_version()) { + auto local_version = parse_version(std::string(BSL_VERSION)); + auto server_version = parse_version(_hello.library_version()); + + // Only warn if major or minor version does not match + if (std::get<0>(local_version) != std::get<0>(server_version) || std::get<1>(local_version) != std::get<1>(server_version)) + log_warning("Warning: The client BSL version does not match the server BSL version. Client has '%s', server has '%s'.\n", + BSL_VERSION, + _hello.library_version().c_str()); + } } scanner::~scanner() { diff --git a/src/utils.cpp b/src/utils.cpp index 9cd8ae8..ec5e13b 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -141,4 +141,10 @@ int get_scanline_id_by_point_id(const Frame& frame, const uint32_t point_id) { } // namespace data } // namespace protocol +const std::tuple parse_version(const std::string version_str) { + int major = -1, minor = -1, patch = -1; + sscanf(version_str.c_str(), "%d.%d.%d", &major, &minor, &patch); + return std::make_tuple(major, minor, patch); +} + } // namespace blickfeld