Here is the modified source and header for the Runner and DBabstraction class:
Runner.h:
#ifndef Runner_h
#define Runner_h
#include "Arduino.h"
#include "DBabstraction.h"
class Runner {
public:
Runner();
void run();
static DBabstraction *globalDB;
void globalConfigWriter( unsigned long address, byte data ) {
globalDB->dbWriter(address, data);
}
byte globalConfigReader( unsigned long address ) {
return globalDB->dbReader(address);
}
private:
};
#endif // Runner_h
Runner.cpp:
// Library header
#include "Runner.h"
// Code
/**************************************************/
DBabstraction *Runner::globalDB = NULL;
// public functions
Runner::Runner(){
globalDB = new DBabstraction();
if(globalDB)
globalDB->begin();
}
void Runner::run(){
//Serial.printf("ok\n");
}
DBabstraction.h:
#ifndef DBabstraction_h
#define DBabstraction_h
#include "Arduino.h"
#include <EDB.h>
//Use SPIFFS FS as data storage
#include "LStorage.h"
#include "LFlash.h"
#define Drv LFlash // use Internal 10M Flash
#define TABLE_SIZE 8192
#define FILE_PATH "tdb.txt"
// The number of demo records that should be created. This should be less
// than (TABLE_SIZE - sizeof(EDB_Header)) / sizeof(LogEvent). If it is higher,
// operations will return EDB_OUT_OF_RANGE for all records outside the usable range.
#define RECORDS_TO_CREATE 10
//
class DBabstraction {
public:
DBabstraction();
EDB *myDB;
void begin();
static LFile myFile;
static void dbWriter( unsigned long address, byte data );
static byte dbReader( unsigned long address );
private:
static DBabstraction * pInstance;
};
#endif // DBabstraction_h
DBabstraction.cpp:
// Library header
#include "DBabstraction.h"
DBabstraction *DBabstraction::pInstance = NULL;
//constructor
DBabstraction::DBabstraction(){
pInstance = this;
myDB = new EDB(DBabstraction::dbWriter, DBabstraction::dbReader); //
}
//public functions
void DBabstraction::dbWriter(unsigned long address, byte data ){
/* nothing */
}
byte DBabstraction::dbReader( unsigned long address){
/* nothing */
}
//public functions
void DBabstraction::begin(){
/* nothing */
}
// Code DBabstraction.cpp
Compiles, and no more warning related to the globalDB or myDB, seems to be working (I need to test more and declare&implement the write and read functions, and higher logic).
At this stage again I want to thank you for your patience and humor PaulS ![]()
Still before implementing the read/write functions there are two warnings during compilation, how can I address them Paul ?
In file included from /Users/Thibault/Desktop/CPPtest/CPPTEST.ino:3:0:
/Users/Thibault/Documents/Arduino/libraries/EDB/EDB.h:24:25: warning: 'typedef' was ignored in this declaration [enabled by default]
};
^
In file included from /var/folders/y8/2cf22w216j7cxt1k7g54v1y80000gp/T/arduino_build_563584/sketch/DBabstraction.h:5:0,
from /var/folders/y8/2cf22w216j7cxt1k7g54v1y80000gp/T/arduino_build_563584/sketch/Runner.h:5,
from /var/folders/y8/2cf22w216j7cxt1k7g54v1y80000gp/T/arduino_build_563584/sketch/Runner.cpp:2:
/Users/Thibault/Documents/Arduino/libraries/EDB/EDB.h:24:25: warning: 'typedef' was ignored in this declaration [enabled by default]
};
^
Merci beaucoup.