Skip to content

Commit 2388c64

Browse files
committed
Change group deduction for scene bindings
1 parent e337edc commit 2388c64

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ INCLUDE_PATHS := -I$(SRC_PATH) -I$(SRC_PATH)/includes -I$(SRC_PATH)/common -I$(
116116
-I$(SDK_PATH)/zigbee/zbapi \
117117
-I$(SDK_PATH)/zigbee/zbhci \
118118
-I$(SDK_PATH)/zigbee/zcl \
119-
-I$(SDK_PATH)/zigbee/zdo
119+
-I$(SDK_PATH)/zigbee/zdo \
120+
-I$(SDK_PATH)/zigbee/aps
120121

121122
GCC_FLAGS += $(TEL_CHIP) $(DEVICE_DEFS)
122123

src/zigbee/binding_table.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef _BINDING_TABLE_H_
2+
#define _BINDING_TABLE_H_
3+
4+
#include "aps_api.h"
5+
6+
#define BINDING_TABLE_FOR_EACH(cluster, endpoint, out_ptr) \
7+
for (int i__ = 0; i < APS_BINDING_TABLE_NUM; ++i) \
8+
if (g_apsBindingTbl[i].used && g_apsBindingTbl[i].clusterId == (cluster) && g_apsBindingTbl[i].srcEp == (endpoint) && (out_ptr) = (&g_apsBindingTbl[i]))
9+
10+
#endif

src/zigbee/switch_cluster.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "zcl_include.h"
1111
#include "base_components/relay.h"
1212
#include "configs/nv_slots_cfg.h"
13+
#include "binding_table.h"
1314

1415
#define MULTI_PRESS_CNT_TO_RESET 10
1516

@@ -753,39 +754,32 @@ static void switch_cluster_binding_recall_scene(zigbee_switch_cluster *cluster)
753754
scenesInfo.src_endpoint = cluster->endpoint;
754755
scenesInfo.dst_addr_mode = 0x00;
755756

756-
bind_dst_list_tbl bindTbl;
757+
aps_binding_entry_t *e;
757758

758-
if (aps_search_dst_from_bind_tbl(&scenesInfo, &bindTbl) != APS_STATUS_SUCCESS)
759+
BINDING_TABLE_FOR_EACH(ZCL_CLUSTER_GEN_SCENES, cluster->endpoint, e)
759760
{
760-
goto out;
761-
}
762-
763-
for (u8 i = 0; i < bindTbl.txCnt; ++i)
764-
{
765-
bind_dst_list *l = bindTbl.list + i;
766-
767761
u16 group_id = 0xffff;
768762

769763
epInfo_t dstEpInfo;
770764
TL_SETSTRUCTCONTENT(dstEpInfo, 0);
771765

772-
if (l->dst_addr_mode == APS_BIND_DST_ADDR_GROUP)
766+
if (e->dstAddrMode == APS_BIND_DST_ADDR_GROUP)
773767
{
774-
group_id = l->aps_addr.dst_group_addr;
768+
group_id = e->groupAddr;
775769

776770
dstEpInfo.profileId = HA_PROFILE_ID;
777771
dstEpInfo.dstAddrMode = APS_SHORT_GROUPADDR_NOEP;
778-
dstEpInfo.dstAddr.shortAddr = l->aps_addr.dst_group_addr;
772+
dstEpInfo.dstAddr.dstGroupId = group_id;
779773
}
780774
else
781775
{
782776
group_id = 0;
783777

784778
dstEpInfo.profileId = HA_PROFILE_ID;
785779
dstEpInfo.dstAddrMode = APS_LONG_DSTADDR_WITHEP;
786-
dstEpInfo.dstEp = l->aps_addr.dst_endpoint;
780+
dstEpInfo.dstEp = e->dstExtAddrInfo.dstEp;
787781

788-
ZB_IEEE_ADDR_COPY(dstEpInfo.dstAddr.extAddr, l->aps_addr.dst_ext_addr);
782+
ZB_IEEE_ADDR_COPY(dstEpInfo.dstAddr.extAddr, e->dstExtAddrInfo.extAddr);
789783
}
790784

791785
recallScene_t recallScene = {

0 commit comments

Comments
 (0)