63 #define BUFFER_SIZE 1024 66 #define MIN_TIMEOUT 20 69 #define DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES INT_MAX 84 if ( -1 == stat(file, &st))
91 return (uint32_t)st.st_size;
103 unsigned int len = strlen(str);
110 for(i = 0; i < len; i++)
112 *hash = 53 * *hash + str[i];
127 if ( -1 == stat(file, &st))
136 ret = ret << (
sizeof(ret)*8)/2;
151 if (-1 == stat(file, &st))
167 if (-1 == stat(file, &st))
173 struct tm *ts= localtime(&st.st_ctime);
184 return (stat (file, &st) == 0);
193 usleep(timeout * 1000);
202 int total_size, used_size;
206 if((total_size - used_size) < (total_size/2))
219 return remove( filename);
504 file = fopen (filename,
"rb");
514 DLT_STRING(
"Error at dlt_user_log_file_data: packageToTransfer out of scope"),
534 if ( 0 != fseek ( file , (packageToTransfer-1)*
BUFFER_SIZE , SEEK_SET ) )
555 DLT_STRING(
"failed to get FileSerialNumber for: "),
571 while( !feof( file ) )
586 DLT_STRING(
"failed to get FileSerialNumber for: "),
632 DLT_STRING(
"failed to get FileSerialNumber for: "),
int checkUserBufferForFreeSpace()
Checks free space of the user buffer.
#define DLT_RAW(BUF, LEN)
int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout)
Transfer the complete file as several dlt logs.
#define DLT_FILETRANSFER_ERROR_FILE_DATA
int doRemoveFile(const char *filename)
Deletes the given file.
int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filename)
This method gives information about the number of packages the file have.
uint32_t getFileSerialNumber(const char *file, int *ok)
Get some information about the file serial number of a file.
int dlt_user_log_file_header_alias(DltContext *fileContext, const char *filename, const char *alias)
Transfer the head of the file as a dlt logs.
void stringHash(const char *str, uint32_t *hash)
char * getFileCreationDate2(const char *file, int *ok)
Returns the creation date of a file.
int isFile(const char *file)
Checks if the file exists.
DltReturnValue dlt_user_check_buffer(int *total_size, int *used_size)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
time_t getFileCreationDate(const char *file, int *ok)
Returns the creation date of a file.
#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE
void doTimeout(int timeout)
Waits a period of time.
int dlt_user_log_file_header(DltContext *fileContext, const char *filename)
Transfer the head of the file as a dlt logs.
#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE2
#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE3
#define DLT_FILETRANSFER_ERROR_PACKAGE_COUNT
int dlt_user_log_file_end(DltContext *fileContext, const char *filename, int deleteFlag)
Transfer the end of the file as a dlt logs.
uint32_t getFilesize(const char *file, int *ok)
Get some information about the file size of a file.
int dlt_user_log_file_data(DltContext *fileContext, const char *filename, int packageToTransfer, int timeout)
Transfer the content data of a file.
int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename)
Logs specific file inforamtions to dlt.
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
#define DLT_UINT(UINT_VAR)
#define BUFFER_SIZE
Defines the buffer size of a single file package which will be logged to dlt.
void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filename, int errorCode)
static char str[DLT_DAEMON_TEXTBUFSIZE]
#define DLT_FILETRANSFER_ERROR_INFO_ABOUT
#define DLT_FILETRANSFER_ERROR_FILE_END
#define DLT_FILETRANSFER_ERROR_FILE_HEAD
#define DLT_FILETRANSFER_TRANSFER_ALL_PACKAGES
#define DLT_FILETRANSFER_ERROR_FILE_COMPLETE1