Message ID | 20190527001543.13593-16-niklas.soderlund@ragnatech.se |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Niklas, On 27/05/2019 01:15, Niklas Söderlund wrote: > Use CameraConfiguration::validate() to validate and possibly update the > camera configuration when its prepared. > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > src/cam/main.cpp | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp > index 338740d1512c7189..25538f5ba95552d6 100644 > --- a/src/cam/main.cpp > +++ b/src/cam/main.cpp > @@ -236,6 +236,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; Part of me is screaming where's the 'default:' option for the switch here - but I don't think it makes sense at all. What would the default option be ... except an error... And fortunately the compiler yells at us if we don't support all enumeration values in the statement. So - LGTM. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > + } > + > return 0; > } > >
Hi Niklas, Thank you for the patch. On Mon, May 27, 2019 at 02:15:41AM +0200, Niklas Söderlund wrote: > 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/cam/main.cpp | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/cam/main.cpp b/src/cam/main.cpp > index 338740d1512c7189..25538f5ba95552d6 100644 > --- a/src/cam/main.cpp > +++ b/src/cam/main.cpp > @@ -236,6 +236,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; > } >
diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 338740d1512c7189..25538f5ba95552d6 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -236,6 +236,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; }
Use CameraConfiguration::validate() to validate and possibly update the camera configuration when its prepared. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> --- src/cam/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+)