ZigBee学习之40——Home Automation Profile3.doc

ZigBee学习之40——Home Automation Profile3.doc

  1. 1、本文档共5页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
ZigBee学习之40——Home Automation Profile3

ZigBee学习之40——Home?Automation?Profile3static void zclProcessMessageMSG( afIncomingMSGPacket_t *pkt ) { ………… //首先检查命令域的数据长度,如果没有数据则直接退出 if ( pkt-cmd.DataLength == 0 ) return; // Error, ignore the message ………… //然后检查消息的目的终端是否存在于节点上,若不是发送给此节点的则退出 epDesc = afFindEndPointDesc( pkt-endPoint ); if ( epDesc == NULL ) return; // Error, ignore the message //将簇ID转换到逻辑簇ID,如果为0xFFFF则退出 logicalClusterID = zclConvertClusterID( pkt-clusterId, epDesc-simpleDesc-AppProfId, TRUE ); if ( logicalClusterID == ZCL_INVALID_CLUSTER_ID ) return; // Error, ignore the message //检查设备是否可操作,即检查DEVICE_ENABLED属性 if ( zcl_DeviceOperational( pkt-endPoint, pkt-clusterId, inMsg.hdr.fc.type, inMmandID ) == FALSE ) { return; // Error, ignore the message } //一下是处理和解析收到的命令 if ( zcl_ProfileCmd( inMsg.hdr.fc.type ) ) {//收到的是针对剖面的命令比如读写属性,报告属性,身份认证等 if ( inMsg.hdr.fc.manuSpecific ) { // We dont support any manufacturer specific command // status = ZCL_STATUS_UNSUP_MANU_GENERAL_COMMAND; } else if ( ( inMmandID = ZCL_CMD_MAX ) ( zclCmdTable[inMmandID].pfnParseInProfile != NULL ) ) {//接收到的命令ID小于最大命令ID,并且命令表中此命令定义了解析函数,则解析并处理此命令 zclParseCmd_t parseCmd; parseCmd.endpoint = pkt-endPoint; parseCmd.dataLen = inMsg.pDataLen; parseCmd.pData = inMsg.pData; // Parse the command, remember that the return value is a pointer to allocated memory inMsg.attrCmd = zclParseCmd( inMmandID, parseCmd ); if ( (inMsg.attrCmd != NULL) (zclCmdTable[inMmandID].pfnProcessInProfile != NULL) ) { // Process the command if ( zclProcessCmd( inMmandID, inMsg ) == FALSE ) {//处理此命令不成功 // Couldnt find attribute in the table. } ……………… } else {//处理此簇ID的特殊命令 // Nope, must be specific to the cluster ID //ID查找合适的插头 // Find the appropriate plugin pInPlugin = zclFindPlugin( pkt-clusterId, epDesc-simpleDesc-AppProfId ); //在这个查找插头的函数中关联了一个静态变量plugins,这个变量中指明了插头的范围以及处理输入消息的函数,其数据结构定义为:【zcl.c】 typedef struct zclLibPlugin { struct zclLibPlugin *next; uint16 startLogCluster; // starting logical cluster ID uint16 endLogCluster; // ending logical cluster

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档