API
stdCamera.cpp
Go to the documentation of this file.
1 /** \file stdCamera.cpp
2  * \brief Standard camera interface
3  *
4  * \author Jared R. Males (jaredmales@gmail.com)
5  *
6  * \ingroup app_files
7  */
8 
9 #include "stdCamera.hpp"
10 
11 namespace MagAOX
12 {
13 namespace app
14 {
15 namespace dev
16 {
17 
18 int loadCameraConfig( cameraConfigMap & ccmap, // [out] the map in which to place the configurations found in config
19  mx::app::appConfigurator & config // [in] the application configuration structure
20  )
21 {
22  std::vector<std::string> sections;
23 
24  config.unusedSections(sections);
25 
26  if( sections.size() == 0 )
27  {
28  return CAMCTRL_E_NOCONFIGS;
29  }
30 
31  for(size_t i=0; i< sections.size(); ++i)
32  {
33  bool fileset = config.isSetUnused(mx::app::iniFile::makeKey(sections[i], "configFile" ));
34  /*bool binset = config.isSetUnused(mx::app::iniFile::makeKey(sections[i], "binning" ));
35  bool sizeXset = config.isSetUnused(mx::app::iniFile::makeKey(sections[i], "sizeX" ));
36  bool sizeYset = config.isSetUnused(mx::app::iniFile::makeKey(sections[i], "sizeY" ));
37  bool maxfpsset = config.isSetUnused(mx::app::iniFile::makeKey(sections[i], "maxFPS" ));
38  */
39 
40  //The configuration file tells us most things for EDT, so it's our current requirement.
41  if( !fileset ) continue;
42 
43  std::string configFile;
44  config.configUnused(configFile, mx::app::iniFile::makeKey(sections[i], "configFile" ));
45 
46  std::string serialCommand;
47  config.configUnused(serialCommand, mx::app::iniFile::makeKey(sections[i], "serialCommand" ));
48 
49  unsigned centerX = 0;
50  config.configUnused(centerX, mx::app::iniFile::makeKey(sections[i], "centerX" ));
51 
52  unsigned centerY = 0;
53  config.configUnused(centerY, mx::app::iniFile::makeKey(sections[i], "centerY" ));
54 
55  unsigned sizeX = 0;
56  config.configUnused(sizeX, mx::app::iniFile::makeKey(sections[i], "sizeX" ));
57 
58  unsigned sizeY = 0;
59  config.configUnused(sizeY, mx::app::iniFile::makeKey(sections[i], "sizeY" ));
60 
61  unsigned binningX = 1;
62  config.configUnused(binningX, mx::app::iniFile::makeKey(sections[i], "binningX" ));
63 
64  unsigned binningY = 1;
65  config.configUnused(binningY, mx::app::iniFile::makeKey(sections[i], "binningY" ));
66 
67  unsigned dbinningX = 1;
68  config.configUnused(dbinningX, mx::app::iniFile::makeKey(sections[i], "digital_binningX" ));
69 
70  unsigned dbinningY = 1;
71  config.configUnused(dbinningY, mx::app::iniFile::makeKey(sections[i], "digital_binningY" ));
72 
73  float maxFPS = 0;
74  config.configUnused(maxFPS, mx::app::iniFile::makeKey(sections[i], "maxFPS" ));
75 
76  ccmap[sections[i]] = cameraConfig({configFile, serialCommand, centerX, centerY, sizeX, sizeY,
77  binningX, binningY, dbinningX, dbinningY, maxFPS});
78  }
79 
80  return 0;
81 }
82 
83 
84 
85 } //namespace dev
86 } //namespace app
87 } //namespace MagAOX
88 
std::unordered_map< std::string, cameraConfig > cameraConfigMap
Definition: stdCamera.hpp:48
int loadCameraConfig(cameraConfigMap &ccmap, mx::app::appConfigurator &config)
Load the camera configurations contained in the app configuration into a map.
Definition: stdCamera.cpp:18
A camera configuration.
Definition: stdCamera.hpp:32
Definition: dm.hpp:24
Standard camera interface.
#define CAMCTRL_E_NOCONFIGS
Definition: stdCamera.hpp:26