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的使用相关推荐

  1. cad坐标归零lisp_CAD坐标Z归0问题

    Home > CAD代画技巧集锦 > CAD坐标Z归0问题 CAD坐标Z归0问题 2017年12月8日 1098人打酱油 其实这个问题一直困扰我,以前用有一个LISP程序,后来网上发现了另 ...

  2. 输出的字符串中有空格并且无法替换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. ...

  3. 设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 ...

  4. Android 8.0 学习 (26)---Android8.0 Power Menu 添加截屏选项

    首先介绍下这个Power长按,显示Power Menu的流程,然后再介绍如何去添加一个新的选项,新的选项的功能是截屏. Power Menu长按的流程:  1.长按Power的处理在framework ...

  5. USB-PD3.0(Power Delivery)充电协议

      USB-PD(Power Delivery)是基于USB Type-C的一种电源供电标准,最大供电功率可达100瓦(W):随着USB Type-C的普及,越来越多的设备(手机.平板.显示器.工作站 ...

  6. PD等多协议快充诱骗触发器SINK(“Power Z 弟弟 Power Low”)DIY

    提到快充协议都会想到USB PD快充,实际市面上还有很多主流的快充协议,比如华为的FCP.SCP,三星的AFC,OPPO的VOOC,高通的QC,VIVO的Flash Charge等--,如此之多的快充 ...

  7. OpenGL ES 2 0 (iOS)[06 1]:基础纹理

    前言:如果你没有 OpenGL ES 2 的基础知识,请先移步 <OpenGL ES 2.0 (iOS) 笔记大纲> 学习一下基础的知识. 目录 一.软件运行效果演示 (一).最终效果 ( ...

  8. C# 语言规范_版本5.0 (第10章 类)

    1. 类 类是一种数据结构,它可以包含数据成员(常量和字段).函数成员(方法.属性.事件.索引器.运算符.实例构造函数.静态构造函数和析构函数)以及嵌套类型.类类型支持继承,继承是一种机制,它使派生类 ...

  9. vc++ 6.0下Glut的配置 及 Glut 框架介绍

    2014-04-08  16:18:30 一.配置Glut 学习来源: http://blog.sina.com.cn/s/blog_5f0cf7bd0100c9oa.html 亲测可行. Glut的 ...

最新文章

  1. 教程分享-Vim编辑器用法
  2. AC日记——热浪 codevs 1557 (最短路模板题)
  3. define 防 php,php中define防止跳墙
  4. shell 获取文件最后一行
  5. 几种支持REST的Java框架
  6. get与post请求问题
  7. 深度学习篇| keras入门(一)
  8. python爬b站评论_Python爬虫入门教程 32-100 B站博人传评论数据抓取 scrapy
  9. PHP为什么empty可以访问不存在的索引
  10. android mapping.txt,Android根据mapping.txt还原混淆的代码
  11. jQuery各版本的区别
  12. 二维码的纠错码原理及细节
  13. cvs转datatable_C# CSV 文件转换成DataTable
  14. salt自定义returner+fluent+mysql进行数据采集
  15. 什么样的企业要使用360评估?
  16. 3Dmark2006真让人郁闷!
  17. A320M HDV 4.0主板用CH341A手动刷BIOS支持5600g
  18. 微信小程序制作-----日历记事本
  19. 【Unity小功能开发实战教程】制作跟随倒计时变化的进度条
  20. 淘丞相将微博链接转为淘宝直达是怎么实现的?

热门文章

  1. 渐进符号表示时间复杂度上、下界
  2. CSS隐藏滚动条,保留滚动功能
  3. 什么情况下需要做大气校正之探讨
  4. java中3秒自动跳转_HTML页面3秒后自动跳转的三种常见方法
  5. 浏览器兼容模式中文乱码
  6. MySql进阶,索引,B-Tree以及索引优化
  7. backdoored
  8. 从虚拟电厂在上海的实践探索看企业微电网数字化的意义
  9. 文王金钱六十四卦以及Java算卦程序
  10. PMS APK解析数据同步和配置更新