/**************************************************************************************************
Filename: zcl.c
Revised: $Date: 2007-12-13 15:02:48 -0800 (Thu, 13 Dec 2007) $
Revision: $Revision: 16070 $
Description: This file contains the Zigbee Cluster Library Foundation functions.
Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
IMPORTANT: Your use of this Software is limited to those specific rights
granted under the terms of a software license agreement between the user
who downloaded the software, his/her employer (which must be your employer)
and Texas Instruments Incorporated (the "License"). You may not use this
Software unless you agree to abide by the terms of the License. The License
limits your use, and you acknowledge, that the Software may not be modified,
copied or distributed unless embedded on a Texas Instruments microcontroller
or used solely and exclusively in conjunction with a Texas Instruments radio
frequency transceiver, which is integrated into your product. Other than for
the foregoing purpose, you may not use, reproduce, copy, prepare derivative
works of, modify, distribute, perform, display or sell this Software and/or
its documentation for any purpose.
YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
PROVIDED �AS IS� WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
Should you have any questions regarding your right to use this Software,
contact Texas Instruments Incorporated at www.TI.com.
**************************************************************************************************/
/*********************************************************************
* INCLUDES
*/
#include "ZComDef.h"
#include "OSAL.h"
#include "AF.h"
#include "ZDConfig.h"
#include "zcl.h"
#include "zcl_ha.h"
#include "zcl_general.h"
/*********************************************************************
* MACROS
*/
/*** Frame Control ***/
#define zcl_FCType( a ) ( (a) & ZCL_FRAME_CONTROL_TYPE )
#define zcl_FCManuSpecific( a ) ( (a) & ZCL_FRAME_CONTROL_MANU_SPECIFIC )
#define zcl_FCDirection( a ) ( (a) & ZCL_FRAME_CONTROL_DIRECTION )
#define zcl_FCDisableDefaultRsp( a ) ( (a) & ZCL_FRAME_CONTROL_DISABLE_DEFAULT_RSP )
/*** Attribute Access Control ***/
#define zcl_AccessCtrlRead( a ) ( (a) & ACCESS_CONTROL_READ )
#define zcl_AccessCtrlWrite( a ) ( (a) & ACCESS_CONTROL_WRITE )
#define zcl_AccessCtrlCmd( a ) ( (a) & ACCESS_CONTROL_CMD )
#define zclParseCmd( a, b ) zclCmdTable[(a)].pfnParseInProfile( (b) )
#define zclProcessCmd( a, b ) zclCmdTable[(a)].pfnProcessInProfile( (b) )
/*** Table Indexing ***/
#define NEXT_READ_RSP( ptr, len ) (zclReadRspStatus_t *)( (uint8 *)(ptr) + \
sizeof (zclReadRspStatus_t) + (len) )
#define NEXT_WRITE( ptr, len ) (zclWriteRec_t *)( (uint8 *)(ptr) + \
sizeof (zclWriteRec_t) + (len) )
#define NEXT_REPORT( ptr, len ) (zclReport_t *)( (uint8 *)(ptr) + \
sizeof (zclReport_t) + (len) )
#define NEXT_CFG_REPORT( ptr, len ) (zclCfgReportRec_t *)( (uint8 *)(ptr) + \
sizeof (zclCfgReportRec_t) + (len) )
#define NEXT_REPORT_RSP( ptr, len ) (zclReportCfgRspRec_t *) ( (uint8 *)(ptr) + \
sizeof (zclReportCfgRspRec_t) + (len) )
// Commands that have corresponding responses
#define CMD_HAS_RSP( cmd ) ( (cmd) == ZCL_CMD_READ || \
(cmd) == ZCL_CMD_WRITE || \
(cmd) == ZCL_CMD_WRITE_UNDIVIDED || \
(cmd) == ZCL_CMD_CONFIG_REPORT || \
(cmd) == ZCL_CMD_READ_REPORT_CFG || \
(cmd) == ZCL_CMD_DISCOVER || \
(cmd) == ZCL_CMD_DEFAULT_RSP ) // exception
// There is no attribute in the Mandatory Reportable Attribute list for now
#define zcl_MandatoryReportableAttribute( a ) ( a == NULL )
/*********************************************************************
* CONSTANTS
*/
// Used by Configure Reporting Command
#define SEND_ATTR_REPORTS 0x00
#define EXPECT_ATTR_REPORTS 0x01
#define ZCL_MIN_REPORTING_INTERVAL 5
/*********************************************************************
* TYPEDEFS
*/
typedef struct zclLibPlugin
{
struct zclLibPlugin *next;
uint16 startLogCluster; // starting logical cluster ID
uint16 endLogCluster; // ending logical cluster ID
zclInHdlr_t pfnIncomingHdlr; // function to handle incoming message
} zclLibPlugin_t;
// Record to store a profile's cluster conversion table
typedef struct zclProfileClusterConvertRec
{
struct zclProfileClusterConvertRec *next;
uint16 profileID;
uint16 numClusters;
GENERIC zclConvertClusterRec_t *list;
} zclProfileClusterConvertRec_t;
// Attribute record list item
typedef struct zclAttrRecsList
{
struct zclAttrRecsList *next;
uint8 endpoint; // Used to link it into the endpoint descriptor
uint8 numAttributes; // Number of the following records
CONST zclAttrRec_t *attrs; // attribute records
} zclAttrRecsList;
typedef void *(*zclParseInProfileCmd_t)( zclParseCmd_t *pCmd );
typedef uint8 (*zclProcessInProfileCmd_t)( zclIncoming_t *pInMsg );
typedef struct
{
zclParseInProfileCmd_t pfnParseInProfile;
zclProcessInProfileCmd_t pfnProcessInProfile;
} zclCmdItems_t;
/*********************************************************************
* GLOBAL VARIABLES
*/
uint8 zcl_TaskID;
// The Application should register its attribute data validation function
zclValidateAttrData_t zcl_ValidateAttrDataCB = NULL;
/*********************************************************************
* EXTERNAL VARIABLES
*/
/*********************************************************************
* EXTERNAL FUNCTIONS
*/
/*********************************************************************
* LOCAL VARIABLES
*/
static zclLibPlugin_t *plugins;
static zclProfileClusterConvertRec_t *profileClusterList;
static zclAttrRecsList *attrList;
static byte zcl_TransID = 0; // This is the unique message ID (counter)
/*********************************************************************
* LOCAL FUNCTIONS
*/
static void zclProcessMessageMSG( afIncomingMSGPacket_t *pkt );
static uint8 *zclBuildHdr( zclFrameHdr_t *hdr, uint8 *pData );
static uint8 zclCalcHdrSize( zclFrameHdr_t *hdr );
static uint16 zclConvertClusterID( uint16 clusterID, uint16 profileID,
uint8 convertToLogical );
static zclLibPlugin_t *zclFindPlugin( uint16 realclusterID, uint16 profileID );
static uint8 zcl_DeviceOperational( uint8 srcEP, uint16 realClusterID, uint8 frameType, ui
没有合适的资源?快使用搜索试试~ 我知道了~
zigbee组网小实验3—添加传感数据采集功能
共923个文件
r51:236个
s51:218个
lst:212个
5星 · 超过95%的资源 需积分: 32 592 下载量 18 浏览量
2011-03-11
09:50:21
上传
评论 6
收藏 11.14MB RAR 举报
温馨提示
zigbee组网小实验3—添加传感数据采集功能 具体参见http://wjf88223.blog.163.com/blog/static/351680012010102983647815/ 这个是整个工程的压缩包,以前看到有80多M以为传不了,实验室网速实在不怎么好,压缩后才发现就11M,果断传吧~~~ 这只是个人做的实验,提供给需要的朋友参考参考~请勿转传!!谢谢~ 2011.3.11 小峰
资源推荐
资源详情
资源评论
收起资源包目录
zigbee组网小实验3—添加传感数据采集功能 (923个子文件)
f8w2430oad.a51 16KB
SampleApp.cspy.bat 2KB
zcl.c 112KB
zcl_general.c 97KB
ZDSecMgr.c 86KB
ZDObject.c 82KB
ZDApp.c 72KB
ZDProfile.c 57KB
dataflash.c 52KB
MTEL.c 51KB
SampleApp.c 51KB
zcl_ss.c 47KB
MT_ZDO.c 42KB
OSAL_Nv.c 40KB
MT_MAC.c 40KB
mac_rx.c 39KB
sapi.c 38KB
AF.c 36KB
hal_uart.c 36KB
hal_uart.c 32KB
hal_uart.c 31KB
mac_csp_tx.c 30KB
OSAL.c 29KB
hal_timer.c 29KB
hal_sleep.c 29KB
hal_timer.c 28KB
hal_timer.c 28KB
hal_key.c 27KB
hal_sleep.c 27KB
hal_sleep.c 27KB
hal_key.c 26KB
hal_key.c 26KB
menu_lcd.c 25KB
zcl_lighting.c 25KB
hal_lcd.c 23KB
hal_lcd.c 23KB
mac_mcu.c 23KB
mac_tx.c 21KB
MT_NWK.c 20KB
zmac.c 19KB
SPIMgr.c 19KB
mac_backoff_timer.c 19KB
OSAL_Timers.c 19KB
mac_radio.c 18KB
FlashUtils.c 18KB
SampleApp.c 17KB
ZGlobals.c 16KB
zmac_cb.c 16KB
i2cSupport.c 16KB
OSAL_Memory.c 15KB
hal_led.c 15KB
hal_led.c 15KB
hal_led.c 15KB
nwk_globals.c 15KB
Serialize.c 15KB
OnBoard.c 14KB
zcl_ms.c 13KB
hal_lcd.c 13KB
ZMain.c 13KB
hal_adc.c 12KB
hal_adc.c 12KB
hal_adc.c 12KB
MT_SAPI.c 11KB
zcl_hvac.c 11KB
MT_AF.c 10KB
Font.c 10KB
mac_rx_onoff.c 9KB
hal_assert.c 9KB
OSAL_Tasks.c 9KB
hal_drivers.c 9KB
zcl_closures.c 8KB
OSAL_PwrMgr.c 7KB
DebugTrace.c 7KB
mac_sleep.c 7KB
SampleAppHw.c 6KB
mac_mem.c 6KB
OSAL_SampleApp.c 5KB
ZDConfig.c 5KB
saddr.c 5KB
mac_radio_defs.c 5KB
mac_low_level.c 4KB
hal_dma.c 4KB
mac_cfg.c 4KB
hal_dma.c 4KB
hal_dma.c 4KB
wxl_uart.c 3KB
guangming.c 2KB
Temp.c 1KB
adc_voltage.c 1KB
sensormenu.c 1006B
wait.c 718B
Menu.c 716B
mac_random.c 23B
hal_target.c 13B
hal_target.c 13B
hal_target.c 13B
lcd128_64.c 0B
f8wConfig.cfg 5KB
f8wZCL.cfg 4KB
f8wCoord.cfg 1KB
共 923 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
小峰_想睡觉
- 粉丝: 14
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页