espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
173 stars 29 forks source link

Can I set end device type in code while compiling with router device type? (TZ-1314) #488

Open remenyo opened 2 hours ago

remenyo commented 2 hours ago

Question

Hello, my question is about the KCONFIG parameter ZB_DEVICE_TYPE. My question is: Can I set ZB_DEVICE_TYPE to ZB_ZCZR while setting zb_nwk_cfg.esp_zb_role = ESP_ZB_DEVICE_TYPE_ED; in the code?

I have a firmware which in some instances should work as a router, and in some cases just as an end device.

I think I can set this in:

esp_zb_cfg_t zb_nwk_cfg;
memset(&zb_nwk_cfg, 0, sizeof(esp_zb_cfg_t));
zb_nwk_cfg.esp_zb_role = ESP_ZB_DEVICE_TYPE_ROUTER;
// OR
zb_nwk_cfg.esp_zb_role = ESP_ZB_DEVICE_TYPE_ED;

But the KCONFIG ZB_DEVICE_TYPE = ZB_ZED option makes code lines containting router settings, for example esp_zb_zgp_set_proxy_functionality() undefined. Because of this, the firmware cannot compile, even if I know I will set the type to router in case I call the router setting functions, and will not call them if I set the type to end device.

My question is: Can I set ZB_DEVICE_TYPE to ZB_ZCZR while in some cases setting zb_nwk_cfg.esp_zb_role = ESP_ZB_DEVICE_TYPE_ED; in the code?

Additional context.

No response