irioCoreCpp Library Module  2.1.0
errorsIrio.h
1 #pragma once
2 
3 #include <stdexcept>
4 #include <string>
5 
6 namespace irio {
7 namespace errors {
8 
14 class IrioError: public std::runtime_error {
15  using std::runtime_error::runtime_error;
16 };
17 
24  using IrioError::IrioError;
25  public:
27  IrioError("Terminal not implemented in the profile") {
28  }
29 };
30 
37  using IrioError::IrioError;
38  public:
40  IrioError("Profile not implemented yet") {
41  }
42 };
43 
49  using IrioError::IrioError;
50  public:
52  IrioError("Resource not found") {
53  }
54 
63  ResourceNotFoundError(const std::uint32_t resourceNumber,
64  const std::string &resourceName) :
65  IrioError(std::to_string(resourceNumber)
66  + " is not a valid " + resourceName + " resource") { }
67 };
68 
74  public:
76  IrioError("FPGAVIversion mismatch") {
77  }
78 
87  FPGAVIVersionMismatchError(const std::string &foundVersion,
88  const std::string &expectedVersion) :
89  IrioError(
90  "FPGAVIVserion mismatch (" + foundVersion + " != "
91  + expectedVersion + ")") {
92  }
93 };
94 
101  public:
103  : IrioError("Platform specified is not supported") {}
110  explicit UnsupportedPlatformError(const std::uint8_t platform)
111  : IrioError(std::to_string(platform) +
112  "is not a supported platform value") {}
113 };
114 
122  public:
124  IrioError("DevProfile specified is not supported") {
125  }
126 
135  UnsupportedDevProfileError(const std::uint8_t devProfile,
136  const std::uint8_t platform) :
137  IrioError(
138  "DevProfile " + std::to_string(devProfile)
139  + " is not valid for the platform "
140  + std::to_string(platform)) {
141  }
142 };
143 
150  public:
152  IrioError("InitDone not ready in time") {
153  }
154 };
155 
161 class CLUARTTimeout: public IrioError {
162  public:
163  CLUARTTimeout() :
164  IrioError("CL UART timeout") {
165  }
166 };
167 
174  public:
176  IrioError("Invalid UART baud rate") {
177  }
178 };
179 
187  using IrioError::IrioError;
188 };
189 
196  using IrioError::IrioError;
197 };
198 
205  public:
207  IrioError("") {
208  }
209 
216  explicit RIODeviceNotFoundError(const std::string &serialNumber) :
217  IrioError("No RIO device with serial number " + serialNumber) {
218  }
219 };
220 
226 class NiFpgaError: public IrioError {
227  using IrioError::IrioError;
228 };
229 
236  using NiFpgaError::NiFpgaError;
237 };
238 
245  using NiFpgaError::NiFpgaError;
246 };
247 
248 
254 class DMAReadTimeout: public IrioError {
255  public:
262  DMAReadTimeout(const std::string &nameTermDMA, const std::uint32_t &n) :
263  IrioError("Timeout reading " + nameTermDMA + std::to_string(n)) {
264  }
265 };
266 
273  public:
279  explicit BFPParseBitfileError(const std::string &bitfile)
280  : IrioError("Error parsing " + bitfile) {}
281 
289  BFPParseBitfileError(const std::string &bitfile,
290  const std::string &errDescription)
291  : IrioError("Error parsing " + bitfile + ". Error: " + errDescription) {
292  }
293 };
294 
302  public:
304  IrioError("Unsupported AI coupling mode for module") {
305  }
306 };
307 
308 } // namespace errors
309 } // namespace irio
Exception when an error occurs while parsing the bitfile.
Definition: errorsIrio.h:272
BFPParseBitfileError(const std::string &bitfile, const std::string &errDescription)
Exception class for errors that occur during bitfile parsing.
Definition: errorsIrio.h:289
BFPParseBitfileError(const std::string &bitfile)
Exception class for errors that occur during bitfile parsing.
Definition: errorsIrio.h:279
Exception when the baud rate read is not a valid value.
Definition: errorsIrio.h:173
Exception when a timeout occurs in a CL UART operation.
Definition: errorsIrio.h:161
Exception when a timeout expires while trying to read a DMA.
Definition: errorsIrio.h:254
DMAReadTimeout(const std::string &nameTermDMA, const std::uint32_t &n)
Exception when a timeout expires while trying to read a DMA.
Definition: errorsIrio.h:262
Exception when FPGAVIVersion is not the one expected.
Definition: errorsIrio.h:73
FPGAVIVersionMismatchError(const std::string &foundVersion, const std::string &expectedVersion)
Exception indicating that there is a version mismatch and which version have been found that do not m...
Definition: errorsIrio.h:87
Exception when InitDone is not ready within a specified timeout.
Definition: errorsIrio.h:149
Base IRIO error.
Definition: errorsIrio.h:14
Exception when the modules installed in the platform are not the ones expected or the FPGA inform tha...
Definition: errorsIrio.h:186
Specific error when an error occurs while downloading the bitfile into the FPGA.
Definition: errorsIrio.h:235
Exception when an error returns from a NiFpga_* function.
Definition: errorsIrio.h:226
Specific error when NiFpga_Run return that the FPGA VI is already running.
Definition: errorsIrio.h:244
Exception when a profiel is a valid one, but has not been implemented yet.
Definition: errorsIrio.h:36
Exception when the specified RIO Device is not found.
Definition: errorsIrio.h:204
RIODeviceNotFoundError(const std::string &serialNumber)
RIO Device nor found.
Definition: errorsIrio.h:216
Exception when an error occurs while searching for the RIO Device.
Definition: errorsIrio.h:195
Exception when a resource (Register/DMA) is not found.
Definition: errorsIrio.h:48
ResourceNotFoundError(const std::uint32_t resourceNumber, const std::string &resourceName)
Exception when a resource (Register/DMA) is not found.
Definition: errorsIrio.h:63
Exception when terminal has not been implemented in the profile.
Definition: errorsIrio.h:23
Exception when trying to set an invalid AI coupling mode for a module.
Definition: errorsIrio.h:301
Exception when the DevProfile read from the FPGA does not matches any of the supported ones or if the...
Definition: errorsIrio.h:121
UnsupportedDevProfileError(const std::uint8_t devProfile, const std::uint8_t platform)
Invalid DevProfile.
Definition: errorsIrio.h:135
Exception when the platform read from the FPGA does not match any of the supported ones (See platform...
Definition: errorsIrio.h:100
UnsupportedPlatformError(const std::uint8_t platform)
Exception when the platform read from the FPGA does not match any of the supported ones.
Definition: errorsIrio.h:110