Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
U3VisionInterface.h
Go to the documentation of this file.
1 #ifndef U3VISIONINTERFACE_H
2 #define U3VISIONINTERFACE_H
3 
4 #include <vector>
5 #include <memory>
6 
7 #include "CommandInterface.h"
8 #include "Sensors/SensorBoard.h"
9 #include "U3VDelegate.h"
10 
11 #include "libdaq/gpio.h"
12 
13 #include "PayloadSetter.h"
14 #include "Utility/Mutex.h"
15 #include "Utility/Observer.h"
16 
17 namespace SocCamera
18 {
19 
20 #define SERIAL_PORT_0 "/dev/ttyS0"
21 #define DEFAULT_BUFF_SIZE (2048)
22 
23 class tcRegisterFile;
24 
26 {
27 public:
28  tcU3VisionInterface(tcIOChannel * apChannel, tcSensorBoard *apSensor,
29  std::string *apData);
30 
31  virtual ~tcU3VisionInterface();
32 
38  virtual void* run();
39 
45  virtual void getInput(std::string *apStringOutput);
46 
53  virtual std::string parseInput(std::string &arStringToParse);
54 
59  virtual void respond(std::string anResponse);
60 
65  virtual void finish(std::string &arOriginalBuffer);
66 
67  virtual void update_payload_size(const uint32_t payload_size);
68 
69  void update(tsUpdate anMsg);
70 
71 private:
72  static void pushAllBack(uint8_t *apBuf, std::vector<uint8_t> &arVec, int32 num);
73  static bool clipToPrefix(std::vector<uint8_t> &arVec);
74  static bool checkCommand(std::vector<uint8_t> &arVec);
75  void processCommand(std::vector<uint8_t> &arVec);
76  void clipCommand(std::vector<uint8_t> &arVec);
77 
78  void sendMessage(tsU3VMsg &arMsg);
79 
83  void exec();
84 
85  tcRegisterFile* mpRegisterFile; //Registers are stored in network byte order
86 
91  static void configure_port(int32 fd);
92 
98  static int32 open_port(const char *apPath);
99 
103  int32 mhFD;
104  std::vector<uint8_t> buff;
105  tcU3VDelegate mcDelegate;
106 
107  std::unique_ptr<MityDSP::tcGpio> mcGpio;
108 
109  friend class tcU3VDelegate;
110 
111  tcMutex mcWriteMutex;
112 
113  bool mbLogTransactions;
114 };
115 
116 }
117 
118 #endif // U3VISIONINTERFACE_H
SocCamera::tcU3VisionInterface::finish
virtual void finish(std::string &arOriginalBuffer)
Definition: U3VisionInterface.cpp:412
tsUpdate
Definition: Observer.h:6
SocCamera::tcU3VisionInterface::update_payload_size
virtual void update_payload_size(const uint32_t payload_size)
Definition: U3VisionInterface.cpp:357
int32
int32_t int32
Definition: Types.h:8
SensorBoard.h
SocCamera::tcU3VisionInterface::tcU3VisionInterface
tcU3VisionInterface(tcIOChannel *apChannel, tcSensorBoard *apSensor, std::string *apData)
Definition: U3VisionInterface.cpp:51
SocCamera::tcU3VisionInterface::getInput
virtual void getInput(std::string *apStringOutput)
Definition: U3VisionInterface.cpp:81
Observer.h
PayloadSetter.h
SocCamera::tcU3VisionInterface::parseInput
virtual std::string parseInput(std::string &arStringToParse)
Definition: U3VisionInterface.cpp:85
SocCamera::tcU3VisionInterface
Definition: U3VisionInterface.h:25
tcObserver
Definition: Observer.h:12
SocCamera::tcU3VDelegate
Definition: U3VDelegate.h:31
tcIOChannel
Camera Output IO channel management class.
Definition: IOChannel.h:34
tcPayloadSetter
Definition: PayloadSetter.h:11
U3VDelegate.h
SocCamera::tcU3VisionInterface::run
virtual void * run()
Definition: U3VisionInterface.cpp:127
CommandInterface.h
This file contains the tcCommandInterface class.
SocCamera
Definition: CameraTypes.h:7
SocCamera::tcU3VisionInterface::~tcU3VisionInterface
virtual ~tcU3VisionInterface()
Definition: U3VisionInterface.cpp:76
SocCamera::tcRegisterFile
Definition: RegisterFile.h:121
Mutex.h
SocCamera::tcU3VisionInterface::respond
virtual void respond(std::string anResponse)
Definition: U3VisionInterface.cpp:90
SocCamera::tcSensorBoard
Definition: SensorBoard.h:40
SocCamera::tcCommandInterface
Definition: CommandInterface.h:25
SocCamera::tcU3VisionInterface::update
void update(tsUpdate anMsg)
Definition: U3VisionInterface.cpp:363
tcMutex
Definition: Mutex.h:11