Line data Source code
1 : /*
2 : * SPDX license identifier: MPL-2.0
3 : *
4 : * Copyright (C) 2011-2015, BMW AG
5 : *
6 : * This file is part of COVESA Project DLT - Diagnostic Log and Trace.
7 : *
8 : * This Source Code Form is subject to the terms of the
9 : * Mozilla Public License (MPL), v. 2.0.
10 : * If a copy of the MPL was not distributed with this file,
11 : * You can obtain one at http://mozilla.org/MPL/2.0/.
12 : *
13 : * For further information see http://www.covesa.org/.
14 : */
15 :
16 : /*!
17 : * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de>
18 : *
19 : * \copyright Copyright © 2011-2015 BMW AG. \n
20 : * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
21 : *
22 : * \file dlt_offline_trace.c
23 : */
24 :
25 : /*******************************************************************************
26 : ** **
27 : ** SRC-MODULE: dlt_offline_trace.c **
28 : ** **
29 : ** TARGET : linux **
30 : ** **
31 : ** PROJECT : DLT **
32 : ** **
33 : ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
34 : ** **
35 : ** PURPOSE : **
36 : ** **
37 : ** REMARKS : **
38 : ** **
39 : ** PLATFORM DEPENDANT [yes/no]: yes **
40 : ** **
41 : ** TO BE CHANGED BY USER [yes/no]: no **
42 : ** **
43 : *******************************************************************************/
44 :
45 : /*******************************************************************************
46 : ** Author Identity **
47 : ********************************************************************************
48 : ** **
49 : ** Initials Name Company **
50 : ** -------- ------------------------- ---------------------------------- **
51 : ** aw Alexander Wenzel BMW **
52 : *******************************************************************************/
53 :
54 : #include <stdio.h>
55 : #include <stdlib.h>
56 : #include <string.h>
57 : #include <time.h>
58 : #include <sys/types.h>
59 : #include <sys/stat.h>
60 : #include <fcntl.h>
61 : #include <unistd.h>
62 : #include <dirent.h>
63 : #include <syslog.h>
64 : #include <errno.h>
65 :
66 : #include <dlt_offline_trace.h>
67 : #include <dlt_multiple_files.h>
68 :
69 0 : DltReturnValue dlt_offline_trace_write(MultipleFilesRingBuffer *trace,
70 : const unsigned char *data1,
71 : const int size1,
72 : const unsigned char *data2,
73 : const int size2,
74 : const unsigned char *data3,
75 : const int size3)
76 : {
77 :
78 0 : if (trace->ohandle < 0) return DLT_RETURN_ERROR;
79 :
80 0 : multiple_files_buffer_rotate_file(trace, size1 + size2 + size3);
81 :
82 : /* write data into log file */
83 0 : if (multiple_files_buffer_write_chunk(trace, data1, size1) != DLT_RETURN_OK) return DLT_RETURN_ERROR;
84 0 : if (multiple_files_buffer_write_chunk(trace, data2, size2) != DLT_RETURN_OK) return DLT_RETURN_ERROR;
85 0 : if (multiple_files_buffer_write_chunk(trace, data3, size3) != DLT_RETURN_OK) return DLT_RETURN_ERROR;
86 :
87 : return DLT_RETURN_OK;
88 : }
|