irioCoreCpp Library Module  2.1.0
irio::Irio Class Reference

irioCoreCpp main class. More...

#include <irioCoreCpp.h>

Public Member Functions

 Irio (const std::string &bitfilePath, const std::string &RIOSerialNumber, const std::string &FPGAVIversion, const bool parseVerbose=false)
 Constructor. More...
 
 ~Irio ()
 Destructor. More...
 
std::uint32_t getID () const
 Returns unique identifier. More...
 
void startFPGA (std::uint32_t timeoutMs=5000) const
 Starts the VI downloaded in the FPGA. More...
 
Platform getPlatform () const
 Returns the platform detected. More...
 
PROFILE_ID getProfileID () const
 Returns the selected profile's ID. More...
 
std::string getRIOSerial () const
 Returns RIO Serial of the device in use. More...
 
std::string getDeviceModel () const
 Return the device model of the RIO device in use. More...
 
std::string getLibraryVersion () const
 Return the library version. More...
 
void setCloseAttribute (std::uint32_t attribute)
 Sets the attribute used when closing the FPGA session. More...
 
std::uint32_t getCloseAttribute () const
 Gets the attribute used when closing the FPGA session. More...
 
TerminalsCommon getTerminalsCommon () const
 Terminals. More...
 
TerminalsAnalog getTerminalsAnalog () const
 Access to the analog group terminals. More...
 
TerminalsDigital getTerminalsDigital () const
 Access to the digital group terminals. More...
 
TerminalsAuxAnalog getTerminalsAuxAnalog () const
 Access to the aux analog group terminals. More...
 
TerminalsAuxDigital getTerminalsAuxDigital () const
 Access to the aux digital group terminals. More...
 
TerminalscRIO getTerminalsCRIO () const
 Access to the cRIO group terminals. More...
 
TerminalsFlexRIO getTerminalsFlexRIO () const
 Access to the FlexRIO group terminals. More...
 
TerminalsSignalGeneration getTerminalsSignalGeneration () const
 Access to the signal generation group terminals. More...
 
TerminalsDMADAQ getTerminalsDAQ () const
 Access to the DAQ group terminals. More...
 
TerminalsDMAIMAQ getTerminalsIMAQ () const
 Access to the IMAQ group terminals. More...
 
TerminalsIO getTerminalsIO () const
 Access to the cRIO IO group terminals. More...
 

Private Member Functions

void initDriver () const
 Initializes the low level library. More...
 
void closeSession () noexcept
 Closes the session if it has been opened.
 
void finalizeDriver () const noexcept
 Finalizes the low level library. More...
 
void openSession (const std::string &bitfilePath, const std::string &signature)
 Opens a session with the specified bitfile and signature. More...
 
void searchPlatform (ParserManager *parserManager)
 Searches for the TERMINAL_PLATFORM terminal and reads its value. More...
 
void selectDevProfile (ParserManager *parserManager)
 Searches for the TERMINAL_DEVPROFILE terminals and reads its value. More...
 

Private Attributes

const std::string m_rioSerialNumber
 RIO Serial of the device used.
 
std::string m_deviceModel
 Device model of the RIO device.
 
std::unique_ptr< Platformm_platform
 Platform of the RIO device.
 
std::unique_ptr< ProfileBasem_profile
 Profile specified in the bitfile.
 
std::string m_resourceName
 Name of the RIO device used. Obtained through the serialNumber specified.
 
NiFpga_Session m_session = 0
 Session obtained when opening a session using the NiFpga library.
 
std::uint32_t m_closeAttribute = 0
 Attribute to use when closing the session with the RIO device. More...
 

Detailed Description

irioCoreCpp main class.

Hides the complexity of using the National Instruments low level driver by abstracting several elements from the user. It parses the specified Bitfile and downloads it to the selected RIO device. It also provides the user function to access the terminals and perform read/write operations.

Definition at line 41 of file irioCoreCpp.h.

Constructor & Destructor Documentation

◆ Irio()

irio::Irio::Irio ( const std::string &  bitfilePath,
const std::string &  RIOSerialNumber,
const std::string &  FPGAVIversion,
const bool  parseVerbose = false 
)

Constructor.

  • Parses and extract all the resources in the specified Bitfile (bitfilePath)
  • Initializes the low level library
  • Downloads the Bitfile to the specified device (RIOSerialNumber)
  • Applies the appropriate profile depending on the values specified in the LabVIEW project. This allows access to some terminals or others.
  • Checks that the configured values and resources matches the design rules
Exceptions
irio::errors::RIODeviceNotFoundErrorUnable to found a device with the specified RIOSerialNumber
irio::errors::BFPParseBitfileErrorUnable to parse bitfilePath
irio::errors::ResourceNotFoundErrorSome of the necessary resources were not found in the bitfile
irio::errors::FPGAVIVersionMismatchErrorParsed FPGAVIversion does not match the one specified
irio::errors::UnsupportedDevProfileErrorThe DevProfile read does not match any of the supported profiles
irio::errors::UnsupportedPlatformErrorThe platform read does not match any of the supported platforms
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
bitfilePathBitfile to parse and download
RIOSerialNumberRIO Serial Number of the device to use
FPGAVIversionVersion of the Bitfile. If it does not match the one parsed and exception will be thrown
parseVerbosePrint discovered resources

◆ ~Irio()

irio::Irio::~Irio ( )

Destructor.

Closes the session if there is one open and finalizes the low level library.

Member Function Documentation

◆ finalizeDriver()

void irio::Irio::finalizeDriver ( ) const
privatenoexcept

Finalizes the low level library.

If system is CCS, does nothing.

◆ getCloseAttribute()

std::uint32_t irio::Irio::getCloseAttribute ( ) const

Gets the attribute used when closing the FPGA session.

This function retrieves the attribute used in the NiFpga_Close function. This occurs at class destruction.

Returns
The attribute value used when closing the session.

◆ getDeviceModel()

std::string irio::Irio::getDeviceModel ( ) const

Return the device model of the RIO device in use.

Returns
Device model of the RIO device in use

◆ getID()

std::uint32_t irio::Irio::getID ( ) const

Returns unique identifier.

Returns
Unique identifier

◆ getLibraryVersion()

std::string irio::Irio::getLibraryVersion ( ) const

Return the library version.

Returns
Library version

◆ getPlatform()

Platform irio::Irio::getPlatform ( ) const

Returns the platform detected.

The object returned has information about the type of platform along with the max number of resources for such platform

Returns
Platform

◆ getProfileID()

PROFILE_ID irio::Irio::getProfileID ( ) const

Returns the selected profile's ID.

Returns
Profile ID

◆ getRIOSerial()

std::string irio::Irio::getRIOSerial ( ) const

Returns RIO Serial of the device in use.

Returns
RIO Serial of the device in use

◆ getTerminalsAnalog()

TerminalsAnalog irio::Irio::getTerminalsAnalog ( ) const

Access to the analog group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Analog terminals

◆ getTerminalsAuxAnalog()

TerminalsAuxAnalog irio::Irio::getTerminalsAuxAnalog ( ) const

Access to the aux analog group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Aux analog terminals

◆ getTerminalsAuxDigital()

TerminalsAuxDigital irio::Irio::getTerminalsAuxDigital ( ) const

Access to the aux digital group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Aux digital terminals

◆ getTerminalsCommon()

TerminalsCommon irio::Irio::getTerminalsCommon ( ) const

Terminals.

Access to the common group terminals

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Common terminals

◆ getTerminalsCRIO()

TerminalscRIO irio::Irio::getTerminalsCRIO ( ) const

Access to the cRIO group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
cRIO terminals

◆ getTerminalsDAQ()

TerminalsDMADAQ irio::Irio::getTerminalsDAQ ( ) const

Access to the DAQ group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
DAQ terminals

◆ getTerminalsDigital()

TerminalsDigital irio::Irio::getTerminalsDigital ( ) const

Access to the digital group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Digital terminals

◆ getTerminalsFlexRIO()

TerminalsFlexRIO irio::Irio::getTerminalsFlexRIO ( ) const

Access to the FlexRIO group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
FlexRIO terminals

◆ getTerminalsIMAQ()

TerminalsDMAIMAQ irio::Irio::getTerminalsIMAQ ( ) const

Access to the IMAQ group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
IMAQ terminals

◆ getTerminalsIO()

TerminalsIO irio::Irio::getTerminalsIO ( ) const

Access to the cRIO IO group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
cRIO IO terminals

◆ getTerminalsSignalGeneration()

TerminalsSignalGeneration irio::Irio::getTerminalsSignalGeneration ( ) const

Access to the signal generation group terminals.

The user must call it to be able to read/write the related terminals.

Exceptions
irio::errors::TerminalNotImplementedErrorThe selected profile does not have the terminals
Returns
Signal generation terminals

◆ initDriver()

void irio::Irio::initDriver ( ) const
private

Initializes the low level library.

If system is CCS, does nothing.

◆ openSession()

void irio::Irio::openSession ( const std::string &  bitfilePath,
const std::string &  signature 
)
private

Opens a session with the specified bitfile and signature.

Opens a session to the FPGA, downloading the bitfile if necessary. It does not run the VI, until startFPGA has been called

Exceptions
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
bitfilePathThe path to the bitfile.
signatureThe signature for the session.

◆ searchPlatform()

void irio::Irio::searchPlatform ( ParserManager parserManager)
private

Searches for the TERMINAL_PLATFORM terminal and reads its value.

Checks that is a valid value and assigns the equivalent Platform to a variable.

Exceptions
irio::errors::UnsupportedPlatformErrorThe platform read does not match any of the supported platforms
irio::errors::NiFpgaErrorError occurred in an FPGA operation

◆ selectDevProfile()

void irio::Irio::selectDevProfile ( ParserManager parserManager)
private

Searches for the TERMINAL_DEVPROFILE terminals and reads its value.

Checks that is a valid value for the selected platform and assigns the corresponding profile to a variable. This determines which terminals can the user access.

Exceptions
irio::errors::ResourceNotFoundErrorSome of the necessary resources were not found in the bitfile
irio::errors::UnsupportedDevProfileErrorThe DevProfile read does not match any of the supported profiles
irio::errors::NiFpgaErrorError occurred in an FPGA operation

◆ setCloseAttribute()

void irio::Irio::setCloseAttribute ( std::uint32_t  attribute)

Sets the attribute used when closing the FPGA session.

This function sets the attribute used in the NiFpga_Close function. This occurs at class destruction.

Parameters
attributeThe attribute value to set.

◆ startFPGA()

void irio::Irio::startFPGA ( std::uint32_t  timeoutMs = 5000) const

Starts the VI downloaded in the FPGA.

Exceptions
irio::errors::InitializationTimeoutErrorInitDone is not ready after a timeout
irio::errors::ModulesNotOKErrorAt initialization, the modules are not ready
irio::errors::NiFpgaFPGAAlreadyRunningSpecified bitfile is already running in the FPGA
irio::errors::NiFpgaErrorError occurred in an FPGA operation
Parameters
timeoutMsMax time to wait for InitDone to be ready

Member Data Documentation

◆ m_closeAttribute

std::uint32_t irio::Irio::m_closeAttribute = 0
private

Attribute to use when closing the session with the RIO device.

By default is 0

Definition at line 375 of file irioCoreCpp.h.


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