EC20功耗测试示例

2017-07-24  本文已影响292人  LittleFat

本示例支持LINUX和OPEN-LINUX开发环境,将对讲中使用的数据通信做了抽象,意在能够尽可能的简化测试EC20模块上的功耗,以及网络延迟问题

1 功能说明

1.1 心跳维持

1.2 业务流程

    //start send udp data timer
    ev_timer_set(&(poc_ctx->timer_udp_data),TEST_UDP_DATA_TIMER,0);
    ev_timer_start(poc_ctx->loop,&(poc_ctx->timer_udp_data));

2 测试及统计

2.1 编译

终端使用cmake来管理的源码,需要安装cmake。
安装完后,配置系统根目录的路径, 修改./depends/arm-oe-linux-gnueabi.toolchain.sh:

set(OPENLINUX_TOOLCHAIN_DIR /opt/ql-oe/sysroots/x86_64-linux/usr/bin/arm-oe-linux-gnueabi)
set(OPENLINUX_ROOT_DIR /opt/ql-oe/sysroots/mdm9607)

对于EC20编译执行make-arm-oe.sh
对于LINUX编译执行make-linux.sh
无错误的话会生成poc_client应用(linux在build目录,openlinux在bb目录)

2.2 程序部署

注:程序中用到了对时功能,需要root权限修改本地时间才会生效(PC-LINUX情况)

//SERVER ADDRESS
#ifndef HAL_OPENLINUX
#define TEST_SERVER_IP "192.168.40.103"
#define TEST_SERVER_UDP_PORT 10071
#define TEST_SERVER_TCP_PORT 10073
#else
#define TEST_SERVER_IP "119.254.102.206"
#define TEST_SERVER_UDP_PORT 10075
#define TEST_SERVER_TCP_PORT 10078
#endif

2.3 数据统计:

条件:

数据:

2.4 日志输出解释

poc_def.h定义了协议的标识,如下:

//PROTO
#define POC_REQUEST_MIC     "#RequestMic"   //#RequestMic:N:DUMP
#define POC_REQUEST_MIC_ACK "#RequestMicAck"

#define POC_DROP_MIC        "#DropMic"      //#DropMic:N:DUMP
#define POC_DROP_MIC_ACK    "#DropMicAck"

#define POC_MEMBER_GET_MIC  "#MemberGetMic" //#MemberGetMic:N:DUMP
#define POC_MEMBER_DROP_MIC "#MemberDropMic"

#define POC_LOST_MIC        "#LostMic"

#define POC_PING            "#Ping"         //#Ping:UDP:N:DUMP  #Ping:TCP:N:DUMP
#define POC_PONG            "#Pong"         //#Pong:UDP:N:DUMP  #Pong:TCP:N:DUMP

#define POC_DATA            "#Data"         //#Data:N:DUMP
#define POC_END             "#End"          //#End

#define POC_NTP             "#NTP"          //#NTP:t_request:t_request_recv:t_respone:t_response_recv

输出的日志:

/data # ./poc_client
[DEBUG] 2017-07-24 06:26:45.735 poc_ctx init event bindings sizeof(int):4
[DEBUG] 2017-07-24 06:26:45.742 poc_ctx initial mobile ap ...
[DEBUG] 2017-07-24 06:26:48.796 poc_ctx < retrived ip address:10.131.20.122 >
[DEBUG] 2017-07-24 06:26:49.027 poc_ctx connect to server success
[DEBUG] 2017-07-24 06:26:49.405 poc_ctx on_ntp msg:#NTP:1934022994:1500877591508:1500877591508:1934023101
[DEBUG] 2017-07-24 14:26:32.065 poc_ctx on_udp_readable buf:#Pong:UDP:0002:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:26:43.181 poc_ctx on_udp_readable buf:#Pong:UDP:0003:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:26:53.736 poc_ctx on_udp_readable buf:#Pong:UDP:0004:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:27:03.621 poc_ctx on_udp_readable buf:#Pong:UDP:0005:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:27:13.318 poc_ctx on_udp_readable buf:#Pong:UDP:0006:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:27:23.281 poc_ctx on_data msg:#Data:0001:2017-07-24 14:27:20.332 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.283 poc_ctx on_tcp_readable msg:#MemberGetMic:0000:2017-07-24 14:27:20.107 len:43
[DEBUG] 2017-07-24 14:27:23.284 poc_ctx on_member_get_mic msg:#MemberGetMic:0000:2017-07-24 14:27:20.107
[DEBUG] 2017-07-24 14:27:23.284 poc_ctx on_data msg:#Data:0002:2017-07-24 14:27:20.533 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.284 poc_ctx on_data msg:#Data:0003:2017-07-24 14:27:20.733 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.285 poc_ctx on_data msg:#Data:0004:2017-07-24 14:27:20.934 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.285 poc_ctx on_data msg:#Data:0005:2017-07-24 14:27:21.134 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.285 poc_ctx on_data msg:#Data:0006:2017-07-24 14:27:21.334 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.285 poc_ctx on_data msg:#Data:0007:2017-07-24 14:27:21.535 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.286 poc_ctx on_data msg:#Data:0008:2017-07-24 14:27:21.735 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.287 poc_ctx on_data msg:#Data:0009:2017-07-24 14:27:21.936 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.288 poc_ctx on_data msg:#Data:0010:2017-07-24 14:27:22.136 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.292 poc_ctx on_data msg:#Data:0011:2017-07-24 14:27:22.336 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.292 poc_ctx on_data msg:#Data:0012:2017-07-24 14:27:22.537 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.292 poc_ctx on_data msg:#Data:0013:2017-07-24 14:27:22.737 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.293 poc_ctx on_data msg:#Data:0014:2017-07-24 14:27:22.938 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.382 poc_ctx on_udp_readable buf:#Pong:UDP:0007:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:27:23.428 poc_ctx on_udp_readable buf:#Pong:UDP:0008:The quick brown fox jumps over the lazy dog. len:60
[DEBUG] 2017-07-24 14:27:23.449 poc_ctx on_data msg:#Data:0015:2017-07-24 14:27:23.138 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.651 poc_ctx on_data msg:#Data:0016:2017-07-24 14:27:23.339 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:23.951 poc_ctx on_data msg:#Data:0017:2017-07-24 14:27:23.540 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:24.051 poc_ctx on_data msg:#Data:0018:2017-07-24 14:27:23.740 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:24.252 poc_ctx on_data msg:#Data:0019:2017-07-24 14:27:23.940 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:24.491 poc_ctx on_data msg:#Data:0020:2017-07-24 14:27:24.141 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:24.652 poc_ctx on_data msg:#Data:0021:2017-07-24 14:27:24.341 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:24.946 poc_ctx on_data msg:#Data:0022:2017-07-24 14:27:24.542 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:25.053 poc_ctx on_data msg:#Data:0023:2017-07-24 14:27:24.742 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:25.253 poc_ctx on_data msg:#Data:0024:2017-07-24 14:27:24.943 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:25.455 poc_ctx on_data msg:#Data:0025:2017-07-24 14:27:25.143 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:25.651 poc_ctx on_data msg:#Data:0026:2017-07-24 14:27:25.344 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:25.855 poc_ctx on_data msg:#Data:0027:2017-07-24 14:27:25.544 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:26.086 poc_ctx on_data msg:#Data:0028:2017-07-24 14:27:25.744 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:26.257 poc_ctx on_data msg:#Data:0029:2017-07-24 14:27:25.945 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:26.455 poc_ctx on_data msg:#Data:0030:2017-07-24 14:27:26.145 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:26.655 poc_ctx on_data msg:#Data:0031:2017-07-24 14:27:26.345 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:26.857 poc_ctx on_data msg:#Data:0032:2017-07-24 14:27:26.546 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:27.058 poc_ctx on_data msg:#Data:0033:2017-07-24 14:27:26.746 The quick brown fox jumps over the lazy dog.
[DEBUG] 2017-07-24 14:27:27.112 poc_ctx on_tcp_readable msg:#MemberDropMic:0001:2017-07-24 14:27:26.803 len:44
[DEBUG] 2017-07-24 14:27:27.112 poc_ctx on_member_drop_mic msg:#MemberDropMic:0001:2017-07-24 14:27:26.803

上面日志有:
#NTP: UDP,服务端相应的#NTP
#Pong: UDP,服务端相应终端的#Ping
#MemberGetMic: TCP,服务器响应另外一个终端的#RequestMic, 推送的通知; 包含了发送端的时间戳
#MemberDropMic: TCP,服务器响应另外一个终端的#DropMic, 推送的通知; 包含了发送端的时间戳
#Data: UDP, 服务器收到另外一个终端的#Data数据,转发过来的; 包含了发送端的时间戳

上一篇 下一篇

猜你喜欢

热点阅读