Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
CommandInterface.h
Go to the documentation of this file.
1 
9 #ifndef COMMANDINTERFACE_H
10 #define COMMANDINTERFACE_H
11 
12 #include "Sensors/SensorBoard.h"
13 #include "Utility/Thread.h"
14 
15 #include "IOChannel/IOChannel.h"
16 
17 #include <string>
18 
19 #include <map>
20 
21 namespace SocCamera
22 {
23  class tcPIDControl;
24 
26  {
27  public:
28  tcCommandInterface (const char *ifacename, tcSensorBoard* apSensor, tcIOChannel *apChannel);
29 
30  virtual ~tcCommandInterface();
31 
33 
39  static std::string registerName(uint32_t anReg);
45  virtual void getInput(std::string *apStringOutput) = 0;
46 
53  virtual std::string parseInput(std::string &arStringOutput) = 0;
54 
59  virtual void respond(std::string ahResponse) = 0;
60 
65  virtual void finish(std::string &arOriginalBuffer) = 0;
66 
72  virtual void* run();
73 
83  virtual void addTEC(tcPIDControl *apPID);
84 
86 
87  tcAbstractHandler* getHandler(std::string name) { return mcStringMap[name]; }
88 
89  protected:
90  std::string m_ifacename; // Human name for interface for debugging, should be short to keep log messages short.
91 
96 
102 
107 
111  static std::map<std::string, tcAbstractHandler*> mcStringMap;
112 
114 
115  private:
116  static bool sensor_initialized;
117  static bool chain_initialized;
118  void initialize_chain();
119  void initialize_sensor_specific();
120  void initialize_channel_specific();
121 
122  protected:
123  void Report (const char* fmt, ...);
124  void ReportError (const char* fmt, ...);
125  };
126 
127 }
128 
129 #endif // COMMANDINTERFACE_H
130 
SocCamera::tcCommandInterface::mcStringMap
static std::map< std::string, tcAbstractHandler * > mcStringMap
Definition: CommandInterface.h:111
SocCamera::tcCommandInterface::m_ifacename
std::string m_ifacename
Definition: CommandInterface.h:90
SocCamera::tcCommandInterface::parseInput
virtual std::string parseInput(std::string &arStringOutput)=0
SocCamera::tcCommandInterface::gpChainTail
static tcAbstractHandler * gpChainTail
Definition: CommandInterface.h:101
SocCamera::tcCommandInterface::registerName
static std::string registerName(uint32_t anReg)
Definition: RegisterNames.cpp:25
SocCamera::tcCommandInterface::mpChannel
tcIOChannel * mpChannel
Definition: CommandInterface.h:106
SocCamera::tcCommandInterface::addTEC
virtual void addTEC(tcPIDControl *apPID)
Definition: CommandInterface.cpp:179
SocCamera::tcCommandInterface::respond
virtual void respond(std::string ahResponse)=0
SensorBoard.h
SocCamera::tcPIDControl
Definition: PIDControl.h:27
SocCamera::tcCommandInterface::mpSensor
tcSensorBoard * mpSensor
Definition: CommandInterface.h:95
SocCamera::tcCommandInterface::~tcCommandInterface
virtual ~tcCommandInterface()
Destructor.
Definition: CommandInterface.cpp:98
SocCamera::tcCommandInterface::ReportError
void ReportError(const char *fmt,...)
Definition: CommandInterface.cpp:309
SocCamera::tcCommandInterface::getChain
tcAbstractHandler * getChain(void)
Definition: CommandInterface.h:85
SocCamera::tcAbstractHandler
Definition: AbstractHandler.h:24
SocCamera::tcCommandInterface::tcCommandInterface
tcCommandInterface(const char *ifacename, tcSensorBoard *apSensor, tcIOChannel *apChannel)
Definition: CommandInterface.cpp:86
tcIOChannel
Camera Output IO channel management class.
Definition: IOChannel.h:34
tcThread
Definition: Thread.h:6
Thread.h
SocCamera::tcCommandInterface::Report
void Report(const char *fmt,...)
This method routes text to stderr.
Definition: CommandInterface.cpp:262
SocCamera::tcCommandInterface::run
virtual void * run()
Definition: CommandInterface.cpp:109
SocCamera::tcCommandInterface::chain_initializer
static tcMutex chain_initializer
Definition: CommandInterface.h:113
SocCamera::tcCommandInterface::getInput
virtual void getInput(std::string *apStringOutput)=0
SocCamera
Definition: CameraTypes.h:7
SocCamera::tcCommandInterface::gpChainHead
static tcAbstractHandler * gpChainHead
Definition: CommandInterface.h:100
SocCamera::tcSensorBoard
Definition: SensorBoard.h:40
SocCamera::tcCommandInterface
Definition: CommandInterface.h:25
SocCamera::tcCommandInterface::initializeCommandHandlers
void initializeCommandHandlers()
Definition: CommandInterface.cpp:280
tcMutex
Definition: Mutex.h:11
IOChannel.h
SocCamera::tcCommandInterface::getHandler
tcAbstractHandler * getHandler(std::string name)
Definition: CommandInterface.h:87
SocCamera::tcCommandInterface::finish
virtual void finish(std::string &arOriginalBuffer)=0