mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
C++: ESP Event wrapper classes
* Provide easy interface to esp_event in C++ * Extended functionality linke synchronous waiting for events * Closes IDF-1048 * Closes IDF-232
This commit is contained in:
@@ -22,13 +22,33 @@
|
||||
namespace idf {
|
||||
|
||||
/**
|
||||
* General exception class for exceptions on the ESP chips.
|
||||
* @brief
|
||||
* General exception class for all C++ exceptions in IDF.
|
||||
*
|
||||
* All throwing code in IDF should use either this exception directly or a sub-classes.
|
||||
* An error from the underlying IDF function is mandatory. The idea is to wrap the orignal IDF error code to keep
|
||||
* the error scheme partially compatible. If an exception occurs in a higher level C++ code not directly wrapping
|
||||
* IDF functions, an appropriate error code reflecting the cause must be chosen or newly created.
|
||||
*/
|
||||
struct ESPException : public std::exception {
|
||||
class ESPException : public std::exception {
|
||||
public:
|
||||
/**
|
||||
* @param error Error from underlying IDF functions.
|
||||
*/
|
||||
ESPException(esp_err_t error);
|
||||
|
||||
esp_err_t error;
|
||||
virtual ~ESPException() { }
|
||||
|
||||
/**
|
||||
* @return A textual representation of the contained error. This method only wraps \c esp_err_to_name.
|
||||
*/
|
||||
virtual const char *what() const noexcept;
|
||||
|
||||
/**
|
||||
* Error from underlying IDF functions. If an exception occurs in a higher level C++ code not directly wrapping
|
||||
* IDF functions, an appropriate error code reflecting the cause must be chosen or newly created.
|
||||
*/
|
||||
const esp_err_t error;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user