Compare commits
2 commits
main
...
zb_version
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9f19c02d4 | ||
|
|
ede0c81632 |
3 changed files with 19 additions and 5 deletions
|
|
@ -242,7 +242,7 @@ int main(void) {
|
||||||
|
|
||||||
RET_IF_ERR(prst_zb_factory_reset_check());
|
RET_IF_ERR(prst_zb_factory_reset_check());
|
||||||
|
|
||||||
prst_zb_attrs_init(&dev_ctx);
|
RET_IF_ERR(prst_zb_attrs_init(&dev_ctx));
|
||||||
|
|
||||||
ZB_AF_REGISTER_DEVICE_CTX(&app_template_ctx);
|
ZB_AF_REGISTER_DEVICE_CTX(&app_template_ctx);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
#include "prst_zb_attrs.h"
|
#include "prst_zb_attrs.h"
|
||||||
|
|
||||||
|
#include <prstlib/macros.h>
|
||||||
#include <zboss_api_addons.h>
|
#include <zboss_api_addons.h>
|
||||||
|
#include <zephyr/logging/log.h>
|
||||||
|
|
||||||
#include "prst_zb_endpoint_defs.h"
|
#include "prst_zb_endpoint_defs.h"
|
||||||
|
|
||||||
void prst_zb_attrs_init(struct zb_device_ctx *dev_ctx) {
|
LOG_MODULE_REGISTER(prst_zb_attrs, CONFIG_LOG_DEFAULT_LEVEL);
|
||||||
|
|
||||||
|
int prst_zb_attrs_init(struct zb_device_ctx *dev_ctx) {
|
||||||
dev_ctx->basic_attr.zcl_version = ZB_ZCL_VERSION;
|
dev_ctx->basic_attr.zcl_version = ZB_ZCL_VERSION;
|
||||||
dev_ctx->basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_BATTERY;
|
dev_ctx->basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_BATTERY;
|
||||||
ZB_ZCL_SET_STRING_VAL(
|
ZB_ZCL_SET_STRING_VAL(
|
||||||
|
|
@ -12,10 +16,18 @@ void prst_zb_attrs_init(struct zb_device_ctx *dev_ctx) {
|
||||||
PRST_BASIC_MANUF_NAME,
|
PRST_BASIC_MANUF_NAME,
|
||||||
ZB_ZCL_STRING_CONST_SIZE(PRST_BASIC_MANUF_NAME));
|
ZB_ZCL_STRING_CONST_SIZE(PRST_BASIC_MANUF_NAME));
|
||||||
|
|
||||||
|
char versioned_model_id[sizeof(dev_ctx->basic_attr.model_id)];
|
||||||
|
RET_CHECK(strlen(CONFIG_PRST_ZB_MODEL_ID) + strlen(CONFIG_BOARD_REVISION) + 1 <
|
||||||
|
sizeof(versioned_model_id),
|
||||||
|
"Model ID too long");
|
||||||
|
strcpy(versioned_model_id, CONFIG_PRST_ZB_MODEL_ID);
|
||||||
|
strcat(versioned_model_id, " ");
|
||||||
|
strcat(versioned_model_id, CONFIG_BOARD_REVISION);
|
||||||
|
LOG_DBG("Versioned model ID: %s", versioned_model_id);
|
||||||
ZB_ZCL_SET_STRING_VAL(
|
ZB_ZCL_SET_STRING_VAL(
|
||||||
dev_ctx->basic_attr.model_id,
|
dev_ctx->basic_attr.model_id,
|
||||||
CONFIG_PRST_ZB_MODEL_ID,
|
versioned_model_id,
|
||||||
ZB_ZCL_STRING_CONST_SIZE(CONFIG_PRST_ZB_MODEL_ID));
|
ZB_ZCL_STRING_CONST_SIZE(versioned_model_id));
|
||||||
|
|
||||||
ZB_ZCL_SET_STRING_VAL(
|
ZB_ZCL_SET_STRING_VAL(
|
||||||
dev_ctx->basic_attr.date_code,
|
dev_ctx->basic_attr.date_code,
|
||||||
|
|
@ -29,6 +41,8 @@ void prst_zb_attrs_init(struct zb_device_ctx *dev_ctx) {
|
||||||
|
|
||||||
dev_ctx->identify_attr.identify_time =
|
dev_ctx->identify_attr.identify_time =
|
||||||
ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;
|
ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
zb_zcl_status_t prst_zb_set_attr_value(zb_uint16_t cluster_id, zb_uint16_t attr_id, void *data) {
|
zb_zcl_status_t prst_zb_set_attr_value(zb_uint16_t cluster_id, zb_uint16_t attr_id, void *data) {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ struct zb_device_ctx {
|
||||||
prst_illuminancce_attrs_t illuminance_attrs;
|
prst_illuminancce_attrs_t illuminance_attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
void prst_zb_attrs_init(struct zb_device_ctx *dev_ctx);
|
int prst_zb_attrs_init(struct zb_device_ctx *dev_ctx);
|
||||||
|
|
||||||
zb_zcl_status_t prst_zb_set_attr_value(zb_uint16_t cluster_id, zb_uint16_t attr_id, void *data);
|
zb_zcl_status_t prst_zb_set_attr_value(zb_uint16_t cluster_id, zb_uint16_t attr_id, void *data);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue