Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
AbstractHandler.h
Go to the documentation of this file.
1 #ifndef ABSTRACTHANDLER_H
2 #define ABSTRACTHANDLER_H
3 
4 #include <cstdio>
5 #include <string>
6 
7 #include <map>
8 
9 #include "Sensors/SensorBoard.h"
10 #include "CameraTypes.h"
12 #include "Utility/Types.h"
13 #include "IOChannel/IOChannel.h"
14 
15 #include "../CommandInterface/RegisterFile.h"
16 
17 namespace SocCamera
18 {
19 
25  {
26  public:
27  tcAbstractHandler(tcSensorBoard *apSensor, tcAbstractHandler *apNextHandler = NULL);
28 
29  virtual ~tcAbstractHandler();
30 
37  virtual std::string execute(std::string& arCommandString,
38  std::string& arParameters);
39 
40 
41 
46  void appendHandler(tcAbstractHandler *apNextHandler);
47 
54 
55  virtual void update(tsUpdate asMessage) {}
56 
57  virtual void SetIOChannel(tcIOChannel *apChannel) {
58  if(mpNextHandler)
59  mpNextHandler->SetIOChannel(apChannel);
60  }
61 
62  void unregisterFromFile();
63 
65  const std::string &name() const { return m_name;}
66 
67  protected:
68  std::string m_name; // Human name for handler for debugging, should be short to keep log messages short.
69  static std::string nack(int32 anNack);
70 
71  static std::string ack(std::string *apValue = NULL);
72 
73  static std::string carrotNumber(float anNum);
74 
75  static std::string carrotNumber(int32 anNum);
76 
77  static std::string carrotNumberHex(int32 anNum);
78 
79  static void handleCode(tcRegUpdateUint32Msg* apMsg, teNackCode anCode);
80 
82 
84 
85  void Report (const char* fmt, ...);
86  void ReportError (const char* fmt, ...);
87  };
88 
89 }
90 
91 #endif // ABSTRACTHANDLER_H
tsUpdate
Definition: Observer.h:6
SocCamera::tcAbstractHandler::update
virtual void update(tsUpdate asMessage)
Definition: AbstractHandler.h:55
int32
int32_t int32
Definition: Types.h:8
Types.h
SocCamera::tcAbstractHandler::m_name
std::string m_name
Definition: AbstractHandler.h:68
SocCamera::tcAbstractHandler::carrotNumberHex
static std::string carrotNumberHex(int32 anNum)
Definition: AbstractHandler.cpp:117
SocCamera::tcAbstractHandler::mpSensor
tcSensorBoard * mpSensor
Definition: AbstractHandler.h:83
SocCamera::tcAbstractHandler::unregisterFromFile
void unregisterFromFile()
Definition: AbstractHandler.cpp:108
SocCamera::tcAbstractHandler::carrotNumber
static std::string carrotNumber(float anNum)
Definition: AbstractHandler.cpp:79
SensorBoard.h
CameraTypes.h
tcObserver
Definition: Observer.h:12
StringTokenizer.h
SocCamera::tcAbstractHandler
Definition: AbstractHandler.h:24
SocCamera::teNackCode
teNackCode
Definition: CameraTypes.h:62
tcIOChannel
Camera Output IO channel management class.
Definition: IOChannel.h:34
SocCamera::tcRegUpdateTypeMsg
Definition: RegisterFile.h:372
SocCamera::tcAbstractHandler::handleCode
static void handleCode(tcRegUpdateUint32Msg *apMsg, teNackCode anCode)
Definition: AbstractHandler.cpp:167
SocCamera::tcAbstractHandler::mpNextHandler
tcAbstractHandler * mpNextHandler
Definition: AbstractHandler.h:81
SocCamera::tcAbstractHandler::Report
void Report(const char *fmt,...)
Definition: AbstractHandler.cpp:149
SocCamera::tcAbstractHandler::appendHandler
void appendHandler(tcAbstractHandler *apNextHandler)
Definition: AbstractHandler.cpp:131
SocCamera
Definition: CameraTypes.h:7
SocCamera::tcAbstractHandler::name
const std::string & name() const
return the handler name
Definition: AbstractHandler.h:65
SocCamera::tcAbstractHandler::SetIOChannel
virtual void SetIOChannel(tcIOChannel *apChannel)
Definition: AbstractHandler.h:57
SocCamera::tcAbstractHandler::ReportError
void ReportError(const char *fmt,...)
Definition: AbstractHandler.cpp:206
SocCamera::tcAbstractHandler::~tcAbstractHandler
virtual ~tcAbstractHandler()
Definition: AbstractHandler.cpp:26
SocCamera::tcAbstractHandler::tcAbstractHandler
tcAbstractHandler(tcSensorBoard *apSensor, tcAbstractHandler *apNextHandler=NULL)
Definition: AbstractHandler.cpp:16
SocCamera::tcAbstractHandler::prependHandler
tcAbstractHandler * prependHandler(tcAbstractHandler *apFirstHandler)
Definition: AbstractHandler.cpp:141
SocCamera::tcAbstractHandler::ack
static std::string ack(std::string *apValue=NULL)
Definition: AbstractHandler.cpp:68
SocCamera::tcSensorBoard
Definition: SensorBoard.h:40
SocCamera::tcAbstractHandler::execute
virtual std::string execute(std::string &arCommandString, std::string &arParameters)
Definition: AbstractHandler.cpp:35
IOChannel.h
SocCamera::tcAbstractHandler::nack
static std::string nack(int32 anNack)
Definition: AbstractHandler.cpp:50