diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-02-19 10:51:17 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bartekgola@gmail.com> | 2018-02-19 10:51:39 +0100 |
commit | 3787dc20064156c13c6e0b342337e50dcef7d28e (patch) | |
tree | 4e039678d03c7470eda43083df6c3d507d516c19 | |
parent | 5def18b0d95925ac2224062dda4df1b296b94e2e (diff) | |
download | libgpiod-3787dc20064156c13c6e0b342337e50dcef7d28e.tar.gz |
bindings: cxx: require default values for output requests
Require users to provide default values to line_bulk::request() when
direction is output.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
-rw-r--r-- | bindings/cxx/line_bulk.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/bindings/cxx/line_bulk.cpp b/bindings/cxx/line_bulk.cpp index ec0d724d..106c3071 100644 --- a/bindings/cxx/line_bulk.cpp +++ b/bindings/cxx/line_bulk.cpp @@ -104,6 +104,9 @@ void line_bulk::request(const line_request& config, const std::vector<int> defau if (!default_vals.empty() && this->size() != default_vals.size()) throw ::std::invalid_argument("the number of default values must correspond with the number of lines"); + if (config.request_type == line_request::DIRECTION_OUTPUT && default_vals.empty()) + throw ::std::invalid_argument("default values are required for output mode"); + ::gpiod_line_request_config conf; ::gpiod_line_bulk bulk; int rv; |