sql integration for create and insert captor metadata and trials ok

This commit is contained in:
QuentinPerret 2023-06-02 16:35:22 +02:00
parent ab1a87c6ac
commit cb0e33c175
5 changed files with 18 additions and 24 deletions

View file

@ -1,9 +1,10 @@
cmake_minimum_required(VERSION 2.8)
project(Traitement-signal-plantes C)
include(CTest)
enable_testing()
set(CMAKE_C_FLAGS "-lsqlite3 -std=c99 -g -Wall") #what are the flag for ?
set(CMAKE_C_FLAGS "-std=c99 -g -Wall") #what are the flag for ?
file(MAKE_DIRECTORY RawDataFiles) #why do we make this folder each time ?
file(MAKE_DIRECTORY Executable)
@ -13,7 +14,7 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY Executable) #Set Executable directory as def
add_executable(exect fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c database.c main.c)
# add_executable(exect main.c simulateFlux.c queue.c power.c growthRate.c average.c getArray.c fileGestion.c)
find_package(SQLite3)
find_package(SQLite3 REQUIRED)
target_link_libraries(exect ${SQLite3_LIBRARIES} m)
@ -24,6 +25,7 @@ set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer")
set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS "verbosity=1:symbolize=1:abort_on_error=1:detect_leaks=1")
add_executable(ctest fileGestion.c getArray.c average.c growthRate.c queue.c simulateFlux.c database.c ctest.c)
target_link_libraries(ctest ${SQLite3_LIBRARIES} m)
target_link_libraries(ctest ${CMAKE_THREAD_LIBS_INIT} m)
add_test(test_queueCreateEmpty ./ctest queueCreateEmpty)

View file

@ -240,7 +240,7 @@ int initiaizeNewTrial(char *position, double frequency, bool *captorOneHot)
{
if (captorOneHot[i])
{
insertCaptorMetadataElement(i, trialId);
insertCaptorMetadataElement(i + 1, trialId);
createCaptorDataTable(trialId, i + 1);
}
}

Binary file not shown.

View file

@ -148,14 +148,6 @@ int main(int argc, char **argv)
}
printf("%d", nCol);
for (int i = 0; i < 8; i++)
{
if (selectionCaptors[i])
{
nCol++;
}
}
rawDataWriteFlag = true;
period = 1 / freqEch;
@ -167,19 +159,19 @@ int main(int argc, char **argv)
createDb(); // Created the Db if not exist
initiaizeNewTrial("test", freqEch, selectionCaptors); // Initialize Trials data and tables
pthread_t rawData;
if (pthread_create(&rawData, NULL, threadSimulateFlux, "threadSimulflux") != 0)
{
perror("threadSimulflux() error");
exit(1);
}
// pthread_t rawData;
// if (pthread_create(&rawData, NULL, threadSimulateFlux, "threadSimulflux") != 0)
// {
// perror("threadSimulflux() error");
// exit(1);
// }
pthread_t calculAverage;
if (pthread_create(&calculAverage, NULL, threadCalculAverage, "threadCalculAverage"))
{
perror("threadCalculAverage() error");
exit(1);
}
// pthread_t calculAverage;
// if (pthread_create(&calculAverage, NULL, threadCalculAverage, "threadCalculAverage"))
// {
// perror("threadCalculAverage() error");
// exit(1);
// }
// pthread_t calculGrowthRate;
// if (pthread_create(&calculGrowthRate, NULL, threadCalculGrowthRate, "threadCalculGrowthRate"))
@ -188,7 +180,7 @@ int main(int argc, char **argv)
// exit(1);
// }
pthread_exit(NULL);
// pthread_exit(NULL);
sqlite3_shutdown();
}

BIN
Code-C/robotgowest.db Normal file

Binary file not shown.