1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-14 06:23:07 +01:00

added claiming for task interface

This commit is contained in:
andreas
2023-10-27 20:54:39 +02:00
parent a6c1511298
commit c03e54601c
4 changed files with 44 additions and 6 deletions

View File

@@ -61,6 +61,7 @@ class GwApi{
protected:
virtual bool iset(const String &file, const String &name, Ptr v) = 0;
virtual Ptr iget(const String &name, int &result) = 0;
virtual bool iclaim(const String &name, const String &task)=0;
public:
template <typename T>
bool set(const T &v){
@@ -71,6 +72,10 @@ class GwApi{
res=-1;
return T();
}
template <typename T>
bool claim(const String &task){
return false;
}
};
class Status{
public:
@@ -248,7 +253,12 @@ class GwApi{
}\
type *tp=(type*)ptr.get(); \
return type(*tp); \
}
}\
template<> \
inline bool GwApi::TaskInterfaces::claim<type>(const String &task) {\
return iclaim(#type,task);\
}\
#ifndef DECLARE_TASKIF
#define DECLARE_TASKIF(type) DECLARE_TASKIF_IMPL(type)
#endif