irioCoreCpp Library Module  2.1.0
irioCoreCpp.h
1 #pragma once
2 
3 #include <memory>
4 #include <string>
5 #include <utility>
6 
7 #include "platforms.h"
8 #include "profilesTypes.h"
9 #include "terminals/terminals.h"
10 
11 namespace irio {
12 
13 class ProfileBase;
14 class ParserManager;
15 
22 constexpr char PARSE_LOG_PATH_ENV_VAR[] = "PARSE_LOG_IRIOCORE";
23 
29 constexpr char DEFAULT_PARSE_LOG_PATH[] = "/tmp/";
30 
41 class Irio {
42  public:
64  Irio(const std::string &bitfilePath, const std::string &RIOSerialNumber,
65  const std::string &FPGAVIversion, const bool parseVerbose = false);
66 
72  ~Irio();
73 
79  std::uint32_t getID() const;
80 
94  void startFPGA(std::uint32_t timeoutMs = 5000) const;
95 
105 
111  PROFILE_ID getProfileID() const;
112 
118  std::string getRIOSerial() const;
119 
125  std::string getDeviceModel() const;
126 
132  std::string getLibraryVersion() const;
133 
142  void setCloseAttribute(std::uint32_t attribute);
143 
152  std::uint32_t getCloseAttribute() const;
153 
157 
170 
183 
196 
209 
222 
235 
248 
261 
274 
287 
300 
301  private:
305  void initDriver() const;
306 
310  void closeSession() noexcept;
311 
315  void finalizeDriver() const noexcept;
316 
328  void openSession(const std::string &bitfilePath,
329  const std::string &signature);
330 
340  void searchPlatform(ParserManager *parserManager);
341 
353  void selectDevProfile(ParserManager *parserManager);
354 
356  const std::string m_rioSerialNumber;
357 
359  std::string m_deviceModel;
360 
362  std::unique_ptr<Platform> m_platform;
363 
365  std::unique_ptr<ProfileBase> m_profile;
366 
368  std::string m_resourceName;
369 
371  NiFpga_Session m_session = 0;
372 
375  std::uint32_t m_closeAttribute = 0;
376 };
377 
378 } // namespace irio
irioCoreCpp main class.
Definition: irioCoreCpp.h:41
std::uint32_t getCloseAttribute() const
Gets the attribute used when closing the FPGA session.
TerminalsAuxDigital getTerminalsAuxDigital() const
Access to the aux digital group terminals.
void closeSession() noexcept
Closes the session if it has been opened.
Platform getPlatform() const
Returns the platform detected.
TerminalsAnalog getTerminalsAnalog() const
Access to the analog group terminals.
PROFILE_ID getProfileID() const
Returns the selected profile's ID.
std::unique_ptr< ProfileBase > m_profile
Profile specified in the bitfile.
Definition: irioCoreCpp.h:365
std::string m_deviceModel
Device model of the RIO device.
Definition: irioCoreCpp.h:359
TerminalscRIO getTerminalsCRIO() const
Access to the cRIO group terminals.
void initDriver() const
Initializes the low level library.
TerminalsSignalGeneration getTerminalsSignalGeneration() const
Access to the signal generation group terminals.
NiFpga_Session m_session
Session obtained when opening a session using the NiFpga library.
Definition: irioCoreCpp.h:371
TerminalsAuxAnalog getTerminalsAuxAnalog() const
Access to the aux analog group terminals.
Irio(const std::string &bitfilePath, const std::string &RIOSerialNumber, const std::string &FPGAVIversion, const bool parseVerbose=false)
Constructor.
TerminalsFlexRIO getTerminalsFlexRIO() const
Access to the FlexRIO group terminals.
std::string m_resourceName
Name of the RIO device used. Obtained through the serialNumber specified.
Definition: irioCoreCpp.h:368
void openSession(const std::string &bitfilePath, const std::string &signature)
Opens a session with the specified bitfile and signature.
std::uint32_t getID() const
Returns unique identifier.
void finalizeDriver() const noexcept
Finalizes the low level library.
TerminalsDigital getTerminalsDigital() const
Access to the digital group terminals.
std::uint32_t m_closeAttribute
Attribute to use when closing the session with the RIO device.
Definition: irioCoreCpp.h:375
std::string getDeviceModel() const
Return the device model of the RIO device in use.
void startFPGA(std::uint32_t timeoutMs=5000) const
Starts the VI downloaded in the FPGA.
void setCloseAttribute(std::uint32_t attribute)
Sets the attribute used when closing the FPGA session.
TerminalsDMADAQ getTerminalsDAQ() const
Access to the DAQ group terminals.
std::unique_ptr< Platform > m_platform
Platform of the RIO device.
Definition: irioCoreCpp.h:362
TerminalsDMAIMAQ getTerminalsIMAQ() const
Access to the IMAQ group terminals.
TerminalsIO getTerminalsIO() const
Access to the cRIO IO group terminals.
const std::string m_rioSerialNumber
RIO Serial of the device used.
Definition: irioCoreCpp.h:356
void searchPlatform(ParserManager *parserManager)
Searches for the TERMINAL_PLATFORM terminal and reads its value.
std::string getRIOSerial() const
Returns RIO Serial of the device in use.
std::string getLibraryVersion() const
Return the library version.
TerminalsCommon getTerminalsCommon() const
Terminals.
~Irio()
Destructor.
void selectDevProfile(ParserManager *parserManager)
Searches for the TERMINAL_DEVPROFILE terminals and reads its value.
Responsible for managing the parsing of resources for a bitfile.
Definition: parserManager.h:76
Generic Platform class.
Definition: platforms.h:23
Base profile class.
Definition: profileBase.h:22
Class managing all terminals related to the analog functionality of the RIO device.
Class managing all terminals related to the auxiliary analog functionality of the RIO device.
Class managing all terminals related to the auxiliary digital functionality of the RIO device.
Class managing terminals common to all profiles.
Class managing the terminals used for DMA DAQ operations.
Class managing the resources used for IMAQ DAQ operations.
Class managing all terminals related to the digital functionality of the RIO device.
Class managing all terminals specific to FlexRIO devices.
Class managing all terminals related to the cRIO IO functionality.
Definition: terminalsIO.h:13
Class managing all terminals related to the signal generation functionality of the RIO device.
Class managing all terminals specific to cRIO devices.
Definition: terminalsCRIO.h:15