#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include "gqueue.h"
#include "gmatlabdatafile.h"
#include "gdatalogger.h"
Go to the source code of this file.
Functions | |
int | gDataLogger_Init (PGDATALOGGER pgDataLogger, char *filename, char *dirname) |
int | gDataLogger_DeclareVariable (PGDATALOGGER pgDataLogger, char *varname, char *varunit, int nrows, int ncols, int queuesize) |
int | gDataLogger_InsertVariable (PGDATALOGGER pgDataLogger, char *varname, double *varvalue) |
int | gDataLogger_MatfileUpdate (PGDATALOGGER pgDataLogger) |
int | gDataLogger_IPCUpdate (PGDATALOGGER pgDataLogger) |
int | gDataLogger_IPC_RetrieveVariable (char *varname, char *varunit, double *pbuffer, int *bufferlen) |
int | gDataLogger_Close (PGDATALOGGER pgDataLogger) |
Variables | |
static GDATALOGGERIPC_SHM * | pgDataLoggerIPC_SHM = NULL |
static int | gDataLoggerIPC_SHM_flagmodeserver = 1 |
static int | gDataLoggerIPC_SHM_fd = 0 |
int gDataLogger_Close | ( | PGDATALOGGER | pgDataLogger | ) |
Definition at line 362 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, GDATALOGGER_IPC_STATEFILE, gDataLogger_MatfileUpdate(), gDataLoggerIPC_SHM_fd, gDataLoggerIPC_SHM_flagmodeserver, gMATLABDataFile_Close(), gMATLABDataFile_SaveVector(), GDATALOGGER::GMatlabDataFileConfig, GDATALOGGERVARIABLE::GMatlabDataFileIndex, GDATALOGGERVARIABLE::HasBeenWritten, GDATALOGGER::m_NumberOfVariables, GDATALOGGERVARIABLE::Nc, GDATALOGGERVARIABLE::Nr, TRUE, GDATALOGGERVARIABLE::VariableName, GDATALOGGER::Variables, and GDATALOGGERVARIABLE::VariableUnit.
Referenced by datalogger_close().
int gDataLogger_DeclareVariable | ( | PGDATALOGGER | pgDataLogger, |
char * | varname, | ||
char * | varunit, | ||
int | nrows, | ||
int | ncols, | ||
int | queuesize | ||
) |
Definition at line 173 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, GDATALOGGERVARIABLE::CircularQueueControl, FALSE, GDATALOGGER_MAXVARIABLES, GDATALOGGERVARIABLE::GMatlabDataFileIndex, gQUEUE_Init(), GDATALOGGER::m_NumberOfVariables, GDATALOGGERVARIABLE::Nc, GDATALOGGERVARIABLE::Nr, QUEUE_MAXDESTINATIONS, TRUE, GDATALOGGERVARIABLE::VariableName, GDATALOGGER::Variables, and GDATALOGGERVARIABLE::VariableUnit.
Referenced by datalogger_init().
int gDataLogger_Init | ( | PGDATALOGGER | pgDataLogger, |
char * | filename, | ||
char * | dirname | ||
) |
Definition at line 42 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, FALSE, GDATALOGGERIPC_SHM::Flag, GDATALOGGER_IPC_FLAGIDDLE, GDATALOGGER_IPC_STATEFILE, GDATALOGGER_MAXVARIABLES, gDataLoggerIPC_SHM_fd, gDataLoggerIPC_SHM_flagmodeserver, gMATLABDataFile_OpenWrite(), GDATALOGGER::GMatlabDataFileConfig, GDATALOGGERVARIABLE::GMatlabDataFileIndex, GDATALOGGERVARIABLE::HasBeenWritten, GDATALOGGER::m_NumberOfVariables, GDATALOGGERVARIABLE::Nc, GDATALOGGERVARIABLE::Nr, status, TRUE, GDATALOGGERVARIABLE::VariableName, GDATALOGGER::Variables, and GDATALOGGERVARIABLE::VariableUnit.
Referenced by datalogger_init().
int gDataLogger_InsertVariable | ( | PGDATALOGGER | pgDataLogger, |
char * | varname, | ||
double * | varvalue | ||
) |
Definition at line 199 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, GDATALOGGERVARIABLE::CircularQueueControl, FALSE, GQUEUECONTROL::FlagFull, gDataLogger_MatfileUpdate(), gQUEUE_RequestWriteIndex(), GDATALOGGERVARIABLE::HasBeenWritten, GDATALOGGER::m_NumberOfVariables, GDATALOGGERVARIABLE::Nc, GDATALOGGERVARIABLE::Nr, QUEUE_DESTINATION_FILE, TRUE, GDATALOGGERVARIABLE::VariableName, and GDATALOGGER::Variables.
Referenced by datalogger_init(), datalogger_set_Ts(), and datalogger_update().
int gDataLogger_IPC_RetrieveVariable | ( | char * | varname, |
char * | varunit, | ||
double * | pbuffer, | ||
int * | bufferlen | ||
) |
Definition at line 319 of file gdatalogger.c.
References GDATALOGGERIPC_SHM::Flag, GDATALOGGER_IPC_FLAGDATAAVAILABLE, GDATALOGGER_IPC_FLAGIDDLE, GDATALOGGER_IPC_FLAGNOTEXIST, GDATALOGGER_IPC_FLAGREQUESTDATA, GDATALOGGER_IPC_FLAGTIMEOUT, GDATALOGGERIPC_SHM::QueueData, GDATALOGGERIPC_SHM::QueueSize, GDATALOGGERIPC_SHM::VariableName, and GDATALOGGERIPC_SHM::VariableUnit.
int gDataLogger_IPCUpdate | ( | PGDATALOGGER | pgDataLogger | ) |
Definition at line 274 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, GDATALOGGERVARIABLE::CircularQueueControl, FALSE, GDATALOGGERIPC_SHM::Flag, GDATALOGGER_IPC_FLAGDATAAVAILABLE, GDATALOGGER_IPC_FLAGNOTEXIST, GDATALOGGER_IPC_FLAGREQUESTDATA, gDataLoggerIPC_SHM_flagmodeserver, gQUEUE_GetNumberOfUnreadData(), gQUEUE_RequestReadIndex(), GDATALOGGER::m_NumberOfVariables, QUEUE_DESTINATION_IPC, GDATALOGGERIPC_SHM::QueueData, GDATALOGGERIPC_SHM::QueueSize, TRUE, GDATALOGGERVARIABLE::VariableName, GDATALOGGERIPC_SHM::VariableName, GDATALOGGER::Variables, GDATALOGGERVARIABLE::VariableUnit, and GDATALOGGERIPC_SHM::VariableUnit.
Referenced by datalogger_update_IPC().
int gDataLogger_MatfileUpdate | ( | PGDATALOGGER | pgDataLogger | ) |
Definition at line 245 of file gdatalogger.c.
References GDATALOGGERVARIABLE::CircularQueue, GDATALOGGERVARIABLE::CircularQueueControl, FALSE, gMATLABDataFile_SaveVector(), GDATALOGGER::GMatlabDataFileConfig, GDATALOGGERVARIABLE::GMatlabDataFileIndex, gQUEUE_GetNumberOfUnreadData(), gQUEUE_RequestReadIndex(), GDATALOGGER::m_NumberOfVariables, QUEUE_DESTINATION_FILE, TRUE, GDATALOGGERVARIABLE::VariableName, and GDATALOGGER::Variables.
Referenced by datalogger_close(), datalogger_write_file(), gDataLogger_Close(), and gDataLogger_InsertVariable().
|
static |
Definition at line 36 of file gdatalogger.c.
Referenced by gDataLogger_Close(), and gDataLogger_Init().
|
static |
Definition at line 31 of file gdatalogger.c.
Referenced by gDataLogger_Close(), gDataLogger_Init(), and gDataLogger_IPCUpdate().
|
static |
Definition at line 30 of file gdatalogger.c.