00001 #include "darwin_camera_driver.h" 00002 00003 DarwinCameraDriver::DarwinCameraDriver(void) 00004 { 00005 //setDriverId(driver string id); 00006 this->camera=NULL; 00007 } 00008 00009 bool DarwinCameraDriver::openDriver(void) 00010 { 00011 //setDriverId(driver string id); 00012 this->camera = new CDarwinCamera(); 00013 00014 return true; 00015 } 00016 00017 bool DarwinCameraDriver::closeDriver(void) 00018 { 00019 if(this->camera!=NULL) 00020 { 00021 delete this->camera; 00022 this->camera=NULL; 00023 } 00024 00025 return true; 00026 } 00027 00028 bool DarwinCameraDriver::startDriver(void) 00029 { 00030 return true; 00031 } 00032 00033 bool DarwinCameraDriver::stopDriver(void) 00034 { 00035 return true; 00036 } 00037 00038 void DarwinCameraDriver::config_update(Config& new_cfg, uint32_t level) 00039 { 00040 this->lock(); 00041 00042 // depending on current state 00043 // update driver with new_cfg data 00044 switch(this->getState()) 00045 { 00046 case DarwinCameraDriver::CLOSED: 00047 break; 00048 00049 case DarwinCameraDriver::OPENED: 00050 this->camera->config(new_cfg.brightness,new_cfg.contrast,new_cfg.saturation,new_cfg.gain,new_cfg.exposure); 00051 break; 00052 00053 case DarwinCameraDriver::RUNNING: 00054 break; 00055 } 00056 00057 // save the current configuration 00058 this->config_=new_cfg; 00059 00060 this->unlock(); 00061 } 00062 00063 Image *DarwinCameraDriver::get_image(void) 00064 { 00065 return this->camera->get_image(); 00066 } 00067 00068 DarwinCameraDriver::~DarwinCameraDriver(void) 00069 { 00070 if(this->camera!=NULL) 00071 { 00072 delete this->camera; 00073 this->camera=NULL; 00074 } 00075 }