Hello, I am developing a Zigbee OTA client / server application. My code is based on the example from the 4.1.0 nRF5 SDK. From the example I took only the code related to the OTA cluster because I want only to sent image file from the server to the client without reprogramming the client.
On the server side I do the initialization and I am inserting a file into the memory (currently only providing a pointer to the empty array, the header is filled with 0xFF), something like this:
zb_void_t ota_server_clusters_init(zb_void_t)
{
test_file.head.file_id = ZB_ZCL_OTA_UPGRADE_FILE_HEADER_FILE_ID;
/* Initialize the attributes */
ota_server_attr_init();
/* Register OTA Client device context (endpoints). */
ZB_AF_REGISTER_DEVICE_CTX(&ota_upgrade_server_ctx);
zb_zcl_ota_upgrade_init_server(OTA_ENDPOINT_SERVER, next_data_ind_cb);
}
The insert_ota_file() is called when the server connects to the network.
static zb_void_t insert_ota_file(zb_uint8_t param)
{
zb_buf_t * pBuff = ZB_BUF_FROM_REF( param );
zb_zcl_ota_upgrade_server_insert_file_t * file_data;
ZB_BUF_INITIAL_ALLOC( pBuff, sizeof( zb_zcl_ota_upgrade_server_insert_file_t ) + ( 1 ) * sizeof( zb_uint16_t ), file_data );
ZB_ZCL_OTA_UPGRADE_INSERT_FILE(pBuff, OTA_ENDPOINT_SERVER, 0, (zb_uint8_t *)(mp_ota_file), OTA_UPGRADE_TEST_UPGRADE_TIME/*, ZB_TRUE, zb_err_code*/);
}
On the client side i also do the initialization:
/**@brief Function for initializing the Zigbee Stack.
*/
zb_void_t ota_client_clusters_init(zb_void_t)
{
/* Initialize application context structure. */
UNUSED_RETURN_VALUE(ZB_MEMSET(&m_dev_ctx, 0, sizeof(m_dev_ctx)));
/* Register OTA Client device context (endpoints). */
ZB_AF_REGISTER_DEVICE_CTX(&ota_upgrade_client_ctx);
/* Initialize clusters' attributes. */
ota_client_attr_init();
/* Register callback for handling ZCL commands. */
ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb);
}
then i am calling this function periodically:
UNUSED_RETURN_VALUE(ZB_GET_OUT_BUF_DELAYED(zb_zcl_ota_upgrade_init_client));
Both, the server and client are connected to the network but after calling zb_zcl_ota_upgrade_init_client nothing happens - I expect the image download starts automatically and on the client side the callback zcl_device_cb be called with appropiate events type, but that does not happen.
Could anyone suggests what should I check first why it is not working? Maybe some additional initalization is needed, ie. the server is checking the file content before start sending it, maybe some additional checks are done inside the Zigbee stack and something is missing in the initialization to trigger the image download.
Any advice will be helpfull.
Best regards,
Michal.