Z-stack3.0 Power Green的使用
1. 简介
作为一个Z3.0认证要求,所有的ZigBee路由设备(协调员、路由器)必须支持Green Power Basic proxy,一个可以从GPD向GP Sink设备传递命令的应用程序。
一个GPD是一个具有Power限制或依靠能量收集来运作的设备,它不能执行两种通信方式来建立与ZigBee网络的关联。这些GPD使用sInter-PAN frames本身到网络或命令传递。运作方式和GPD命令支持的类型将取决于其能力和资源。
基本代理要求实现GP stub和GP cluster。GP stub 处理Inter-PAN命令并将它们传递给GP设备应用程序。为了确定的运作方法,它也发送数据帧到GP的GPD。GP stub定义的方式可以在设置不同的应用程序开始。GP是在ZigBee预留端点242中实现的。
2. Green Power Basic Proxy
由于Green Power Basic Proxy 是一个将命令转发给Sink 设备的应用程序,所以它没有提供一个需要由实际的应用程序在Basic Proxy设备中运行的函数来实现的功能。此功能唯一的接口是以下内容:
gp_registergpchangechannelreqcb():注册一个回调在应用程序中,这个回调被用来操作切换频道的GPD的信道进行GPD的运作过程中最大时间间隔:gpbirectionalcommissioningchangechanneltimeout(5秒)。
如果应用程序操作不能被中断,注册的回调可以返回false,不允许通道的更改。BDB模块也在向应用程序检查操作。如果应用程序返回true或未注册回调,则 Green Power Basic Proxy应用程序将处理通道的更改。
PS:
ZigBee Green Power Device (ZGPD): This is a source node that sends GreenPower frames into the network via a proxy node.
ZigBee Green Power Proxy (ZGPP): This is a network node which is capableof receiving a Green Power frame from a ZGPD, embedding (tunnelling) theGP frame within a normal ZigBee frame and passing this frame into the ZigBeePRO network.
ZigBee Green Power Sink (ZGPS): This is a sink (target) node which is pairedwith a ZGPD, and is capable of receiving and interpreting tunnelled GP framesas well as direct GP frames from the ZGPD.
3.具体使用
1.主结构中加入gp_event_loop:
const pTaskEventHandlerFn tasksArr[] = {macEventLoop,nwk_event_loop,
#if (ZG_BUILD_RTR_TYPE)gp_event_loop,
#endifHal_ProcessEvent,
#if defined( MT_TASK )MT_ProcessEvent,
#endifAPS_event_loop,
#if defined ( ZIGBEE_FRAGMENTATION )APSF_ProcessEvent,
#endifZDApp_event_loop,
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )ZDNwkMgr_event_loop,
#endif
#ifdef BDB_UPDATE//Added to include TouchLink functionality#if defined ( INTER_PAN )StubAPS_ProcessEvent,#endif// Added to include TouchLink initiator functionality#if defined ( BDB_TL_INITIATOR )touchLinkInitiator_event_loop,#endif// Added to include TouchLink target functionality#if defined ( BDB_TL_TARGET )touchLinkTarget_event_loop,#endif
#endifzcl_event_loop,bdb_event_loop,zclGenericApp_event_loop
};
2.GP初始化 gp_Init
void osalInitTasks( void )
{uint8 taskID = 0;tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt));macTaskInit( taskID++ );nwk_init( taskID++ );
#if (ZG_BUILD_RTR_TYPE)gp_Init( taskID++ );
#endifHal_Init( taskID++ );
#if defined( MT_TASK )MT_TaskInit( taskID++ );
#endifAPS_Init( taskID++ );
#if defined ( ZIGBEE_FRAGMENTATION )APSF_Init( taskID++ );
#endifZDApp_Init( taskID++ );
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )ZDNwkMgr_Init( taskID++ );
#endif// Added to include TouchLink functionality
#if defined ( INTER_PAN )StubAPS_Init( taskID++ );
#endif
// Added to include TouchLink initiator functionality
#if defined( BDB_TL_INITIATOR )touchLinkInitiator_Init( taskID++ );
#endif
// Added to include TouchLink target functionality
#if defined ( BDB_TL_TARGET )touchLinkTarget_Init( taskID++ );
#endifzcl_Init( taskID++ );bdb_Init( taskID++ );zclGenericApp_Init( taskID );
}
3.具体函数回调注册:
extern void gp_RegisterGPChangeChannelReqCB(gpChangeChannelReq_t gpChangeChannelReq);
extern void gp_RegisterCommissioningModeCB(gpCommissioningMode_t gpCommissioningMode);
在zclSampleLight_Init中添加:
//GP_UPDATE
#if (ZG_BUILD_RTR_TYPE) gp_RegisterCommissioningModeCB(gp_CommissioningMode);gp_RegisterGPChangeChannelReqCB(gp_ChangeChannelReq);
#endif
查看具体一点的函数细节:
#if (ZG_BUILD_RTR_TYPE)
/********************************************************************** @fn gp_CommissioningMode** @brief Callback that notifies the application that gp Proxy is entering * into commissioning mode** @param isEntering - ** @return */
static void gp_CommissioningMode(bool isEntering)
{if(isEntering){//Led on indicating enter commissioning mode}else{//Led off indicating enter commissioning mode}
}//GP_UPDATE
/********************************************************************** @fn gp_ChangeChannelReq** @brief Callback function to notify the application about a GP commissioning * request that will change the current channel for at most * gpBirectionalCommissioningChangeChannelTimeout ms** @param channel - Channel in which the commissioning will take place** @return TRUE to allow change channel, FALSE to do not allow*/
static uint8 gp_ChangeChannelReq(void)
{bool allowChangeChannel = TRUE;//Check application state to decide if allow change channel or notreturn allowChangeChannel;
}#endif
大致就是这样。细心的人发现一件事,你会发现协议栈中包含了两个文件:cGP_stub.h 和dGP_stub.h。自己想一想怎么回事。
Z-stack3.0 Power Green的使用相关推荐
- cad坐标归零lisp_CAD坐标Z归0问题
Home > CAD代画技巧集锦 > CAD坐标Z归0问题 CAD坐标Z归0问题 2017年12月8日 1098人打酱油 其实这个问题一直困扰我,以前用有一个LISP程序,后来网上发现了另 ...
- 输出的字符串中有空格并且无法替换B e a r e r N D c y Z T g 4 N z A t N 2 N h Z C 0 0 Y 2 E 4 L T g x M W E t O D Y
###1.文件如下: Request url: appv2.qichacha.net/app/v1/extras/getVersion?platform=android&version=11. ...
- 设T是R3的线性变换,定义为T(x,y,z)=(0,x,y),求T2的像集及核
T 2 ( x , y , z ) = T [ T ( x , y , z ) ] = T ( 0 , x , y ) = ( 0 , 0 , x ) T^2(x,y,z)=T[T(x,y,z)]=T ...
- Android 8.0 学习 (26)---Android8.0 Power Menu 添加截屏选项
首先介绍下这个Power长按,显示Power Menu的流程,然后再介绍如何去添加一个新的选项,新的选项的功能是截屏. Power Menu长按的流程: 1.长按Power的处理在framework ...
- USB-PD3.0(Power Delivery)充电协议
USB-PD(Power Delivery)是基于USB Type-C的一种电源供电标准,最大供电功率可达100瓦(W):随着USB Type-C的普及,越来越多的设备(手机.平板.显示器.工作站 ...
- PD等多协议快充诱骗触发器SINK(“Power Z 弟弟 Power Low”)DIY
提到快充协议都会想到USB PD快充,实际市面上还有很多主流的快充协议,比如华为的FCP.SCP,三星的AFC,OPPO的VOOC,高通的QC,VIVO的Flash Charge等--,如此之多的快充 ...
- OpenGL ES 2 0 (iOS)[06 1]:基础纹理
前言:如果你没有 OpenGL ES 2 的基础知识,请先移步 <OpenGL ES 2.0 (iOS) 笔记大纲> 学习一下基础的知识. 目录 一.软件运行效果演示 (一).最终效果 ( ...
- C# 语言规范_版本5.0 (第10章 类)
1. 类 类是一种数据结构,它可以包含数据成员(常量和字段).函数成员(方法.属性.事件.索引器.运算符.实例构造函数.静态构造函数和析构函数)以及嵌套类型.类类型支持继承,继承是一种机制,它使派生类 ...
- vc++ 6.0下Glut的配置 及 Glut 框架介绍
2014-04-08 16:18:30 一.配置Glut 学习来源: http://blog.sina.com.cn/s/blog_5f0cf7bd0100c9oa.html 亲测可行. Glut的 ...
最新文章
- 教程分享-Vim编辑器用法
- AC日记——热浪 codevs 1557 (最短路模板题)
- define 防 php,php中define防止跳墙
- shell 获取文件最后一行
- 几种支持REST的Java框架
- get与post请求问题
- 深度学习篇| keras入门(一)
- python爬b站评论_Python爬虫入门教程 32-100 B站博人传评论数据抓取 scrapy
- PHP为什么empty可以访问不存在的索引
- android mapping.txt,Android根据mapping.txt还原混淆的代码
- jQuery各版本的区别
- 二维码的纠错码原理及细节
- cvs转datatable_C# CSV 文件转换成DataTable
- salt自定义returner+fluent+mysql进行数据采集
- 什么样的企业要使用360评估?
- 3Dmark2006真让人郁闷!
- A320M HDV 4.0主板用CH341A手动刷BIOS支持5600g
- 微信小程序制作-----日历记事本
- 【Unity小功能开发实战教程】制作跟随倒计时变化的进度条
- 淘丞相将微博链接转为淘宝直达是怎么实现的?