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(
70 : MultipleFilesRingBuffer* trace, const unsigned char* data1, const int size1, const unsigned char* data2,
71 : const int size2, const unsigned char* data3, const int size3)
72 : {
73 0 : if (trace->ohandle < 0)
74 : return DLT_RETURN_ERROR;
75 :
76 0 : multiple_files_buffer_rotate_file(trace, size1 + size2 + size3);
77 :
78 : /* write data into log file */
79 0 : if (multiple_files_buffer_write_chunk(trace, data1, size1) != DLT_RETURN_OK)
80 : return DLT_RETURN_ERROR;
81 0 : if (multiple_files_buffer_write_chunk(trace, data2, size2) != DLT_RETURN_OK)
82 : return DLT_RETURN_ERROR;
83 0 : if (multiple_files_buffer_write_chunk(trace, data3, size3) != DLT_RETURN_OK)
84 : return DLT_RETURN_ERROR;
85 :
86 : return DLT_RETURN_OK;
87 : }
|