📄 bindingtable.h
字号:
#ifndef BINDINGTABLE_H
#define BINDINGTABLE_H
/*********************************************************************
Filename: BindingTable.h
Revised: $Date: 2006-08-15 10:35:43 -0700 (Tue, 15 Aug 2006) $
Revision: $Revision: 11786 $
Description:
Device binding table.
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.
*********************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
* INCLUDES
*/
#include "ZComdef.h"
#include "osal.h"
#include "nwk.h"
#include "AssocList.h"
/*********************************************************************
* MACROS
*/
/*********************************************************************
* CONSTANTS
*/
#define MAX_DEVICE_PAIRS 255 // temp value
#define DSTGROUPMODE_ADDR 0
#define DSTGROUPMODE_GROUP 1
/*********************************************************************
* TYPEDEFS
*/
typedef struct
{
uint16 numRecs;
} nvBindingHdr_t;
// Don't use sizeof( BindingEntry_t ) use gBIND_REC_SIZE when calculating
// the size of each binding table entry. gBIND_REC_SIZE is defined in nwk_global.c.
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;
/*********************************************************************
* GLOBAL VARIABLES
*/
// BindingTable is defined in nwk_globals.c and NWK_MAX_BINDING_ENTRIES
// is defined in f8wConfig.cfg. Don't use NWK_MAX_BINDING_ENTRIES as the
// number of records - use gNWK_MAX_BINDING_ENTRIES.
extern BindingEntry_t BindingTable[];
/*********************************************************************
* FUNCTIONS
*/
/*
* This function is used to initialise the binding table
*/
extern void InitBindingTable( void );
/*
* Removes a binding table entry.
*/
extern byte bindRemoveEntry( BindingEntry_t *pBind );
/*
* Is the clusterID in the clusterID list?
*/
extern byte bindIsClusterIDinList( BindingEntry_t *entry, uint16 clusterId );
/*
* Removes a ClusterID from a list of ClusterIDs.
*/
extern byte bindRemoveClusterIdFromList( BindingEntry_t *entry, uint16 clusterId );
/*
* Adds a ClusterID to a list of ClusterIDs.
*/
extern byte bindAddClusterIdToList( BindingEntry_t *entry, uint16 clusterId );
/*
* Finds an existing src/epint to dst/epint bind record
*/
extern BindingEntry_t *bindFindExisting( zAddrType_t *srcShortAddr, byte srcEpInt,
zAddrType_t *dstShortAddr, byte dstEpInt );
/*
* Remove binds(s) associated to Source address, endpoint and cluster.
*/
extern void nwk_remove_bindSrc( zAddrType_t *srcAddr, byte epInt,
byte numClusterIds, uint16 *clusterIds );
/*
* Remove bind(s) associated to a address (source or destination)
*/
extern void bindRemoveDev( zAddrType_t *shortAddr);
/*
* Remove bind(s) associated to a address (source)
*/
extern void bindRemoveSrcDev( zAddrType_t *srcAddr, uint8 ep );
/*
* Calculate the number items this device is bound to.
*/
extern byte bindNumBoundTo( zAddrType_t *devAddr, byte devEpInt, byte srcMode );
/*
* Count the number of reflections.
*/
extern uint16 bindNumReflections( zAddrType_t *srcAddr, uint8 ep,
uint16 clusterID, uint8 rev );
/*
* Finds the binding entry for the source address,
* endpoint and clusterID passed in as a parameter.
*/
extern BindingEntry_t *bindFind( zAddrType_t *srcAddr, byte ep,
uint16 clusterID, byte skipping, byte rev );
/*
* Finds the next binding entry.
*/
extern BindingEntry_t *bindFindNext( zAddrType_t *srcAddr, byte srcEp,
zAddrType_t *dstAddr, byte dstEp,
uint16 clusterID, byte rev );
/*
* Processes the Hand Binding Timeout.
*/
extern void nwk_HandBindingTimeout( void );
/*
* Initialize Binding Table NV Item
*/
extern byte BindInitNV( void );
/*
* Initialize Binding Table NV Item
*/
extern void BindSetDefaultNV( void );
/*
* Restore Binding Table from NV
*/
extern uint16 BindRestoreFromNV( void );
/*
* Write Binding Table out to NV
*/
extern void BindWriteNV( void );
/*
* Update network address in binding table
*/
extern void bindUpdateAddr( uint16 oldAddr, uint16 newAddr );
/*
* This function is used to Add an entry to the binding table
*/
extern BindingEntry_t *bindAddEntry( zAddrType_t *srcAddr, byte srcEpInt,
zAddrType_t *dstAddr, byte dstEpInt,
byte numClusterIds, uint16 *clusterIds );
/*
* This function returns the number of binding table entries
*/
extern uint16 bindNumOfEntries( void );
/*
* This function returns the number of binding entries
* possible and used.
*/
extern void bindCapacity( uint16 *maxEntries, uint16 *usedEntries );
/*********************************************************************
* FUNCTION POINTERS
*/
/*
* This function is used to Add an entry to the binding table
*/
extern BindingEntry_t *(*pbindAddEntry)( zAddrType_t *srcAddr, byte srcEpInt,
zAddrType_t *dstAddr, byte dstEpInt,
byte numClusterIds, uint16 *clusterIds );
/*
* This function returns the number of binding table entries
*/
extern uint16 (*pbindNumOfEntries)( void );
/*
* Remove bind(s) associated to a address (source or destination)
*/
extern void (*pbindRemoveDev)( zAddrType_t *Addr );
/*
* Initialize Binding Table NV Item
*/
extern byte (*pBindInitNV)( void );
/*
* Initialize Binding Table NV Item
*/
extern void (*pBindSetDefaultNV)( void );
/*
* Restore binding table from NV
*/
extern uint16 (*pBindRestoreFromNV)( void );
/*
* Write binding table to NV
*/
extern void (*pBindWriteNV)( void );
/*
* Convert address manager index to zAddrType_t for an extended address
*/
extern uint8 bindingAddrMgsHelperConvert( uint16 idx, zAddrType_t *addr );
/*
* Convert address manager index to short address
*/
extern uint16 bindingAddrMgsHelperConvertShort( uint16 idx );
/*
* Get a pointer to the Nth valid binding table entry.
*/
extern BindingEntry_t *GetBindingTableEntry( uint16 Nth );
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* BINDINGTABLE_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -