/*********************************************************************
Filename: zcl.c
Revised: $Date: 2007-03-06 11:13:00 -0800 (Tue, 06 Mar 2007) $
Revision: $Revision: 13699 $
Description:
This file contains the Zigbee Cluster Library Foundation functions.
Notes:
Copyright (c) 2006 by Texas Instruments, Inc.
All Rights Reserved. Permission to use, reproduce, copy, prepare
derivative works, modify, distribute, perform, display or sell this
software and/or its documentation for any purpose is prohibited
without the express written consent of Texas Instruments, Inc.
*********************************************************************/
/*********************************************************************
* 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 )
/*** 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, c, d, e ) zclCmdTable[(a)].pfnParseInProfile( (b), (c), (d), (e) )
#define zclProcessCmd( a, b, c ) zclCmdTable[(a)].pfnProcessInProfile( (b), (c) )
/*** 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) )
// 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
zclAttrRec_t *attrs; // attribute records
} zclAttrRecsList;
typedef void *(*zclParseInProfileCmd_t)( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
typedef uint8 (*zclProcessInProfileCmd_t)( zclIncoming_t *msg, uint16 logicalClusterID );
typedef struct
{
zclParseInProfileCmd_t pfnParseInProfile;
zclProcessInProfileCmd_t pfnProcessInProfile;
} zclCmdItems_t;
/*********************************************************************
* GLOBAL VARIABLES
*/
uint8 zcl_TaskID;
// Used for testing only -- the application should set this callback
// function to receive all incoming cluster-specific message commands
zclTest_InMsgCmd_t zclTest_InMsgCmdCB = 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)
static zclAttrRecsList *attrList;
/*********************************************************************
* 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, uint8 cmd );
static uint8 zclGetAttrDataLength( uint8 dataType, uint8 *pData);
static uint8 zclGetDataTypeLength( uint8 dataType );
#if defined(ZCL_READ) || defined(ZCL_WRITE) || defined(ZCL_REPORT)
static void zclSerializeData( uint8 dataType, void *attrData, uint8 *buf );
#endif // ZCL_READ || ZCL_WRITE || ZCL_REPORT
#ifdef ZCL_READ
static void *zclParseInReadRspCmd( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
static uint8 zclProcessInReadCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInReadRspCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
#endif // ZCL_READ
#ifdef ZCL_WRITE
static uint8 zclWriteAttrData( zclAttrRec_t *pAttr, zclWriteRec_t *pWriteRec );
static void *zclParseInWriteRspCmd( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
static uint8 zclProcessInWriteCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInWriteUndividedCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInWriteRspCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
#endif // ZCL_WRITE
#ifdef ZCL_REPORT
static uint8 zclAnalogDataType( uint8 dataType );
static void *zclParseInConfigReportRspCmd( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
static void *zclParseInReadReportCfgRspCmd( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
static uint8 zclProcessInConfigReportCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInConfigReportRspCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInReadReportCfgCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInReadReportCfgRspCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
static uint8 zclProcessInReportCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
#endif // ZCL_REPORT
static void *zclParseInErrorCmd( uint8 endpoint, uint16 realClusterID, uint8 dataLen, uint8 *pData );
static uint8 zclProcessInErrorCmd( zclIncoming_t *pInMsg, uint16 logicalClusterID );
#ifdef ZCL_DISCOVER
static zclAttrRec_t
没有合适的资源?快使用搜索试试~ 我知道了~
zigbee CC2430 SerialApp DS18B20温度采集串口打印
共695个文件
s51:164个
lst:161个
r51:134个
需积分: 9 9 下载量 129 浏览量
2012-06-02
15:06:30
上传
评论
收藏 9.57MB ZIP 举报
温馨提示
本程序采用的芯片是CC2430芯片,STACK采用1.4.1-1.1.0版本,试验中主要是用TI的例子serialApp修改而来,部分程序经过合成加工,程序经过测试,实际通过,请将下载的文件与IAR安装软件放在一起,需要的可以下载,仅用于学习交流,禁止他用。谢谢合作。
资源推荐
资源详情
资源评论
收起资源包目录
zigbee CC2430 SerialApp DS18B20温度采集串口打印 (695个子文件)
zcl.c 113KB
ZDApp.c 112KB
ZDObject.c 93KB
zcl_general.c 89KB
ZDSecMgr.c 84KB
ZDProfile.c 58KB
dataflash.c 52KB
MTEL.c 49KB
AF.c 46KB
zcl_ss.c 44KB
MT_ZDO.c 41KB
OSAL_Nv.c 40KB
MT_MAC.c 38KB
mac_rx.c 37KB
mac_csp_tx.c 31KB
sapi.c 31KB
ZDCache.c 29KB
hal_uart.c 29KB
hal_uart.c 29KB
hal_uart.c 29KB
mac_mcu.c 28KB
hal_timer.c 26KB
hal_timer.c 26KB
hal_timer.c 26KB
hal_sleep.c 26KB
hal_sleep.c 26KB
hal_sleep.c 26KB
OSAL.c 25KB
hal_key.c 25KB
hal_key.c 25KB
hal_key.c 25KB
zcl_lighting.c 23KB
hal_lcd.c 22KB
hal_lcd.c 22KB
hal_lcd.c 21KB
hal_aes.c 21KB
hal_aes.c 21KB
hal_aes.c 21KB
mac_tx.c 20KB
MT_NWK.c 19KB
OSAL_Timers.c 18KB
zmac.c 18KB
mac_backoff_timer.c 17KB
mac_radio.c 17KB
hal_ccm.c 16KB
hal_ccm.c 16KB
hal_ccm.c 16KB
FlashUtils.c 16KB
Serialize.c 15KB
zmac_cb.c 14KB
OSAL_Memory.c 14KB
hal_led.c 14KB
hal_led.c 14KB
hal_led.c 14KB
i2cSupport.c 14KB
ZGlobals.c 13KB
SPIMgr.c 13KB
nwk_globals.c 12KB
zcl_ms.c 12KB
hal_adc.c 11KB
hal_adc.c 11KB
hal_adc.c 11KB
MT_AF.c 10KB
MT_SAPI.c 9KB
zcl_hvac.c 9KB
zcl_pi.c 8KB
mac_rx_onoff.c 8KB
hal_assert.c 7KB
zcl_closures.c 7KB
hal_drivers.c 6KB
OSAL_Tasks.c 6KB
DebugTrace.c 5KB
mac_sleep.c 5KB
OSAL_PwrMgr.c 5KB
mac_mem.c 4KB
ZDConfig.c 4KB
saddr.c 4KB
mac_radio_defs.c 3KB
mac_low_level.c 3KB
mac_cfg.c 2KB
hal_dma.c 2KB
hal_dma.c 2KB
hal_dma.c 2KB
DS18B20.c 2KB
mac_random.c 23B
hal_target.c 13B
hal_target.c 13B
hal_target.c 13B
f8wConfig.cfg 7KB
f8wZCL.cfg 4KB
f8wCoord.cfg 1KB
f8wRouter.cfg 959B
f8wEndev.cfg 888B
SerialApp.d51 1.35MB
SerialApp.d51 1.28MB
SerialApp.d51 1.07MB
SerialApp.dep 1.27MB
SerialApp.ewd 63KB
SerialApp.ewp 193KB
SerialApp.eww 992B
共 695 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
ricky200909
- 粉丝: 0
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功