Added new examples which can be manually build against DLt library.
[profile/ivi/dlt-daemon.git] / examples / example2 / example2.c
1 /**
2  * @licence app begin@
3  * Copyright (C) 2014  BMW AG
4  *
5  * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
6  *
7  * Contributions are licensed to the GENIVI Alliance under one or more
8  * Contribution License Agreements.
9  *
10  * \copyright
11  * This Source Code Form is subject to the terms of the
12  * Mozilla Public License, v. 2.0. If a  copy of the MPL was not distributed with
13  * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
14  *
15  *
16  * \author Alexander Wenzel <alexander.aw.wenzel@bmw.de> BMW 2011-2012
17  *
18  * \file dlt-example-user.c
19  * For further information see http://www.genivi.org/.
20  * @licence end@
21  */
22
23
24 /*******************************************************************************
25 **                                                                            **
26 **  SRC-MODULE: example2.c                                                    **
27 **                                                                            **
28 **  TARGET    : linux                                                         **
29 **                                                                            **
30 **  PROJECT   : DLT                                                           **
31 **                                                                            **
32 **  AUTHOR    : Alexander Wenzel Alexander.AW.Wenzel@bmw.de                   **
33 **                                                                            **
34 **  PURPOSE   :                                                               **
35 **                                                                            **
36 **  REMARKS   :                                                               **
37 **                                                                            **
38 **  PLATFORM DEPENDANT [yes/no]: yes                                          **
39 **                                                                            **
40 **  TO BE CHANGED BY USER [yes/no]: no                                        **
41 **                                                                            **
42 *******************************************************************************/
43
44 #include <stdio.h>      /* for printf() and fprintf() */
45 #include <stdlib.h>     /* for atoi() and exit() */
46
47 #include <dlt.h>
48
49 #include "dlt_id.h"
50
51 DLT_DECLARE_CONTEXT(con_exa2);
52
53 int main()
54 {
55         int num;
56
57         DLT_REGISTER_APP("EXA2","Third Example");
58         DLT_REGISTER_CONTEXT(con_exa2,"CON","First context");
59
60         DLT_NONVERBOSE_MODE();
61
62         for(num=0;num<10;num++)
63         {
64                 DLT_LOG_ID(con_exa2,DLT_LOG_INFO,DLT_EXA2_CON_EXA2_ID1,DLT_INT32(12345678),DLT_STRING("Hello world 1!"));
65                 DLT_LOG_ID(con_exa2,DLT_LOG_ERROR,DLT_EXA2_CON_EXA2_ID2,DLT_INT32(87654321),DLT_STRING("Hello world 2!"));
66                 DLT_LOG_ID(con_exa2,DLT_LOG_WARN,DLT_EXA2_CON_EXA2_ID3,DLT_INT32(11223344),DLT_STRING("Hello world 3!"));
67         usleep(1000);
68         }
69
70         DLT_UNREGISTER_CONTEXT(con_exa2);
71
72         DLT_UNREGISTER_APP();
73 }