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

allow for dynamic user task registration

This commit is contained in:
andreas
2023-10-27 19:55:22 +02:00
parent 682bbb5bb4
commit 9e05a86820
6 changed files with 42 additions and 7 deletions

View File

@@ -7,6 +7,8 @@
#include "GwBoatData.h"
#include "GwXDRMappings.h"
#include <map>
class GwApi;
typedef void (*GwUserTaskFunction)(GwApi *);
//API to be used for additional tasks
class GwApi{
public:
@@ -158,6 +160,13 @@ class GwApi{
virtual bool addXdrMapping(const GwXDRMappingDef &)=0;
virtual void addCapability(const String &name, const String &value)=0;
/**
* add a user task
* this allows you decide based on defines/config if a user task really should be added
* so this is the preferred solution over DECLARE_USERTASK
* The name should be similar to the function name of the user task (although not mandatory)
*/
virtual bool addUserTask(GwUserTaskFunction task,const String Name, int stackSize=2000)=0;
/**
* not thread safe methods