在cooja上使用collectview(二)
2015-12-07 22:13
411 查看
上一篇文章中通过运行contiki2.7提供的关于collectview的例子,简单了解了collectview的效果。本文主要通过将collectview功能集成到其他网络项目中,达到数据统计的目的。
这里以contiki2.7自带的另一个例子/examples/ipv6/hello-world为例,介绍如何使用collectview。
首先,修改hello-world的Makefile文件,添加如下内容:
然后修改hello-world.c文件,在里面添加头文件:
添加代码:
Makefile文件和.c文件修改完之后,通过make生成相应的.ihex文件: make TARGET=sky hello-world.ihex。(其中hello-world应该与makefile文件中的名称相对应) 运行之后,会在该目录下生成hello-world.ihex文件。
将上一步生成的hello-world.ihex文件复制到contiki/tools/collect-view/dist目录下,并将原有的.ihex文件删除。
修改/tools/collect-view下的build.xml文件,将所有collect例子相关的名称、路径改为hello-world的,如将路径/examples/collect改为/examples/hello-world, collect.ihex改为hello-world.ihex,将collect.exists改为hello-world.exists。
修改完成之后,在/tools/collect-view目录下运行$ant命令,如下图所示:
成功运行之后,将dist目录复制到/examples/hello-world目录下。
在cooja中正常模拟运行hello-world sky节点(笔者添加了5个节点),并选择Tools->Collect View->Sky1,然后会新弹出sensor data collect界面,在界面中选择File->Clear Sensor Data,清除历史数据。然后点击Start Collect , Send command to nodes。等待一段时间会显现相应的数据统计结果。
这里以contiki2.7自带的另一个例子/examples/ipv6/hello-world为例,介绍如何使用collectview。
首先,修改hello-world的Makefile文件,添加如下内容:
APPS = serial-shell powertrace collect-view
然后修改hello-world.c文件,在里面添加头文件:
#include "contiki.h" #include "shell.h" #include "serial-shell.h" #include "collect-view.h" #include "net/rime.h"
添加代码:
PROCESS(collect_view_shell_process, "Contiki Collect View Shell"); AUTOSTART_PROCESSES(&hello_world_process,&collect_view_shell_process); PROCESS_THREAD(collect_view_shell_process, ev, data) { PROCESS_BEGIN(); serial_shell_init(); shell_blink_init(); #if WITH_COFFEE shell_file_init(); shell_coffee_init(); #endif /* WITH_COFFEE */ /* shell_download_init(); */ /* shell_rime_sendcmd_init(); */ /* shell_ps_init(); */ shell_reboot_init(); shell_rime_init(); shell_rime_netcmd_init(); /* shell_rime_ping_init(); */ /* shell_rime_debug_init(); */ /* shell_rime_debug_runicast_init(); */ shell_powertrace_init(); /* shell_base64_init(); */ shell_text_init(); shell_time_init(); /* shell_checkpoint_init(); */ /* shell_sendtest_init(); */ #if CONTIKI_TARGET_SKY shell_sky_init(); #endif /* CONTIKI_TARGET_SKY */ shell_collect_view_init(); PROCESS_END(); }
Makefile文件和.c文件修改完之后,通过make生成相应的.ihex文件: make TARGET=sky hello-world.ihex。(其中hello-world应该与makefile文件中的名称相对应) 运行之后,会在该目录下生成hello-world.ihex文件。
将上一步生成的hello-world.ihex文件复制到contiki/tools/collect-view/dist目录下,并将原有的.ihex文件删除。
修改/tools/collect-view下的build.xml文件,将所有collect例子相关的名称、路径改为hello-world的,如将路径/examples/collect改为/examples/hello-world, collect.ihex改为hello-world.ihex,将collect.exists改为hello-world.exists。
修改完成之后,在/tools/collect-view目录下运行$ant命令,如下图所示:
成功运行之后,将dist目录复制到/examples/hello-world目录下。
在cooja中正常模拟运行hello-world sky节点(笔者添加了5个节点),并选择Tools->Collect View->Sky1,然后会新弹出sensor data collect界面,在界面中选择File->Clear Sensor Data,清除历史数据。然后点击Start Collect , Send command to nodes。等待一段时间会显现相应的数据统计结果。
相关文章推荐
- find 命令的参数详解
- caja 原理 : 前端
- 第三个Sprint冲刺第三天
- zabbix监控报错zabbix server is not running: the information displayed may not be current的解决
- 美团推荐系统整体框架与关键工作
- 响应式图片 <img src=,srcset=,sizes=>
- iOS:App上架流程和支付宝支付流程
- 文件读写
- WordPress获取特色图像的链接地址
- 网页生成图片快照
- 抽象类和接口
- Palindrome Linked List
- Android Third Party Libraries and SDK's
- iOS 获取设备的UUID
- mv命令
- 【Objective-C学习记录】第六天
- Project Euler 99:Largest exponential 最大的幂
- 《Apache Spark源码剖析》学习笔记之Spark作业提交
- 1.读写分离(主数据库写 可分拆副数据库读);2.垂直分库(将系统按业务进行了垂直拆分主数据库);3.水平分主库(ID生成算法决定了如何拆分数据,以及增删改查)
- Leetcode日记(6)---ZigZag Conversion