diff --git a/lib/api/GwApi.h b/lib/api/GwApi.h index 61b2564..cb54cc3 100644 --- a/lib/api/GwApi.h +++ b/lib/api/GwApi.h @@ -234,7 +234,7 @@ class GwApi{ * * */ -#define DECLARE_TASKIF_IMPL(task,type) \ +#define DECLARE_TASKIF_IMPL(type) \ template<> \ inline bool GwApi::TaskInterfaces::set(const type & v) {\ return iset(__FILE__,#type,GwApi::TaskInterfaces::Ptr(new type(v))); \ @@ -250,6 +250,6 @@ class GwApi{ return type(*tp); \ } #ifndef DECLARE_TASKIF - #define DECLARE_TASKIF(task,type) DECLARE_TASKIF_IMPL(task,type) + #define DECLARE_TASKIF(type) DECLARE_TASKIF_IMPL(type) #endif #endif diff --git a/lib/buttontask/GwIButtonTask.h b/lib/buttontask/GwIButtonTask.h index df6e73a..45a019e 100644 --- a/lib/buttontask/GwIButtonTask.h +++ b/lib/buttontask/GwIButtonTask.h @@ -14,6 +14,6 @@ public: ButtonState state=OFF; long pressCount=0; }; -DECLARE_TASKIF(handleButtons,IButtonTask); +DECLARE_TASKIF(IButtonTask); #endif \ No newline at end of file diff --git a/lib/exampletask/GwIExampleTask.h b/lib/exampletask/GwIExampleTask.h index 976c0ab..85b0c81 100644 --- a/lib/exampletask/GwIExampleTask.h +++ b/lib/exampletask/GwIExampleTask.h @@ -9,6 +9,6 @@ class ExampleTaskIf : public GwApi::TaskInterfaces::Base{ long count=0; String someValue; }; -DECLARE_TASKIF(exampleTask,ExampleTaskIf); +DECLARE_TASKIF(ExampleTaskIf); #endif \ No newline at end of file diff --git a/lib/usercode/GwUserCode.cpp b/lib/usercode/GwUserCode.cpp index 5fcc21b..189ebcd 100644 --- a/lib/usercode/GwUserCode.cpp +++ b/lib/usercode/GwUserCode.cpp @@ -3,9 +3,9 @@ #define DECLARE_INITFUNCTION(task) GwInitTask __Init##task##__(task,#task); #define DECLARE_CAPABILITY(name,value) GwUserCapability __CAP##name##__(#name,#value); #define DECLARE_STRING_CAPABILITY(name,value) GwUserCapability __CAP##name##__(#name,value); -#define DECLARE_TASKIF(task,type) \ - DECLARE_TASKIF_IMPL(task,type) \ - GwIreg __register##type(#task,__FILE__,#type) +#define DECLARE_TASKIF(type) \ + DECLARE_TASKIF_IMPL(type) \ + GwIreg __register##type(__FILE__,#type) #include "GwUserCode.h" #include "GwSynchronized.h" @@ -60,8 +60,8 @@ static void registerInterface(const String &task,const String &file, const Strin class GwIreg{ public: - GwIreg(const String &task,const String &file, const String &name){ - registerInterface(task,file,name); + GwIreg(const String &file, const String &name){ + registerInterface("",file,name); } }; @@ -124,7 +124,6 @@ class TaskInterfacesStorage{ } if (it->second.task != task){ LOG_DEBUG(GwLog::ERROR,"TaskInterfaces: invalid set %s wrong task, expected %s , got %s",name.c_str(),it->second.task.c_str(),task.c_str()); - return false; } auto vit=values.find(name); if (vit != values.end()){