Homepage Demos Overview Downloads Tutorials Reference
Credits

DynamicConfig.h

Go to the documentation of this file.
00001 #include <Shared/Config.h>
00002 #include <Vision/Vision.h>
00003 
00004 namespace DynamicConfig {
00005   int assignVarFromController(const char *str) {
00006     char buf[80];
00007     strncpy(buf, str, 79);
00008     char *value=index(buf, '=');
00009     char *key=index(buf, '.');
00010     if (key==NULL || value==NULL) return -1;
00011     if (key>=value) return -1;
00012     *key=0;
00013     key++;
00014     *value=0;
00015     value++;
00016     Config::section_t section=config->parseSection(buf);
00017     if (section==Config::sec_invalid) return -2;
00018     void *val_set=config->setValue(section, key, value, true);
00019 
00020     if (val_set == &config->vision.white_balance ||
00021         val_set == &config->vision.gain ||
00022         val_set == &config->vision.shutter_speed)
00023       vision->setCameraParams();
00024     else if (val_set == &config->vision.resolution)
00025       vision->setResolution();
00026     else if (val_set == &config->vision.thresh ||
00027              val_set == &config->vision.colors)
00028       vision->setColors();
00029     
00030     return 0;
00031   }
00032 }

Tekkotsu v1.5
Generated Fri Oct 10 15:51:58 2003 by Doxygen 1.3.4