ueye_camera_driver.cpp
Go to the documentation of this file.
00001 #include "ueye_camera_driver.h"
00002 
00003 using namespace std;
00004 
00005 UeyeCameraDriver::UeyeCameraDriver(void)
00006 {
00007   //setDriverId(driver string id);
00008 }
00009 
00010 bool UeyeCameraDriver::openDriver(void)
00011 {
00012   // List cameras connected
00013   try
00014   {
00015     this->ueye_cam_.list_cameras();
00016   }
00017   catch (CException & e)
00018   {
00019     cout << e.what () << endl;
00020     return false;
00021   }
00022 
00023   return true;
00024 }
00025 
00026 bool UeyeCameraDriver::closeDriver(void)
00027 {
00028 
00029   this->ueye_cam_.close_camera();
00030 
00031   return true;
00032 }
00033 
00034 bool UeyeCameraDriver::startDriver(void)
00035 {
00036 
00037   // Configure camera
00038   this->ueye_cam_.params_.cameraid=this->cameraid_;
00039   this->ueye_cam_.params_.img_width=this->img_width_;
00040   this->ueye_cam_.params_.img_height=this->img_height_;
00041   this->ueye_cam_.params_.img_left=this->img_left_;
00042   this->ueye_cam_.params_.img_top=this->img_top_;
00043   this->ueye_cam_.params_.fps=this->fps_;
00044   this->ueye_cam_.params_.param_mode=this->param_mode_;
00045   this->ueye_cam_.params_.file_str=this->file_str_;
00046   this->ueye_cam_.params_.pixel_clock=this->pixel_clock_;
00047   this->ueye_cam_.params_.exposure=this->exposure_;
00048   this->ueye_cam_.params_.mirror_updown=this->mirror_updown_;
00049   this->ueye_cam_.params_.mirror_leftright=this->mirror_leftright_;
00050   this->ueye_cam_.params_.file_str=this->file_str_;
00051 
00052   // initialize camera
00053   try
00054   {
00055     this->ueye_cam_.init_camera();
00056   }
00057   catch (CException & e)
00058   {
00059     cout << e.what () << endl;
00060     return false;
00061   }
00062 
00063   return true;
00064 }
00065 
00066 bool UeyeCameraDriver::stopDriver(void)
00067 {
00068   return true;
00069 }
00070 
00071 void UeyeCameraDriver::config_update(Config& new_cfg, uint32_t level)
00072 {
00073   this->lock();
00074   
00075   // depending on current state
00076   // update driver with new_cfg data
00077   switch(this->getState())
00078   {
00079     case UeyeCameraDriver::CLOSED:
00080       break;
00081 
00082     case UeyeCameraDriver::OPENED:
00083       break;
00084 
00085     case UeyeCameraDriver::RUNNING:
00086       this->frame_id_ = new_cfg.frame_id;
00087       break;
00088   }
00089 
00090   // save the current configuration
00091   this->config_=new_cfg;
00092 
00093   this->unlock();
00094 }
00095 
00096 bool UeyeCameraDriver::get_image(void)
00097 {
00098 
00099   bool new_image = false;
00100 
00101   // get image  
00102   try
00103   {
00104     new_image = this->ueye_cam_.get_image();
00105   }
00106   catch (CUeyeCameraException & e)
00107   {
00108     cout << e.what () << endl;
00109     return false;
00110   }
00111   catch (CUeyeFeatureException & e)
00112   {
00113     cout << e.what () << endl;
00114   }
00115 
00116   if (!new_image) return false;
00117   else return true;
00118 }
00119 
00120 UeyeCameraDriver::~UeyeCameraDriver(void)
00121 {
00122 }


iri_ueye_camera
Author(s): Àngel Santamaria-Navarro, asantamaria@iri.upc.edu
autogenerated on Fri Dec 6 2013 22:48:02