Iotivity初探

IoT开发平台,包括embedded Linux, Android, Brillo, IoTivity, mBed, FreeRTOS

本文分析IoTivity,
  • Iotivity是什么 
    iotivity是intel和三星牵头的一个开源项目,目的是建立统一的物联 
    网设备连接标准

  • Iotivity框架 
     
    底层通信基于UDP,CoAP是IETF为constrained device制定的通信标准,包含了两层:message和req/rsp,message层定义了数据传输的格式,并且针对UDP传输的不可靠性,加入了安全传输的机制,req/rsp层为RESTful框架提供链路支撑

  • Iotivity源码 
    第一步就是编译源码,可以从iotivity的官网下载,也可以通过Git获得 
    iotivity stack需要在Ubuntu LTS 12.04环境下编译,我这里使用的是Ubuntu LTS 14.04

    目录结构 
    这里写图片描述

  • Iotivity编译 
    其中resource目录包含iotivity核心库的源代码,extlibs是需要的一些第三方库文件,编译时参考Readme.scons.txt文件,需要注意的是编译脚本会自动识别是否已经下载了第三方库文件,如boost Android sdk/ndk等,可以先下载到对应目录后再编译

    编译linux环境下的库

<code class="language-Shell hljs bash has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">scons RELEASE=<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">true</span> TARGET_OS=linux TARGET_TRANSPORT=IP </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
  • Iotivity测试 
    编译完成后在out/linux/x86_64/release目录生成sdk的库文件和头文件,在resource/examples/目录下生成可以用于测试的例程 
    iotivity stack discovery是基于multicast,地址:224.0.1.187 端口:5683,可以在不同的pc机上执行simpleserver和simpleclient测试
<code class="hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">./simpleserver</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

这里写图片描述

<code class="hljs  has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">./simpleclient</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值