File tree Expand file tree Collapse file tree 5 files changed +32
-0
lines changed
Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ set_target_properties(absscpi PROPERTIES
9898
9999target_compile_features (absscpi PUBLIC cxx_std_20)
100100
101+ target_compile_definitions (absscpi PRIVATE
102+ "ABSSCPI_VERSION=((${PROJECT_VERSION_MAJOR} * 10000)+(${PROJECT_VERSION_MINOR} *100)+(${PROJECT_VERSION_PATCH} ))"
103+ )
104+
101105if (MSVC )
102106 target_compile_options (absscpi PRIVATE /W3)
103107else ()
Original file line number Diff line number Diff line change @@ -189,6 +189,18 @@ typedef struct AbsSerialDiscoveryResult {
189189} AbsSerialDiscoveryResult ;
190190/** @} */
191191
192+ /**
193+ * @brief Get the version of the SCPI library as an unsigned base 10 integer.
194+ * For example, version 1.2.3 would return 10203.
195+ *
196+ * This is intended to be used to check for the existence of certain
197+ * functionality based on library version, particularly in wrappers (such as
198+ * Python).
199+ *
200+ * @return The library version.
201+ */
202+ unsigned int AbsScpiClient_Version ();
203+
192204/**
193205 * @brief Get an error message to describe an error code returned by the driver.
194206 *
Original file line number Diff line number Diff line change @@ -53,6 +53,14 @@ namespace bci::abs {
5353 */
5454class ScpiClient {
5555 public:
56+ /* *
57+ * @brief Get the library version as a decimal integer. For example, version
58+ * 1.3.2 would return 10302.
59+ *
60+ * @return Library version.
61+ */
62+ static unsigned int Version () noexcept ;
63+
5664 // / Default CTOR.
5765 ScpiClient () noexcept ;
5866
Original file line number Diff line number Diff line change @@ -87,6 +87,10 @@ inline constexpr std::string_view CharsView(const char (&str)[kLen]) {
8787 return std::string_view (str, ::strnlen (str, kLen ));
8888}
8989
90+ unsigned int AbsScpiClient_Version () {
91+ return ABSSCPI_VERSION;
92+ }
93+
9094const char * AbsScpiClient_ErrorMessage (int error) {
9195 return bci::abs::ErrorMessage (static_cast <bci::abs::ErrorCode>(error));
9296}
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ static constexpr unsigned int kWriteTimeoutMs = 10;
2222using util::Err;
2323using ec = ErrorCode;
2424
25+ unsigned int ScpiClient::Version () noexcept {
26+ return ABSSCPI_VERSION;
27+ }
28+
2529ScpiClient::ScpiClient () noexcept : ScpiClient(nullptr ) {}
2630
2731ScpiClient::ScpiClient (std::shared_ptr<drivers::CommDriver> driver) noexcept
You can’t perform that action at this time.
0 commit comments