I'm trying to implement custom callbacks on the STM32WB Zigbee library. Any examples of custom callbacks on a report or certain attributes?
My goal is to have a coordinator connected to sleepy end devices. The coordinator will periodically request measurements from the end devices. It seems like all the examples have requests going from the nodes to the coordinator, so I'm having trouble reversing it for my implementation.
Right now I'm using the Zigbee_PressMeas application example from STM32Cube_FW_WB_V1.6.0 as a base. I want a custom callback on the client when the server issues a request, which will cause the client to take a measurement and respond.
This is my client code in app_zigbee.c from APP_ZIGBEE_ConfigEndpoints(void:(
// Cluster Setup
zigbee_app_info.press_meas_client = ZbZclPressMeasServerAlloc(zigbee_app_info.zb, SW1_ENDPOINT, ZCL_PRESSURE_MIN, ZCL_PRESSURE_MAX);
assert(zigbee_app_info.press_meas_client != NULL);
zigbee_app_info.press_meas_client->report = &zcl_press_meas_press_client_report;
// Find the Attribute Object
struct ZbZclAttrListEntryT pressure_attribute_entry;
struct ZbZclAttrT pressure_attribute;
pressure_attribute_entry = *(ZbZclAttrFind(zigbee_app_info.press_meas_client, ZCL_PRESS_MEAS_ATTR_MEAS_VAL));
pressure_attribute = *(pressure_attribute_entry.info);
// Print to verify the Attribute
printf("\r\nPressure_Attr ID Number: %d\r\n", pressure_attribute.attributeId);
// Assign a callback function
pressure_attribute.callback = &APP_ZIGBEE_custom_pressure_read_cb;
// Register the Cluster
ZbZclClusterEndpointRegister(zigbee_app_info.press_meas_client);I think it's ignoring my custom callback and simply using the default request handler.
Thanks!