bindings: cxx: provide request_builder::set_output_values()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 12 Jun 2023 14:52:03 +0000 (16:52 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 13 Jun 2023 09:50:08 +0000 (11:50 +0200)
Implement a new method in the request_builder class that allows to set
output values at request-time by calling the set_output_values() method
of the internal line_config object.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
bindings/cxx/gpiodcxx/request-builder.hpp
bindings/cxx/request-builder.cpp

index 321621648ff4c75bdbead8afd1936b31db73a423..90cc8f04d80c4afe31e84e6ba6d5cdc41b186e17 100644 (file)
@@ -114,6 +114,14 @@ public:
         */
        request_builder& add_line_settings(const line::offsets& offsets, const line_settings& settings);
 
+       /**
+        * @brief Set output values for a number of lines in the line config
+        *        stored by this object.
+        * @param values Buffer containing the output values.
+        * @return Reference to self.
+        */
+       request_builder& set_output_values(const line::values& values);
+
        /**
         * @brief Make the line request.
         * @return New line_request object.
index 6a1a487f9630f7b7c0640e393f284b007647b742..d11e47b3d87af4858d967dfd4553988935ed762e 100644 (file)
@@ -106,6 +106,14 @@ request_builder::add_line_settings(const line::offsets& offsets, const line_sett
        return *this;
 }
 
+GPIOD_CXX_API request_builder&
+request_builder::set_output_values(const line::values& values)
+{
+       this->_m_priv->line_cfg.set_output_values(values);
+
+       return *this;
+}
+
 GPIOD_CXX_API line_request request_builder::do_request()
 {
        line_request_ptr request(::gpiod_chip_request_lines(