如果网关想要获取固件端应用版本号,比如V1.0.0,可以通过本篇方法去实现。参考链接
https://www.silabs.com/community/wireless/zigbee-and-thread/knowledge-base.entry.html/2018/09/21/reporting_custommes-cKOS
原理是用到了Plugin的XNCP,可以下面Report 信息,然后网关应用收到信息后解析即可。
上面链接会定时上报,我们可以上报一次,然后关掉上报即可。
#define APP_VERSION "1.0"
#define XNCP_CUSTOM_REPORT_APP_VERSION 0xA0
EmberEventControl customReportEventControl;
void customReportEventHandler(void)
{
char msg[32];
msg[0] = XNCP_CUSTOM_REPORT_APP_VERSION;
sprintf(&msg[1], "v%s",APP_VERSION);
emberAfPluginXncpSendCustomEzspMessage(sizeof(msg), msg);
emberEventControlSetInactive(customReportEventControl);
}
/** @brief Performs any additional initialization required at system startup.
*
* This function is called when the application starts and can be used to
* perform any additional initialization required at system startup.
*/
void emberAfMainInitCallback(void) {
// your code here
emberEventControlSetDelayMS(customReportEventControl, 2000);
}
最终效果如下图: