Si la passerelle souhaite obtenir le numéro de version de l'application côté micrologiciel, tel que V1.0.0, cela peut être obtenu via cette méthode. Lien de référence
https://www.silabs.com/community/wireless/zigbee-and-thread/knowledge-base.entry.html/2018/09/21/reporting_custommes-cKOS
Le principe est d'utiliser le XNCP de Plugin, vous pouvez rapporter les informations ci-dessous, puis l'application de passerelle peut les analyser après avoir reçu les informations.
Le lien ci-dessus fera un rapport régulièrement, nous pouvons faire un rapport une fois, puis désactiver le rapport.
#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);
}
L'effet final est le suivant: