Skip to content

Commit

Permalink
Public-Auto-release: v2.19.3
Browse files Browse the repository at this point in the history
# Changed
* Doc: Improve example descriptions
* Use only major and minor version for compatibility warning
  • Loading branch information
blickfeld-lidar committed Apr 13, 2021
1 parent cb32f01 commit cd31511
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 8 deletions.
6 changes: 6 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/ssl/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/python/custom_trigger/README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion examples/python/custom_trigger/custom_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions include/blickfeld/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#define _USE_MATH_DEFINES
#include <cmath>

#include <tuple>

namespace blickfeld {

namespace os {
Expand All @@ -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<int, int, int> parse_version(const std::string version_str);

}

#endif // BLICKFELD_UTILS_H
12 changes: 11 additions & 1 deletion python/blickfeld_scanner/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
16 changes: 12 additions & 4 deletions src/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 6 additions & 0 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, int, int> 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

0 comments on commit cd31511

Please sign in to comment.