怎么安装aptdaemon模块_dlt-daemon安装教程

获取dlt-daemon源码

git clone https://github.com/GENIVI/dlt-daemon.git

cd dlt-daemon

mkdir build

cd build

cmake ..

make

sudo make install

sudo ldconfig

dlt-daemon 编译安装就完成了。

批注: linux下使用sudo apt install dlt-daemon是不是也可以??

dlt-viewer

现装依赖包 sudo apt-get install libqt5serialport5-dev libqt5serialport5

批注:也可以使用 sudo apt install dlt-viewer 完成安装。

git clone https://github.com/GENIVI/dlt-viewer.git

mkdir build

cd build

cmake ..

make

这时,build/bin目录下就生成了可执行文件dlt-viewer

生成测试程序

cd dlt-daemon/examples/example1/

mkdir build

cd build

cmake ..

make

dlt-example1的测试程序就生成好了。具体如何添加dlt_log就餐控example下的几个例子。

启动dlt-daemon

首先复制dlt.conf文件

cd dlt-daemon/src/daemon/

sudo cp dlt.conf /etc/

sudo gedit /etc/dlt.conf

修改dlt.conf:

LoggingMode = 2

OfflineTraceDirectory = /tmp

OfflineTraceFileSize = 1000000

OfflineTraceMaxSize = 4000000

OfflineTraceFileNameTimestampBased = 1

OfflineLogstorageDirPath = /opt

链接配置文件:

dlt-daemon -c /etc/dlt.conf

启动log接收端:

dlt-receive -o /tmp/log.dlt localhost

启动example1:

dlt-daemon/examples/example1/build$ sudo ./dlt-example1

这时,/tmp/log.dlt 文件就可以用dlt-viewer查看啦。

自定义样例

在home建立test文件夹,然后写入

example.c

#include

#include

DLT_DECLARE_CONTEXT(myContext1);

DLT_DECLARE_CONTEXT(myContext2);

DLT_DECLARE_CONTEXT(myContext3);

int main()

{

/* register application */

DLT_REGISTER_APP("MAPP","Test Application for Logging");

/* register all contexts */

DLT_REGISTER_CONTEXT(myContext1,"TES1","Test Context 1 for Logging");

DLT_REGISTER_CONTEXT(myContext2,"TES2","Test Context 2 for Logging");

DLT_REGISTER_CONTEXT(myContext3,"TES3","Test Context 3 for Logging");

/* Write your logs */

DLT_LOG(myContext1,DLT_LOG_ERROR,DLT_INT(5),DLT_STRING("This is a error"));

DLT_LOG(myContext2,DLT_LOG_INFO,DLT_INT(5),DLT_STRING("But this only information"));

DLT_LOG(myContext3,DLT_LOG_DEBUG,DLT_INT(5),DLT_STRING("But this only information"));

/* Sleep some time to avoid a flaw in dlt-daemon that would eat your messages

if you deregister while it still processes your registration */

sleep(3);

/* unregister your contexts */

DLT_UNREGISTER_CONTEXT(myContext1);

DLT_UNREGISTER_CONTEXT(myContext2);

DLT_UNREGISTER_CONTEXT(myContext3);

/* unregister your application */

DLT_UNREGISTER_APP();

return 0;

}

CMakeLists.txt

#######

# SPDX license identifier: MPL-2.0

#

# Copyright (C) 2011-2015, BMW AG

#

# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.

#

# This Source Code Form is subject to the terms of the

# Mozilla Public License (MPL), v. 2.0.

# If a copy of the MPL was not distributed with this file,

# You can obtain one at http://mozilla.org/MPL/2.0/.

#

# For further information see http://www.genivi.org/.

#######

#

# DLT example implementation

#

cmake_minimum_required( VERSION 2.6 )

project( automotive-dlt-example1 )

#

# find dependency packages

#

find_package(PkgConfig)

pkg_check_modules(DLT REQUIRED automotive-dlt)

#

# include directories

#

include_directories(

${DLT_INCLUDE_DIRS}

)

#

# build project,这里需要修改

#

set(dlt_example1_SRCS example.c)

add_executable(dlt-example1 ${dlt_example1_SRCS})

target_link_libraries(dlt-example1 ${DLT_LIBRARIES})

set_target_properties(dlt-example1 PROPERTIES LINKER_LANGUAGE C)

install(TARGETS dlt-example1

RUNTIME DESTINATION bin

COMPONENT base)

构建工程

cd test

mkdir build

cd build

cmake ..

make

dlt-receive -o /tmp/log.dlt localhost

sudo ./dlt-example1

此时就可以使用dltViewer查看 /tmp/log.dlt

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值