/**************************************************************************************************
Filename: zcl.c
Revised: $Date: 2009-04-06 09:08:36 -0700 (Mon, 06 Apr 2009) $
Revision: $Revision: 19702 $
Description: This file contains the Zigbee Cluster Library Foundation functions.
Copyright 2006-2009 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 "OSAL_Tasks.h"
#include "AF.h"
#include "ZDConfig.h"
#include "zcl.h"
#include "zcl_general.h"
#if defined ( INTER_PAN )
#include "stub_aps.h"
#endif
/*********************************************************************
* 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) )
#define zcl_DefaultRspCmd( zclHdr ) ( zcl_ProfileCmd( (zclHdr).fc.type ) && \
(zclHdr).fc.manuSpecific == 0 && \
(zclHdr).commandID == ZCL_CMD_DEFAULT_RSP )
// 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
/*********************************************************************
* CONSTANTS
*/
/*********************************************************************
* TYPEDEFS
*/
typedef struct zclLibPlugin
{
struct zclLibPlugin *next;
uint16 startClusterID; // starting cluster ID
uint16 endClusterID; // ending cluster ID
zclInHdlr_t pfnIncomingHdlr; // function to handle incoming message
} zclLibPlugin_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;
// Cluster option list item
typedef struct zclClusterOptionList
{
struct zclClusterOptionList *next;
uint8 endpoint; // Used to link it into the endpoint descriptor
uint8 numOptions; // Number of the following records
zclOptionRec_t *options; // option records
} zclClusterOptionList;
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 task Id of the Application where the unprocessed Foundation
// Command/Response messages will be sent to.
uint8 zcl_RegisteredMsgTaskID = TASK_NO_TASK;
// The Application should register its attribute data validation function
zclValidateAttrData_t zcl_ValidateAttrDataCB = NULL;
// ZCL Sequence number
uint8 zcl_SeqNum = 0x00;
/*********************************************************************
* EXTERNAL VARIABLES
*/
/*********************************************************************
* EXTERNAL FUNCTIONS
*/
/*********************************************************************
* LOCAL VARIABLES
*/
static zclLibPlugin_t *plugins;
static zclAttrRecsList *attrList;
static zclClusterOptionList *clusterOptionList;
static uint8 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 zclLibPlugin_t *zclFindPlugin( uint16 clusterID, uint16 profileID );
static zclOptionRec_t *zclFindClusterOption( uint8 endpoint, uint16 clusterID );
static uint8 zclGetClusterOption( uint8 endpoint, uint16 clusterID );
static void zclSetSecurityOption( uint8 endpoint, uint16 clusterID, uint8 enable );
static uint8 zcl_DeviceOperational( uint8 srcEP, uint16 clusterID, uint8 frameType, uint8 cmd, uint16 profileID );
#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( zclParseCmd_t *pCmd );
static uint8 zclProcessInReadCmd( zclIncoming_t *pInMsg );
#endif // ZCL_READ
#ifdef ZCL_WRITE
static uint8 zclWriteAttrData( zclAttrRec_t *pAttr, zclWriteRec_t *pWriteRec );
static voi
没有合适的资源?快使用搜索试试~ 我知道了~
ZIGBEE协议传输数据 程序配件硬件电路板实现 CC2530单片机程序 CC2530 网络由4路终端和1路协调器Z-STACK
共942个文件
pbi:237个
cout:223个
h:116个
6 下载量 145 浏览量
2023-05-21
11:13:43
上传
评论
收藏 24.06MB RAR 举报
温馨提示
亲测好用。硬件电路板1个作为协调器,其余4个作为终端。终端携带温湿度传感器DHT11,烟雾传感器和继电器模块 电脑端显示图形显示温湿度、烟雾是否超出阈值数据,继电器模拟开关。当温湿度或者烟雾超出阈值时,PC端显示界面会提示预警信息。同时,也可以连接到手机端进行显示,在android端软件界面上进行显示。四路终端采集传感器信号后传递给协调器,协调器通过串口线连接计算机进行界面显示。
资源推荐
资源详情
资源评论
收起资源包目录
ZIGBEE协议传输数据 程序配件硬件电路板实现 CC2530单片机程序 CC2530 网络由4路终端和1路协调器Z-STACK (942个子文件)
SerialApp.CoordinatorEB-Pro.cspy.bat 2KB
SampleSwitch.CoordinatorEB.cspy.bat 2KB
SampleApp.ESP - Coordinator.cspy.bat 2KB
SerialApp.EndDeviceEB-Pro.cspy.bat 2KB
SerialApp.cspy.bat 1KB
SampleApp.pbd.browse 1.96MB
SerialApp.pbd.browse 1.46MB
SerialApp.pbd.browse 1.45MB
zcl.c 103KB
ZDSecMgr.c 98KB
zcl_general.c 97KB
ZDObject.c 87KB
zcl_key_establish.c 72KB
ZDApp.c 72KB
zcl_se.c 65KB
esp.c 63KB
ZDProfile.c 61KB
MT_MAC.c 56KB
zcl_ss.c 48KB
MT_ZDO.c 44KB
simplemeter.c 42KB
mac_rx.c 42KB
zcl_lighting.c 37KB
ZDNwkMgr.c 37KB
OSAL_Nv.c 35KB
sapi.c 34KB
loadcontrol.c 34KB
mac_csp_tx.c 33KB
pct.c 32KB
MT_NWK.c 31KB
ipd.c 30KB
esp_data.c 30KB
hal_timer.c 28KB
stub_aps.c 26KB
OSAL.c 26KB
mac_mcu.c 26KB
AF.c 25KB
SerialApp.c 23KB
_hal_uart_dma.c 23KB
zmac.c 22KB
simplemeter_data.c 22KB
mac_tx.c 21KB
hal_lcd.c 21KB
rangeext.c 20KB
MT_UTIL.c 20KB
MT_SAPI.c 19KB
hal_sleep.c 19KB
MT_SYS.c 19KB
mac_backoff_timer.c 19KB
ZGlobals.c 19KB
zcl_samplesw.c 19KB
mac_autopend.c 19KB
hal_key.c 19KB
mac_radio.c 19KB
zcl_samplelight.c 18KB
hal_oad.c 17KB
hal_led.c 16KB
nwk_globals.c 16KB
_hal_uart_isr.c 16KB
MT.c 16KB
OSAL_Memory.c 15KB
MT_APP.c 15KB
zmac_cb.c 15KB
MT_UART.c 14KB
OSAL_Timers.c 14KB
zcl_ms.c 13KB
OnBoard.c 12KB
hal_adc.c 12KB
ZMain.c 12KB
loadcontrol_data.c 11KB
zcl_hvac.c 11KB
pct_data.c 11KB
hal_flash.c 10KB
ipd_data.c 10KB
MT_AF.c 10KB
MT_TASK.c 10KB
rangeext_data.c 10KB
hal_assert.c 9KB
mac_rx_onoff.c 9KB
hal_uart.c 9KB
OSAL_Clock.c 9KB
zcl_closures.c 9KB
mac_radio_defs.c 9KB
hal_drivers.c 9KB
zcl_samplelight_data.c 9KB
zcl_samplesw_data.c 8KB
ZDConfig.c 8KB
MT_DEBUG.c 7KB
mac_sleep.c 7KB
OSAL_PwrMgr.c 6KB
DebugTrace.c 6KB
mac_mem.c 6KB
hal_dma.c 5KB
saddr.c 5KB
mac_low_level.c 5KB
OSAL_LoadControl.c 5KB
OSAL_SimpleMeter.c 5KB
OSAL_RangeExt.c 5KB
OSAL_pct.c 5KB
OSAL_ESP.c 5KB
共 942 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
资源评论
xuanshang_yutou
- 粉丝: 67
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功