automotive-dlt
dlt_daemon_serial.c
Go to the documentation of this file.
1 /*
2  * @licence app begin@
3  * SPDX license identifier: MPL-2.0
4  *
5  * Copyright (C) 2011-2015, BMW AG
6  *
7  * This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
8  *
9  * This Source Code Form is subject to the terms of the
10  * Mozilla Public License (MPL), v. 2.0.
11  * If a copy of the MPL was not distributed with this file,
12  * You can obtain one at http://mozilla.org/MPL/2.0/.
13  *
14  * For further information see http://www.genivi.org/.
15  * @licence end@
16  */
17 
27 /*******************************************************************************
28 ** **
29 ** SRC-MODULE: dlt_daemon_serial.c **
30 ** **
31 ** TARGET : linux **
32 ** **
33 ** PROJECT : DLT **
34 ** **
35 ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de **
36 ** **
37 ** PURPOSE : **
38 ** **
39 ** REMARKS : **
40 ** **
41 ** PLATFORM DEPENDANT [yes/no]: yes **
42 ** **
43 ** TO BE CHANGED BY USER [yes/no]: no **
44 ** **
45 *******************************************************************************/
46 
47 /*******************************************************************************
48 ** Author Identity **
49 ********************************************************************************
50 ** **
51 ** Initials Name Company **
52 ** -------- ------------------------- ---------------------------------- **
53 ** aw Alexander Wenzel BMW **
54 *******************************************************************************/
55 
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include <string.h>
59 #include <syslog.h>
60 #include <errno.h>
61 #include <unistd.h>
62 #include <fcntl.h>
63 
64 #include <sys/types.h> /* send() */
65 #include <sys/socket.h> /* send() */
66 
67 #include "dlt-daemon.h"
68 
69 #include "dlt_types.h"
70 
71 #include "dlt_daemon_serial.h"
72 
73 int dlt_daemon_serial_send(int sock,void* data1,int size1,void* data2,int size2,char serialheader)
74 {
75  /* Optional: Send serial header, if requested */
76  if (serialheader)
77  {
78  if ( 0 > write(sock, dltSerialHeader,sizeof(dltSerialHeader)) )
80 
81  }
82 
83  /* Send data */
84  if(data1 && size1>0)
85  {
86  if (0 > write(sock, data1,size1))
88  }
89 
90  if(data2 && size2>0)
91  {
92  if (0 > write(sock, data2,size2))
94  }
95 
96  return DLT_DAEMON_ERROR_OK;
97 }
#define DLT_DAEMON_ERROR_OK
Definition: dlt-daemon.h:170
#define DLT_DAEMON_ERROR_SEND_FAILED
Definition: dlt-daemon.h:173
const char dltSerialHeader[DLT_ID_SIZE]
Definition: dlt_common.c:70
int dlt_daemon_serial_send(int sock, void *data1, int size1, void *data2, int size2, char serialheader)