At the beginning of the year, we set out our road map for the software and libraries we offer. This week, we published the first batch of libraries officially upgraded to v2.0. These are the C++, C#, VB.net, and Python libraries.
These libraries have already been available as previews for some time, but as of today they become the official versions. They replace the old 1.10 versions.
The main two new features of these libraries are TLS-based communication encryption support and IPv6 support. Communication encryption currently only works with VirtualHub v2.0 and VirtualHub for Web, but other new releases are due to arrive that should take advantage of this feature.
TLS
To use a secure connection, simply add the "secure://" prefix to the VirtualHub address when calling YAPI::RegisterHub. The "secure://" prefix forces the library to establish an encrypted connection. If the library tries to connect to a hub that doesn't support data encryption, the call returns an error.
if (YAPI::RegisterHub("secure://vhub.example.com", errmsg) != YAPI_SUCCESS) {
cerr << "YAPI::RegisterHub failed: " << errmsg << endl;
}
...
The "secure://" prefix tries to connect using the "WebSocket Secure" protocol first, and falls back to HTTPS if it's not available (Ex VirtualHub for Web). If you want to force a particular type of connection, you can use the "https://" and "wss://" prefixes.
We've already published several posts on this topic:
- Preview of the new C++ 2.0 library
- TLS certificates and the C++ 2.0 library
- Preview of the new C#, Python and VB .Net libraries
IPv6
IPv6 support is a feature that should concern very few people. Indeed, most machines continue to support IPv4, but some of our customers have IPv6-only infrastructures. If this applies to you, you can now use these libraries.
In the following example, the library connects to the IPv6 address "fe80::471b:5e9a:dfd3:8c70".
if (YAPI.RegisterHub("[fe80::471b:5e9a:dfd3:8c70]", ref errsmg) != YAPI.SUCCESS){
MessageBox.Show("RegisterHub error:" + errsmg)
}
For more details, see our previous post: Yoctopuce and IPv6.
How to obtain these libraries
New versions of these libraries are available through the same channels as v1.10. They can be downloaded from our website or from GitHub. The C# and VB.net libraries are available as NuGet packages from the Nuget.org repository. The Python library is available as a PyPI package. In all cases, simply update your library with the same commands you are used to.
The following command updates the Python library using the PyPI package
Conclusion
As usual, these libraries are backward compatible, and can be used as is with applications written for version 1.10.
If you inspect the code, you'll notice that we've also made a few small fixes and changes here and there. But if you're used to our tools, you shouldn't feel out of place.