zigbee 绑定表

如何绑定可以参照: http://blog.csdn.net/tanqiuwei/article/details/7642766

首先绑定表: BindingEntry_t 


typedef struct 

uint16 srcIdx; // Address Manager index 
uint8 srcEP; 
uint8 dstGroupMode; // Destination address type; 0 - Normal address index, 1 - 
// Group address 
uint16 dstIdx; // This field is used in both modes (group and non-group) to 
// save NV and RAM space 
// dstGroupMode = 0 - Address Manager index 
// dstGroupMode = 1 - Group Address 
uint8 dstEP; 
uint8 numClusterIds; 
uint16 clusterIdList【MAX_BINDING_CLUSTER_IDS】; 
// Don‘t use MAX_BINDING_CLUSTERS_ID when 
// using the clusterIdList field. Use 
// gMAX_BINDING_CLUSTER_IDS 
} BindingEntry_t; 

 1.加入

static uint16 BindClusterIds[] = { ZCL_CLUSTER_ID_GEN_ON_OFF };
  zAddrType_t ZC_DstAddr;
  ZC_DstAddr.addrMode = Addr16Bit;
  ZC_DstAddr.addr.shortAddr = 0x0000;
  
  bindAddEntry( SAMPLEswitch_ENDPOINT,&ZC_DstAddr,
                          SAMPLELIGHT_ENDPOINT,1, BindClusterIds );  

   2.移除

void bindRemoveDev( zAddrType_t *Addr );
 //移除之后需要:
ZDApp_NVUpdate();
3.更新地址
void bindUpdateAddr( uint16 oldAddr, uint16 newAddr ); 
//交换邦定表中的短地址,所有oldAddr将被newAddr取代。 
BindingEntry_t *bindFindExisting( zAddrType_t *srcAddr, byte srcEpInt, 
zAddrType_t *dstAddr, byte dstEpInt ); 
4.查询
byte bindNumBoundTo( zAddrType_t *devAddr, byte devEpInt, byte srcMode ); 
计算符合条件的邦定表入口数目。返回找到的邦定表入口数目。 
devAddr -要查找的邦定表地址 
devEpInt -终端 
srcMode 
TRUE 查找源地址,FALSE 查找目的地址 
uint16 bindNumOfEntries( void ); 
返回邦定表中的条目数,以cluster计数。 
void bindCapacity( uint16 *maxEntries, uint16 *usedEntries ); 
返回邦定表的可能最大数目,和在用的最大数目,以入口记录计数。 
maxEntries -指向最大入口数目的变量,绑定表的最大入口可以通过 NWK_MAX_BINDING_ENTRIES【f8wConfig.cfg】更改 


z-stack3.0:
/*********************************************************************
 * @fn      bdb_zclFindingBindingEpType
 *
 * @brief   Gives the Ep Type according to application clusters in
 *          simple descriptor
 *
 * @return  epType - If Target, Initiator or both
 */
uint8 bdb_zclFindingBindingEpType( endPointDesc_t *epDesc )
/*********************************************************************
 * @fn      bdb_zclFindingBindingAddBindEntry
 *
 * @brief   This function is used to Add an entry to the binding table
 *
 * @param   SrcEndpInt - source endpoint
 * @param   BindClusterId - cluster to try bind
 * @param   Cnt - list of remote clusters
 * @param   ClusterList - pointer to the Object ID list
 * @param   DstAddr - Address of remote node
 * @param   DstEndpInt - EndPoint of remote node
 *
 * @return  status - Success if added
 */
static ZStatus_t bdb_zclFindingBindingAddBindEntry( byte SrcEndpInt,
                                  uint16 BindClusterId,
                                  byte Cnt,                 
                                  uint16 * ClusterList,
                                  zAddrType_t *DstAddr, byte DstEndpInt )

/*********************************************************************
 * @fn      bdb_exitFindingBindingWStatus
 *
 * @brief   Clean respondent list and reports the status to bdb state machine
 *
 * @return  
 */
void bdb_exitFindingBindingWStatus( uint8 status )


/*********************************************************************
 * @fn      bdb_zclSimpleDescClusterListClean
 *
 * @brief   This function free Simple Descriptor cluster lists
 *
 * @param   pSimpleDesc - pointer to simple descriptor
 *
 * @return  status
 */
static void bdb_zclSimpleDescClusterListClean( SimpleDescriptionFormat_t *pSimpleDesc )




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值