summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xReleaseNotes.txt3
-rw-r--r--doc/dlt-system.conf.56
-rwxr-xr-xdoc/filetransfer_mainpage.h7
-rw-r--r--include/dlt/dlt_filetransfer.h23
-rw-r--r--src/lib/dlt_filetransfer.c138
-rw-r--r--src/system/dlt-system-log.c15
-rwxr-xr-xsrc/system/dlt-system.c8
-rw-r--r--src/system/dlt-system.conf10
-rw-r--r--src/system/dlt-system.h34
-rw-r--r--src/system/dlt-system_cfg.h2
-rw-r--r--src/tests/dlt-test-filetransfer.c42
11 files changed, 181 insertions, 107 deletions
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 2f5500c..ea5793e 100755
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -23,9 +23,10 @@ Alexander.AW.Wenzel@bmw.de
Changes in this release
-----------------------
-2.4.3 BETA
+2.4.5_BETA
Improvements
+ * [GENDLT-16] Create variable in dlt-system.conf to configure the timeout of the filetransfer
* [GSW-138] API Extension to resend the log messages in the user buffer Fixed
* [GSW-137] Wrong include gives error on compailing against dlt
* [GSW-135] Fixed compile warnings
diff --git a/doc/dlt-system.conf.5 b/doc/dlt-system.conf.5
index d09a9c1..a3b2476 100644
--- a/doc/dlt-system.conf.5
+++ b/doc/dlt-system.conf.5
@@ -74,6 +74,12 @@ This value defines the amount of time after which a sent file is deleted
and the next file is strated to be transmitted.
.IP
Default: 10
+.TP
+.B FiletransferTimeoutBetweenLogs
+This value defines the amount of time to wait between two file transfer
+logs of a single file.
+.IP
+Default: 10
.SH LOG FILES OPTIONS
.TP
.B LogFileEnable
diff --git a/doc/filetransfer_mainpage.h b/doc/filetransfer_mainpage.h
index 11b1c1e..d1a2f6b 100755
--- a/doc/filetransfer_mainpage.h
+++ b/doc/filetransfer_mainpage.h
@@ -114,6 +114,8 @@ Here is the content of the information package:
#define ERROR_FILE_HEAD -400
//! Error code for dlt_user_log_file_data
#define ERROR_FILE_DATA -500
+//! Error code for dlt_user_log_file_data
+#define DLT_FILETRANSFER_ERROR_FILE_DATA_USER_BUFFER_FAILED -501
//! Error code for dlt_user_log_file_end
#define ERROR_FILE_END -600
//! Error code for dlt_user_log_file_infoAbout
@@ -180,6 +182,10 @@ The method needs the following arguments:
The order of the packages is to send at first the header, then one or more data packages (depends on the filesize) and in the end the end package.
The advantage of this method is, that you must not handle the package ordering by your own.
+Within dlt_user_log_file_complete the free space of the user buffer will be checked. If the free space of the user buffer < 50% then the
+actual package won't be transferred and a timeout will be executed.
+
+If the daemon crashes and the user buffer is full -> the automatic method is in an endless loop.
\subsection Manual Manual
Manual starting filetransfer with the following commands:
@@ -191,6 +197,7 @@ This ordering is very important, so that you can save the transferred files to h
The advantage of using several steps to transfer files by your own is, that you are very flexible to integrate the filetransfer
in your code.
+An other difference to the automatic method is, that only a timeout will be done. There is no check of the user buffer.
\subsection Important Important for integration
You should care about blocking the main program when you intergrate filetransfer in your code.
diff --git a/include/dlt/dlt_filetransfer.h b/include/dlt/dlt_filetransfer.h
index f70b6f7..e17f79f 100644
--- a/include/dlt/dlt_filetransfer.h
+++ b/include/dlt/dlt_filetransfer.h
@@ -4,6 +4,29 @@
#include <signal.h> /* Signal handling */
#include "errno.h"
+
+//! Error code for dlt_user_log_file_complete
+#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE -300
+//! Error code for dlt_user_log_file_complete
+#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE1 -301
+//! Error code for dlt_user_log_file_complete
+#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE2 -302
+//! Error code for dlt_user_log_file_complete
+#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE3 -303
+//! Error code for dlt_user_log_file_head
+#define DLT_FILETRANSFER_ERROR_FILE_HEAD -400
+//! Error code for dlt_user_log_file_data
+#define DLT_FILETRANSFER_ERROR_FILE_DATA -500
+//! Error code for dlt_user_log_file_data
+#define DLT_FILETRANSFER_ERROR_FILE_DATA_USER_BUFFER_FAILED -501
+//! Error code for dlt_user_log_file_end
+#define DLT_FILETRANSFER_ERROR_FILE_END -600
+//! Error code for dlt_user_log_file_infoAbout
+#define DLT_FILETRANSFER_ERROR_INFO_ABOUT -700
+//! Error code for dlt_user_log_file_packagesCount
+#define DLT_FILETRANSFER_ERROR_PACKAGE_COUNT -800
+
+
//!Transfer the complete file as several dlt logs.
/**This method transfer the complete file as several dlt logs. At first it will be checked that the file exist.
* In the next step some generic informations about the file will be logged to dlt.
diff --git a/src/lib/dlt_filetransfer.c b/src/lib/dlt_filetransfer.c
index bdb9759..a9b30bf 100644
--- a/src/lib/dlt_filetransfer.c
+++ b/src/lib/dlt_filetransfer.c
@@ -6,24 +6,8 @@
//!Defines the minimum timeout between two dlt logs. This is important because dlt should not be flooded with too many logs in a short period of time.
#define MIN_TIMEOUT 20
-//! Error code for dlt_user_log_file_complete
-#define ERROR_FILE_COMPLETE -300
-//! Error code for dlt_user_log_file_complete
-#define ERROR_FILE_COMPLETE1 -301
-//! Error code for dlt_user_log_file_complete
-#define ERROR_FILE_COMPLETE2 -302
-//! Error code for dlt_user_log_file_complete
-#define ERROR_FILE_COMPLETE3 -303
-//! Error code for dlt_user_log_file_head
-#define ERROR_FILE_HEAD -400
-//! Error code for dlt_user_log_file_data
-#define ERROR_FILE_DATA -500
-//! Error code for dlt_user_log_file_end
-#define ERROR_FILE_END -600
-//! Error code for dlt_user_log_file_infoAbout
-#define ERROR_INFO_ABOUT -700
-//! Error code for dlt_user_log_file_packagesCount
-#define ERROR_PACKAGE_COUNT -800
+
+#define DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES LONG_MAX
//!Buffer for dlt file transfer. The size is defined by BUFFER_SIZE
@@ -88,28 +72,28 @@ int isFile (const char* file)
//!Waits a period of time
/**Waits a period of time. The minimal time to wait is MIN_TIMEOUT. This makes sure that the FIFO of dlt is not flooded.
- * @param timeout Timeout to wait in seconds in ms but can not be smaller as MIN_TIMEOUT
+ * @param timeout Timeout to in ms but can not be smaller as MIN_TIMEOUT
*/
void doTimeout(int timeout)
{
+ usleep(timeout * 1000);
+}
+
+//!Checks free space of the user buffer
+/**
+ * @param returns -1 if more than 50% space in the user buffer is free. Otherwise 1 will be returned.
+ */
+int checkUserBufferForFreeSpace()
+{
int total_size, used_size;
-
+
dlt_user_check_buffer(&total_size, &used_size);
-
- /* sleep only if more than 50% of buffer used */
+
if((total_size - used_size) < (total_size/2))
{
- printf("Wait %d of %d already used\n",used_size,total_size);
-
- if(timeout>MIN_TIMEOUT)
- {
- usleep(timeout * 1000);
- }
- else
- {
- usleep(MIN_TIMEOUT * 1000);
- }
+ return -1;
}
+ return 1;
}
//!Deletes the given file
@@ -171,8 +155,8 @@ int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
);
return 0;
} else {
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_INFO_ABOUT);
- return ERROR_INFO_ABOUT;
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_INFO_ABOUT);
+ return DLT_FILETRANSFER_ERROR_INFO_ABOUT;
}
}
@@ -192,23 +176,23 @@ int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, in
{
if(!isFile(filename))
{
- dlt_user_log_file_errorMessage(fileContext,filename, ERROR_FILE_COMPLETE);
- return ERROR_FILE_COMPLETE;
+ dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_COMPLETE);
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE;
}
if(dlt_user_log_file_header(fileContext,filename) != 0)
{
- return ERROR_FILE_COMPLETE1;
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE1;
}
- if(dlt_user_log_file_data(fileContext, filename,LONG_MAX,timeout) != 0)
+ if(dlt_user_log_file_data(fileContext, filename,DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES,timeout) != 0)
{
- return ERROR_FILE_COMPLETE2;
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE2;
}
if(dlt_user_log_file_end(fileContext,filename, deleteFlag) != 0)
{
- return ERROR_FILE_COMPLETE3;
+ return DLT_FILETRANSFER_ERROR_FILE_COMPLETE3;
}
return 0;
@@ -249,7 +233,7 @@ int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filenam
}
}
} else {
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_PACKAGE_COUNT);
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_PACKAGE_COUNT);
return -1;
}
}
@@ -282,8 +266,8 @@ int dlt_user_log_file_header(DltContext *fileContext,const char *filename){
}
else
{
- dlt_user_log_file_errorMessage(fileContext,filename, ERROR_FILE_HEAD);
- return ERROR_FILE_HEAD;
+ dlt_user_log_file_errorMessage(fileContext,filename, DLT_FILETRANSFER_ERROR_FILE_HEAD);
+ return DLT_FILETRANSFER_ERROR_FILE_HEAD;
}
}
@@ -306,11 +290,11 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
file = fopen (filename,"rb");
if (file == NULL)
{
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_FILE_DATA);
- return ERROR_FILE_DATA;
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
}
- if( (packageToTransfer != LONG_MAX && packageToTransfer > dlt_user_log_file_packagesCount(fileContext,filename)) || packageToTransfer <= 0)
+ if( (packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES && packageToTransfer > dlt_user_log_file_packagesCount(fileContext,filename)) || packageToTransfer <= 0)
{
DLT_LOG(*fileContext,DLT_LOG_ERROR,
DLT_STRING("Error at dlt_user_log_file_data: packageToTransfer out of scope"),
@@ -321,42 +305,50 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
DLT_STRING("for File:"),
DLT_STRING(filename)
);
- return ERROR_FILE_DATA;
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
}
readBytes = 0;
- if(packageToTransfer != LONG_MAX)
+ if(packageToTransfer != DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES)
{
+// If a single package should be transferred. The user has to check that the free space in the user buffer > 50%
+// if(checkUserBufferForFreeSpace()<0)
+// return DLT_FILETRANSFER_ERROR_FILE_DATA_USER_BUFFER_FAILED;
+
fseek ( file , (packageToTransfer-1)*BUFFER_SIZE , SEEK_SET );
readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
-
+
DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLDA"),
- DLT_UINT(getFileSerialNumber(filename)),
- DLT_UINT(packageToTransfer),
- DLT_RAW(buffer,readBytes),
- DLT_STRING("FLDA")
+ DLT_STRING("FLDA"),
+ DLT_UINT(getFileSerialNumber(filename)),
+ DLT_UINT(packageToTransfer),
+ DLT_RAW(buffer,readBytes),
+ DLT_STRING("FLDA")
);
-
- //doTimeout(timeout);
-
+
+ doTimeout(timeout);
+
} else {
pkgNumber = 0;
while( !feof( file ) )
{
- pkgNumber++;
- readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
+// If the complete file should be transferred, the user buffer will be checked.
+// If free space < 50% the package won't be transferred.
+ if(checkUserBufferForFreeSpace()>0)
+ {
+ pkgNumber++;
+ readBytes = fread(buffer, sizeof(char), BUFFER_SIZE, file);
- DLT_LOG(*fileContext,DLT_LOG_INFO,
- DLT_STRING("FLDA"),
- DLT_UINT(getFileSerialNumber(filename)),
- DLT_UINT(pkgNumber),
- DLT_RAW(buffer,readBytes),
- DLT_STRING("FLDA")
- );
-
- //doTimeout(timeout);
+ DLT_LOG(*fileContext,DLT_LOG_INFO,
+ DLT_STRING("FLDA"),
+ DLT_UINT(getFileSerialNumber(filename)),
+ DLT_UINT(pkgNumber),
+ DLT_RAW(buffer,readBytes),
+ DLT_STRING("FLDA")
+ );
+ }
+ doTimeout(timeout);
}
}
@@ -365,8 +357,8 @@ int dlt_user_log_file_data(DltContext *fileContext,const char *filename, int pac
return 0;
} else {
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_FILE_DATA);
- return ERROR_FILE_DATA;
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_DATA);
+ return DLT_FILETRANSFER_ERROR_FILE_DATA;
}
}
@@ -392,14 +384,14 @@ int dlt_user_log_file_end(DltContext *fileContext,const char *filename,int delet
if(deleteFlag){
if( doRemoveFile(filename) != 0 ){
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_FILE_END);
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
return -1;
}
}
return 0;
}else{
- dlt_user_log_file_errorMessage(fileContext,filename,ERROR_FILE_END);
- return ERROR_FILE_END;
+ dlt_user_log_file_errorMessage(fileContext,filename,DLT_FILETRANSFER_ERROR_FILE_END);
+ return DLT_FILETRANSFER_ERROR_FILE_END;
}
}
diff --git a/src/system/dlt-system-log.c b/src/system/dlt-system-log.c
index 6c9f2bc..c71f930 100644
--- a/src/system/dlt-system-log.c
+++ b/src/system/dlt-system-log.c
@@ -179,6 +179,7 @@ void dlt_system_filetransfer_run(DltSystemOptions *options,DltSystemRuntime *run
runtime->filetransferCountPackages = 0;
runtime->filetransferRunning = 0;
runtime->timeFiletransferDelay = options->FiletransferTimeDelay;
+
return;
}
runtime->filetransferLastSentPackage = 0;
@@ -189,8 +190,15 @@ void dlt_system_filetransfer_run(DltSystemOptions *options,DltSystemRuntime *run
if (runtime->filetransferRunning == 1) {
/* filetransfer is running, send next data */
while(runtime->filetransferLastSentPackage<runtime->filetransferCountPackages) {
+ /* wait sending next package if more than 50% of buffer used */
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ break;
+ }
+
runtime->filetransferLastSentPackage++;
- transferResult = dlt_user_log_file_data(context,runtime->filetransferFile,runtime->filetransferLastSentPackage,0);
+ transferResult = dlt_user_log_file_data(context,runtime->filetransferFile,runtime->filetransferLastSentPackage,options->FiletransferTimeoutBetweenLogs);
if(transferResult < 0)
{
/* a problem occured; stop filetransfer and continue with next file after timeout */
@@ -200,10 +208,7 @@ void dlt_system_filetransfer_run(DltSystemOptions *options,DltSystemRuntime *run
runtime->timeFiletransferDelay = options->FiletransferTimeDelay;
return;
}
- /* wait sending next package if more than 50% of buffer used */
- dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- break;
+
}
if(runtime->filetransferLastSentPackage==runtime->filetransferCountPackages) {
transferResult = dlt_user_log_file_end(context,runtime->filetransferFile,0);
diff --git a/src/system/dlt-system.c b/src/system/dlt-system.c
index 2902363..55d053c 100755
--- a/src/system/dlt-system.c
+++ b/src/system/dlt-system.c
@@ -128,7 +128,8 @@ void dlt_system_init_options(DltSystemOptions *options)
options->FiletransferDirectory2[0]=0;
options->FiletransferTimeStartup = DEFAULT_FILETRANSFER_TIME_STARTUP;
options->FiletransferTimeDelay = DEFAULT_FILETRANSFER_TIME_DELAY;
-
+ options->FiletransferTimeoutBetweenLogs = DEFAULT_FILETRANSFER_TIMEOUT_BETWEEN_LOGS;
+
/* Log file */
options->LogFileEnable = 0;
options->LogFileNumber = 0;
@@ -292,6 +293,11 @@ int dlt_system_parse_configuration(DltSystemOptions *options)
options->FiletransferTimeDelay = atoi(value);
printf("Option: %s=%s\n",token,value);
}
+ else if(strcmp(token,"FiletransferTimeoutBetweenLogs")==0)
+ {
+ options->FiletransferTimeoutBetweenLogs = atoi(value);
+ printf("Option: %s=%s\n",token,value);
+ }
/* Log File */
else if(strcmp(token,"LogFileEnable")==0)
{
diff --git a/src/system/dlt-system.conf b/src/system/dlt-system.conf
index 235f00e..426d3ef 100644
--- a/src/system/dlt-system.conf
+++ b/src/system/dlt-system.conf
@@ -26,7 +26,7 @@ SyslogPort = 47111
########################################################################
# Enable the Filetransfer (Default: 0)
-FiletransferEnable = 1
+FiletransferEnable = 0
# Directory which contains files to be transfered over DLT (Default: /tmp/filetransfer)
# Files are deleted after Filetransfer is finished and after TimeDelay expired
@@ -44,12 +44,16 @@ FiletransferTimeStartup = 10
# Time in seconds
FiletransferTimeDelay = 3
+# Time to wait between two file transfer logs of a single file to DLT. (Default: 10)
+# Time in ms seconds
+FiletransferTimeoutBetweenLogs = 10
+
########################################################################
# Log short files, expecially from proc filesystem
########################################################################
# Enable the logging of files (Default: 0)
-LogFileEnable = 1
+LogFileEnable = 0
# Log different files
# Mode: 0 = off, 1 = startup only, 2 = regular
@@ -108,7 +112,7 @@ LogFileContextId = STAT
########################################################################
# Enable the logging of processes (Default: 0)
-LogProcessesEnable = 1
+LogProcessesEnable = 0
# The Context Id of the kernel version (Default: PROC)
LogProcessesContextId = PROC
diff --git a/src/system/dlt-system.h b/src/system/dlt-system.h
index 8fca0ae..210de3c 100644
--- a/src/system/dlt-system.h
+++ b/src/system/dlt-system.h
@@ -83,26 +83,38 @@ typedef struct {
char ApplicationId[256];
int daemonise;
- int SyslogEnable;
- char SyslogContextId[256];
- int SyslogPort;
+ int SyslogEnable; /*# Enable the Syslog Adapter (Default: 0)*/
+ char SyslogContextId[256]; /*# The Context Id of the syslog adapter (Default: SYSL)*/
+ int SyslogPort; /*# The UDP port opened by DLT system mamager to receive system logs (Default: 47111)*/
- int FiletransferEnable;
- char FiletransferDirectory1[256];
+ int FiletransferEnable; /*# Enable the Filetransfer (Default: 0)*/
+ char FiletransferDirectory1[256]; /*# Directory which contains files to be transfered over DLT (Default: /tmp/filetransfer)# Files are deleted after Filetransfer is finished and after TimeDelay expired*/
char FiletransferDirectory2[256];
- char FiletransferContextId[256];
- int FiletransferTimeStartup;
- int FiletransferTimeDelay;
+ char FiletransferContextId[256]; /*# The Context Id of the filetransfer (Default: FILE)*/
+ int FiletransferTimeStartup; /*# Time after startup of dlt-system when first file is transfered (Default: 30)# Time in seconds*/
+ int FiletransferTimeDelay; /*# Time to wait when transfered file is deleted and next file transfer starts (Default: 10)# Time in seconds*/
+ int FiletransferTimeoutBetweenLogs;/*# Waits a period of time between two file transfer logs of a single file to DLT to ensure that the FIFO of DLT is not flooded.*/
- int LogFileEnable;
+ /*# Log different files
+ # Mode: 0 = off, 1 = startup only, 2 = regular
+ # TimeDelay: If mode regular is set, time delay is the number of seconds for next sent
+ */
+ int LogFileEnable; /*# Enable the logging of files (Default: 0)*/
int LogFileNumber;
char LogFileFilename[DLT_SYSTEM_LOG_FILE_MAX][256];
int LogFileMode[DLT_SYSTEM_LOG_FILE_MAX];
int LogFileTimeDelay[DLT_SYSTEM_LOG_FILE_MAX];
char LogFileContextId[DLT_SYSTEM_LOG_FILE_MAX][256];
- int LogProcessesEnable;
- char LogProcessesContextId[256];
+ int LogProcessesEnable; /*# Enable the logging of processes (Default: 0)*/
+ char LogProcessesContextId[256]; /*# The Context Id of the kernel version (Default: PROC)*/
+
+ /*# Log different processes
+ # Name: * = all process, X=alternative name (must correspind to /proc/X/cmdline
+ # Filename: the filename in the subdirectory /proc/processid/
+ # Mode: 0 = off, 1 = startup only, 2 = regular
+ # TimeDelay: If mode regular is set, time delay is the number of seconds for next sent
+ */
int LogProcessNumber;
char LogProcessName[DLT_SYSTEM_LOG_PROCESSES_MAX][256];
char LogProcessFilename[DLT_SYSTEM_LOG_PROCESSES_MAX][256];
diff --git a/src/system/dlt-system_cfg.h b/src/system/dlt-system_cfg.h
index c90d28f..82260a3 100644
--- a/src/system/dlt-system_cfg.h
+++ b/src/system/dlt-system_cfg.h
@@ -78,5 +78,5 @@
#define DEFAULT_FILETRANSFER_CONTEXT_ID "FILE"
#define DEFAULT_FILETRANSFER_TIME_STARTUP 30
#define DEFAULT_FILETRANSFER_TIME_DELAY 10
-
+#define DEFAULT_FILETRANSFER_TIMEOUT_BETWEEN_LOGS 10
#define DEFAULT_LOG_PROCESSES_CONTEXT_ID "PROC"
diff --git a/src/tests/dlt-test-filetransfer.c b/src/tests/dlt-test-filetransfer.c
index cf52920..1dfee48 100644
--- a/src/tests/dlt-test-filetransfer.c
+++ b/src/tests/dlt-test-filetransfer.c
@@ -68,6 +68,7 @@ int testFile1Run1(){
//!Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using single package transfer
int testFile1Run2(){
+ int total_size, used_size;
//Get the information how many packages have the file
countPackages = dlt_user_log_file_packagesCount(&fileContext,file1);
@@ -88,6 +89,14 @@ int testFile1Run2(){
//Loop to log all packages
for(i=1;i<=countPackages;i++)
{
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
//Logs one single package to the file context
transferResult = dlt_user_log_file_data(&fileContext,file1,i,20);
if(transferResult < 0)
@@ -141,6 +150,7 @@ int testFile2Run1(){
//!Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using single package transfer
int testFile2Run2(){
+ int total_size, used_size;
//Get the information how many packages have the file
countPackages = dlt_user_log_file_packagesCount(&fileContext,file2);
@@ -162,6 +172,14 @@ int testFile2Run2(){
//Loop to log all packages
for(i=1;i<=countPackages;i++)
{
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
//Logs one single package to the file context
transferResult = dlt_user_log_file_data(&fileContext,file2,i,20);
if(transferResult < 0)
@@ -303,22 +321,22 @@ int main(void)
//Register the application at the dlt-daemon
dltResult = DLT_REGISTER_APP("FLTR","Test Application filetransfer");
- if(dltResult < 0){
- printf("Error: DLT_REIGSTER_APP: FLTR\n");
- return -1;
- }
+// if(dltResult < 0){
+// printf("Error: DLT_REIGSTER_APP: FLTR\n");
+// return -1;
+// }
//Register the context of the main program at the dlt-daemon
dltResult = DLT_REGISTER_CONTEXT(mainContext,"MAIN","Main context for filetransfer test");
- if(dltResult < 0){
- printf("Error: DLT_REGISTER_CONTEXT: MAIN\n");
- return -1;
- }
+// if(dltResult < 0){
+// printf("Error: DLT_REGISTER_CONTEXT: MAIN\n");
+// return -1;
+// }
//Register the context in which the file transfer will be logged at the dlt-daemon
dltResult = DLT_REGISTER_CONTEXT(fileContext,"FLTR","Test Context for filetransfer");
- if(dltResult < 0){
- printf("Error: DLT_REGISTER_CONTEXT:FLTR\n");
- return -1;
- }
+// if(dltResult < 0){
+// printf("Error: DLT_REGISTER_CONTEXT:FLTR\n");
+// return -1;
+// }
//More details in corresponding methods
testFile1Run1();