BlackLib::BlackCore Class Referenceabstract

Base class of the other classes. More...

#include <BlackCore.h>

Inheritance diagram for BlackLib::BlackCore:

Public Member Functions

 BlackCore ()
 Constructor of BlackCore class. More...
 
virtual ~BlackCore ()
 Destructor of BlackCore class. More...
 

Protected Types

enum  ocpSearch {
  ADC_helper = 0,
  PWM_P8_13 = 1,
  PWM_P8_19 = 2,
  PWM_P9_14 = 3,
  PWM_P9_16 = 4,
  PWM_P9_21 = 5,
  PWM_P9_22 = 6,
  PWM_P9_42 = 7,
  SPI0 = 8,
  SPI1 = 9
}
 

Protected Member Functions

std::string searchDirectoryOcp (BlackCore::ocpSearch searchThis)
 Searches ocp directory to find specified file/directory. More...
 
errorCoregetErrorsFromCore ()
 Exports errorCore struct to derived class. More...
 
std::string getCapeMgrName ()
 Exports capemgr name to derived class. More...
 
std::string getOcpName ()
 Exports ocp name to derived class. More...
 
std::string getSlotsFilePath ()
 Exports slots file path to derived class. More...
 

Private Member Functions

bool findCapeMgrName ()
 Finds full name of capemgr directory. More...
 
bool findOcpName ()
 Finds full name of ocp directory. More...
 
std::string executeCommand (std::string command)
 Executes system call. More...
 
std::string searchDirectory (std::string searchIn, std::string searchThis)
 Searches specified directory to find specified file/directory. More...
 
virtual bool loadDeviceTree ()=0
 First declaration of this function. More...
 

Private Attributes

errorCorecoreErrors
 is used to hold the errors of BlackCore class More...
 
std::string capeMgrName
 is used to hold the capemgr name More...
 
std::string ocpName
 is used to hold the ocp name More...
 
std::string slotsFilePath
 is used to hold the slots file path More...
 

Detailed Description

Base class of the other classes.

This class is core of the BlackLib Library. It includes private functions like communicating with operating system and their limited versions for using from derived class.

Member Enumeration Documentation

This enum is used for defining ADC, PWM and SPI device driver names.

Enumerator
ADC_helper 

enumeration for adc device driver name for using at BlackCore::searchDirectoryOcp() function parameter

PWM_P8_13 

enumeration for P8_13 pwm device driver name

PWM_P8_19 

enumeration for P8_19 pwm device driver name

PWM_P9_14 

enumeration for P9_14 pwm device driver name

PWM_P9_16 

enumeration for P9_16 pwm device driver name

PWM_P9_21 

enumeration for P9_21 pwm device driver name

PWM_P9_22 

enumeration for P9_22 pwm device driver name

PWM_P9_42 

enumeration for P9_42 pwm device driver name

SPI0 

enumeration for SPI0 spi device driver name

SPI1 

enumeration for SPI1 spi device driver name

Constructor & Destructor Documentation

BlackLib::BlackCore::BlackCore ( )

Constructor of BlackCore class.

This function initializes errorCore struct and runs these functions:

BlackLib::BlackCore::~BlackCore ( )
virtual

Destructor of BlackCore class.

This function deletes errorCore struct pointer.

Member Function Documentation

std::string BlackLib::BlackCore::executeCommand ( std::string  command)
private

Executes system call.

This function executes system commands with using popen() function. This example executes "ls" command with argument "la" and saves output to returnValue variable.

string returnValue = executeCommand("ls -la");

bool BlackLib::BlackCore::findCapeMgrName ( )
private

Finds full name of capemgr directory.

This function searches "/sys/devices/" directory, to find directory which starts with "bone_capemgr."

Returns
True if successful, else false.
See also
BlackCore::searchDirectory()
bool BlackLib::BlackCore::findOcpName ( )
private

Finds full name of ocp directory.

This function searches "/sys/devices/" directory, to find directory which starts with "ocp."

Returns
True if successful, else false.
See also
BlackCore::searchDirectory()
std::string BlackLib::BlackCore::getCapeMgrName ( )
protected

Exports capemgr name to derived class.

Returns
BlackCore::capeMgrName variable.
errorCore * BlackLib::BlackCore::getErrorsFromCore ( )
protected

Exports errorCore struct to derived class.

Returns
errorCore struct pointer.
std::string BlackLib::BlackCore::getOcpName ( )
protected

Exports ocp name to derived class.

Returns
BlackCore::ocpName variable.
std::string BlackLib::BlackCore::getSlotsFilePath ( )
protected

Exports slots file path to derived class.

Returns
BlackCore::slotsFilePath variable.
virtual bool BlackLib::BlackCore::loadDeviceTree ( )
privatepure virtual
std::string BlackLib::BlackCore::searchDirectory ( std::string  searchIn,
std::string  searchThis 
)
private

Searches specified directory to find specified file/directory.

Parameters
[in]searchInsearching directory
[in]searchThissearch file/directory
Returns
Full name of searching file/directory.
std::string BlackLib::BlackCore::searchDirectoryOcp ( BlackCore::ocpSearch  searchThis)
protected

Searches ocp directory to find specified file/directory.

This function searches ocp directory only. It can be used from derived class.

Parameters
[in]searchThistakes BlackCore::ocpSearch type variable(enum)
Returns
Full name of searching file/directory.

Member Data Documentation

std::string BlackLib::BlackCore::capeMgrName
private

is used to hold the capemgr name

errorCore* BlackLib::BlackCore::coreErrors
private

is used to hold the errors of BlackCore class

std::string BlackLib::BlackCore::ocpName
private

is used to hold the ocp name

std::string BlackLib::BlackCore::slotsFilePath
private

is used to hold the slots file path


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