Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
SocCamera::tcControlApplication Class Reference

#include <ControlApplication.h>

Collaboration diagram for SocCamera::tcControlApplication:

Public Member Functions

 tcControlApplication ()
 
 ~tcControlApplication ()
 
int start ()
 
int wait ()
 
int execute ()
 
tcSensorBoardgetSensorBoard ()
 
int addCommandInterface (tcCommandInterface *apIface)
 addCommandInterface add a command interface More...
 
std::list< tcCommandInterface * > getCommandInterface ()
 
std::list< tcIOChannel * > getIOChannel ()
 
void setSensorBoard (tcSensorBoard *apSensor, bool abSavable=false)
 
void setSensorBoard (int32 value, std::string *apData, bool abSavable=false)
 
void setCommandInterface (int32 value, std::string *data)
 
void setIOChannel (int32 value, std::string *data)
 
int addIOChannel (tcIOChannel *apCh)
 addIOChannel add an IO channel to the app More...
 
void setStatusInterface (int32 value, std::string *data=NULL)
 
bool processCommandLineArguments (int32 argc, char **argv)
 
void setConfig (char *filename)
 
void setTEC (std::string &arTecData)
 
void setTEC (tcPIDControl *apTEC)
 

Static Public Member Functions

static std::string getexepath ()
 get the path to the application exe file More...
 
static std::string getPluginPath ()
 locate the plugin directory More...
 
static void registerSensorFactory (int anId, std::function< tcSensorBoard *(const char *)> apFunc)
 

Detailed Description

This class is a builder for the camera stack framework. It accepts flags by a number of means and creates the appropriate framework objects. Order of instantiation is important: 1) Create sensor object 2) Create an IO Channel (if applicable) 3) Create the CommandInterface for the IOChannel. 4) Create StatusReporters

The ControlApplication can then be start()'d to execute all appropriate threads. Following this, the user is free to retrieve handles on the objects if desired and perform other tasks. To block on the CameraStack's execution, call wait(). The function will return if all threads of operation are destroyed (such as when the CommandInterfaces are told to exit).

Constructor & Destructor Documentation

◆ tcControlApplication()

tcControlApplication::tcControlApplication ( )

◆ ~tcControlApplication()

tcControlApplication::~tcControlApplication ( )

Member Function Documentation

◆ addCommandInterface()

int tcControlApplication::addCommandInterface ( tcCommandInterface apIface)

addCommandInterface add a command interface

Parameters
apIface
Returns
0 on success

◆ addIOChannel()

int tcControlApplication::addIOChannel ( tcIOChannel apCh)

addIOChannel add an IO channel to the app

Parameters
apChIO channel based object
Returns
0 on success

◆ execute()

int tcControlApplication::execute ( )

Calls start() then wait(). Useful when you only care about the camera and have no other jobs that need to run in parallel with the library.

Returns
the error code from start() if it fails; the error code from wait() if start succeeds.

◆ getCommandInterface()

list< tcCommandInterface * > tcControlApplication::getCommandInterface ( )

Factory method to produce the CommandInterface objects from the flags and the SensorBoard.

Returns
A list of CommandInterface pointers of allocated

◆ getexepath()

std::string tcControlApplication::getexepath ( )
static

get the path to the application exe file

return the path to the application exe

Returns
std::string

◆ getIOChannel()

list< tcIOChannel * > tcControlApplication::getIOChannel ( )

Returns a pointer to the list of IOChannel pointers.

Returns
a pointer to the list of IOChannel pointers.

◆ getPluginPath()

std::string SocCamera::tcControlApplication::getPluginPath ( )
static

locate the plugin directory

looks in the following locations (in order)

CAN_PLUGIN_PATH environment var

pwd/plugins/sensors

<app exe location>/plugins/sensors

<app exe location>/../plugins/sensors

Returns
std::string plugin location (or empty string)

◆ getSensorBoard()

tcSensorBoard * tcControlApplication::getSensorBoard ( )

Factory method to produce the SensorBoard object.

Returns
The concrete SensorBoard specified by the flag that was set.

◆ processCommandLineArguments()

bool tcControlApplication::processCommandLineArguments ( int32  argc,
char **  argv 
)

iterates through the command line arguments and sets the proper flags

Parameters
argc
argv
Returns
Return false if command line args parsing fails

◆ registerSensorFactory()

void tcControlApplication::registerSensorFactory ( int  anId,
std::function< tcSensorBoard *(const char *)>  apFunc 
)
static

◆ setCommandInterface()

void tcControlApplication::setCommandInterface ( int32  value,
std::string *  data 
)

Instantiate a status interface and place it in the list.

Parameters
value- the flag signifying the status interface
data- optional pointer to data for the status interface to parse
Todo:
mpNextIOChannel should be replaced with some sort of lookup operation instead of relying on the last defined IO channel marrying to the given command interface

◆ setConfig()

void tcControlApplication::setConfig ( char *  filename)

Process a file for configuration.

Parameters
filename- the c string ot the filename to use.

◆ setIOChannel()

void tcControlApplication::setIOChannel ( int32  value,
std::string *  data 
)

Instantiate an IO channel and place it in the list.

Parameters
value- the flag signifying the status interface
data- optional pointer to data for the status interface to parse

NO_MITYVIEWER_IFACE

◆ setSensorBoard() [1/2]

void SocCamera::tcControlApplication::setSensorBoard ( int32  value,
std::string *  apData,
bool  abSavable = false 
)

Instantiate a sensor.

Parameters
value- the flag signifying the status interface

◆ setSensorBoard() [2/2]

void tcControlApplication::setSensorBoard ( tcSensorBoard apSensor,
bool  abSavable = false 
)

Set a sensor as the sensor to use.

Parameters
value- the flag signifying the status interface

◆ setStatusInterface()

void tcControlApplication::setStatusInterface ( int32  value,
std::string *  data = NULL 
)

Instantiate a status interface and place it in the list.

Parameters
value- the flag signifying the status interface
data- optional pointer to data for the status interface to parse

◆ setTEC() [1/2]

void SocCamera::tcControlApplication::setTEC ( std::string &  arTecData)

◆ setTEC() [2/2]

void SocCamera::tcControlApplication::setTEC ( tcPIDControl apTEC)

◆ start()

int tcControlApplication::start ( )

This function launches the appropriate threads of operation performing any necessary hand offs of objects. The function will returns when the CommandInterface objects are instantiated.

Returns
an int status code if the threads were all started successfully

◆ wait()

int tcControlApplication::wait ( )

This function blocks execution until all threads have finished.

Returns
0 if the threads all exited; non-zero if there was a problem.

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