summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-05-01 14:22:49 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-06-19 12:25:12 +0200
commit7c856201c7fdf6758589d0573378f18b6a04af49 (patch)
treee3eb568fe1d27b6813c4628b854c72e12cab7f70
parentafef18d35ab919f7efbb93295a0f8955bceb33b3 (diff)
cam: Validate camera configuration
Use CameraConfiguration::validate() to validate and possibly update the camera configuration when its prepared. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/cam/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 784f58cb..4e9abf66 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -243,6 +243,18 @@ int CamApp::prepareConfig()
}
}
+ switch (config_->validate()) {
+ case CameraConfiguration::Valid:
+ break;
+ case CameraConfiguration::Adjusted:
+ std::cout << "Camera configuration adjusted" << std::endl;
+ break;
+ case CameraConfiguration::Invalid:
+ std::cout << "Camera configuration invalid" << std::endl;
+ config_.reset();
+ return -EINVAL;
+ }
+
return 0;
}