Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
SocCamera::tcCommandInterface Class Referenceabstract

#include <CommandInterface.h>

Inheritance diagram for SocCamera::tcCommandInterface:
Collaboration diagram for SocCamera::tcCommandInterface:

Public Member Functions

 tcCommandInterface (const char *ifacename, tcSensorBoard *apSensor, tcIOChannel *apChannel)
 
virtual ~tcCommandInterface ()
 Destructor. More...
 
void initializeCommandHandlers ()
 
virtual void getInput (std::string *apStringOutput)=0
 
virtual std::string parseInput (std::string &arStringOutput)=0
 
virtual void respond (std::string ahResponse)=0
 
virtual void finish (std::string &arOriginalBuffer)=0
 
virtual void * run ()
 
virtual void addTEC (tcPIDControl *apPID)
 
tcAbstractHandlergetChain (void)
 
tcAbstractHandlergetHandler (std::string name)
 
- Public Member Functions inherited from tcThread
 tcThread ()
 
virtual ~tcThread ()
 
void join ()
 
virtual void start ()
 
virtual void stop ()
 

Static Public Member Functions

static std::string registerName (uint32_t anReg)
 

Protected Member Functions

void Report (const char *fmt,...)
 This method routes text to stderr. More...
 
void ReportError (const char *fmt,...)
 
- Protected Member Functions inherited from tcThread
void setPriority (int anRelativePriority)
 

Protected Attributes

std::string m_ifacename
 
tcSensorBoardmpSensor
 
tcIOChannelmpChannel
 
- Protected Attributes inherited from tcThread
bool mbKillThread
 

Static Protected Attributes

static tcAbstractHandlergpChainHead = NULL
 
static tcAbstractHandlergpChainTail = NULL
 
static std::map< std::string, tcAbstractHandler * > mcStringMap
 
static tcMutex chain_initializer = tcMutex()
 

Additional Inherited Members

- Static Public Attributes inherited from tcThread
static const int HIGHEST_PRIORITY = -2
 
static const int HIGH_PRIORITY = -1
 
static const int NORMAL_PRIORITY = 0
 
static const int LOW_PRIORITY = 1
 
static const int LOWEST_PRIORITY = 2
 

Constructor & Destructor Documentation

◆ tcCommandInterface()

tcCommandInterface::tcCommandInterface ( const char *  ifacename,
tcSensorBoard apSensor,
tcIOChannel apChannel 
)

tcGigEIOHandler Constructor

Parameters
[in]ifacenameHuman readable interface name used for debugging only.
[in]apSensorPointer to the sensor board object.
[in]apChannelPointer to the IO channel object.

◆ ~tcCommandInterface()

tcCommandInterface::~tcCommandInterface ( )
virtual

Destructor.

Member Function Documentation

◆ addTEC()

void tcCommandInterface::addTEC ( tcPIDControl apPID)
virtual

When a TEC cooler is present to control, call this function to add control into the chain.

Function is virtual because some interfaces (like MityViewer) don't use the chain and would like to have more direct control over the result.

Parameters
apPID- pointer to the PID controller object

Reimplemented in SocCamera::tcMityViewerInterface.

◆ finish()

virtual void SocCamera::tcCommandInterface::finish ( std::string &  arOriginalBuffer)
pure virtual

Perform cleanup tasks. (eg: reboot, signal thread to die, etc).

Parameters
arOriginalBuffer- the original buffer that was gotten

Implemented in SocCamera::tcU3VisionInterface, SocCamera::tcCameraLinkSerial, SocCamera::tcConsoleInterface, SocCamera::tcNamedPipeInterface, SocCamera::tcMityViewerInterface, and SocCamera::tcGigEInterface.

◆ getChain()

tcAbstractHandler* SocCamera::tcCommandInterface::getChain ( void  )
inline

◆ getHandler()

tcAbstractHandler* SocCamera::tcCommandInterface::getHandler ( std::string  name)
inline

◆ getInput()

virtual void SocCamera::tcCommandInterface::getInput ( std::string *  apStringOutput)
pure virtual

Gets the input from whatever means it has to and stores it in the std::string pointed to by the parameter.

Parameters
apStringOutput- pointer to the location to store the input

Implemented in SocCamera::tcU3VisionInterface, SocCamera::tcCameraLinkSerial, SocCamera::tcConsoleInterface, SocCamera::tcNamedPipeInterface, SocCamera::tcMityViewerInterface, and SocCamera::tcGigEInterface.

◆ initializeCommandHandlers()

void SocCamera::tcCommandInterface::initializeCommandHandlers ( )

◆ parseInput()

virtual std::string SocCamera::tcCommandInterface::parseInput ( std::string &  arStringOutput)
pure virtual

Process the input string and call whatever functions are appropriate. Returns a value which will be passed to respond().

Parameters
arStringOutput- the input string to process.
Returns
an int32 code corresponding to the success of processing.

Implemented in SocCamera::tcU3VisionInterface, SocCamera::tcCameraLinkSerial, SocCamera::tcConsoleInterface, SocCamera::tcNamedPipeInterface, SocCamera::tcMityViewerInterface, and SocCamera::tcGigEInterface.

◆ registerName()

std::string SocCamera::tcCommandInterface::registerName ( uint32_t  anReg)
static

Get the name of the register at address anReg

Parameters
addressof register
Returns
string name of register

◆ Report()

void tcCommandInterface::Report ( const char *  fmt,
  ... 
)
protected

This method routes text to stderr.

◆ ReportError()

void tcCommandInterface::ReportError ( const char *  fmt,
  ... 
)
protected

Report Error Function This method routes error text to stderr

◆ respond()

virtual void SocCamera::tcCommandInterface::respond ( std::string  ahResponse)
pure virtual

Send the <ACK>, <NACK> or whatever other response.

Parameters
ahResponse- the string to output back over the source

Implemented in SocCamera::tcGigEInterface, SocCamera::tcU3VisionInterface, SocCamera::tcCameraLinkSerial, SocCamera::tcConsoleInterface, SocCamera::tcNamedPipeInterface, and SocCamera::tcMityViewerInterface.

◆ run()

void * tcCommandInterface::run ( )
virtual

run() should spin getting input from getInput() and sends it to parseInput() for processing. This fully abstracts threading.

Returns
unused

Implements tcThread.

Reimplemented in SocCamera::tcU3VisionInterface, SocCamera::tcGigEInterface, and SocCamera::tcMityViewerInterface.

Member Data Documentation

◆ chain_initializer

tcMutex tcCommandInterface::chain_initializer = tcMutex()
staticprotected

◆ gpChainHead

tcAbstractHandler * tcCommandInterface::gpChainHead = NULL
staticprotected

The command handler chain belonging to all interfaces.

◆ gpChainTail

tcAbstractHandler * tcCommandInterface::gpChainTail = NULL
staticprotected

◆ m_ifacename

std::string SocCamera::tcCommandInterface::m_ifacename
protected

◆ mcStringMap

std::map< std::string, tcAbstractHandler * > tcCommandInterface::mcStringMap
staticprotected

Maps strings to handlers; this makes O(log n) execution on commands instead of O(n) compared to using mpChain directly.

◆ mpChannel

tcIOChannel* SocCamera::tcCommandInterface::mpChannel
protected

The IOChannel that this command interface controls.

◆ mpSensor

tcSensorBoard* SocCamera::tcCommandInterface::mpSensor
protected

The sensor being controlled.


The documentation for this class was generated from the following files: