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:
Jakob Hasse
2020-03-31 18:52:37 +08:00
parent 303587103a
commit f835bead45
28 changed files with 2088 additions and 17 deletions

View File

@@ -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;
};
/**