Zigbee about QCLI_demo(1)

本文详细解析了ZigBee Demo中的初始化过程,包括全局变量定义、Zigbee、ZDP和ZCL三个核心模块的初始化流程,以及QCLI命令组的注册。深入探讨了ZigBee_Demo_Context、ZDP_Demo_Context和ZCL_Demo_Context的结构与作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0.前言

    如前面的helloworld_demo中所说,平台架构分为两大部分:始化部分app_init和主体部分app_start。zigbee的准备工作是放在app_init中的,主体部分是放在app_start中的。本文说明的是app_init中对zigbee的初始化。

 

1.全局变量

(1)ZigBee_Demo_Context

/* Structure representing the main ZigBee demo context information. */
typedef struct ZigBee_Demo_Context_s
{
   QCLI_Group_Handle_t   QCLI_Handle;                     /*< QCLI handle for the main ZigBee demo. */
   qapi_ZB_Handle_t      ZigBee_Handle;                   /*< Handle provided by the ZigBee stack when initialized. */
   ZB_Device_ID_t        DevIDList[DEV_ID_LIST_SIZE + 1]; /*< List of devices */
   uint8_t               ZCL_Sequence_Num;                /*< Sequence number used for sending packets. */
   qapi_Persist_Handle_t PersistHandle;                   /*< Persist handle used by the ZigBee demo. */
} ZigBee_Demo_Context_t;

/* The ZigBee demo context. */
static ZigBee_Demo_Context_t ZigBee_Demo_Context;

(2)ZDP_Demo_Context

        主要用于保存ZDP demo的上下文。

/* Structure representing the main ZigBee demo context information. */
typedef struct ZigBee_ZDP_Demo_Context_s
{
   QCLI_Group_Handle_t QCLI_Handle;     /*< QCLI handle for the main ZigBee demo. */
} ZigBee_ZDP_Demo_Context_t;

/* The ZigBee ZDP demo context. */
static ZigBee_ZDP_Demo_Context_t ZDP_Demo_Context;

(3)ZCL_Demo_Context

/* Context information for the ZCL demo. */
typedef struct ZCL_Demo_Context_s
{
   QCLI_Group_Handle_t     QCLI_Handle;                     /* QCLI handle for the cluster demo. */
   uint16_t                Cluster_Count;                   /* The number of the clusters used in the demo. */
   ZCL_Demo_Cluster_Info_t Cluster_List[CLUSTER_LIST_SIZE]; /* The list of the clusters used in the demo. */
   uint16_t                DiscoverAttr_NextId;             /* Keeps track the next start attribute ID for the "DiscoverAttributes" command. */
   qbool_t                 ZCL_CB_Registered;               /* Flag indicating if the general cluster command callback has been registered. */
} ZCL_Demo_Context_t;

static ZCL_Demo_Context_t ZCL_Demo_Context;

 

2.源码

    从代码来看:主要涉及到Zigbee本身、ZDP、ZCL三个demo,主要做的是初始化相关的全局变量,各自的QCLI 命令组注册

    因为ZCL中涉及到cluster,所以遍历了所有支持的cluster,进行初始化。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值