added list of received and unknown topics.

This commit is contained in:
Martin Preuss
2023-08-12 10:53:56 +02:00
parent 9602471a9b
commit c1353c056a
3 changed files with 15 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ AQH_STORAGE *AQH_Storage_new(void)
sto->mqttTopicList=AQH_MqttTopic_List_new();
sto->valueList=AQH_Value_List_new();
sto->dataFileList=AQH_DataFile_List_new();
sto->recvdTopicList=GWEN_StringList_new();
return sto;
}
@@ -72,6 +73,7 @@ void AQH_Storage_free(AQH_STORAGE *sto)
AQH_MqttTopic_List_free(sto->mqttTopicList);
AQH_Device_List_free(sto->deviceList);
AQH_Room_List_free(sto->roomList);
GWEN_StringList_free(sto->recvdTopicList);
free(sto->dataFileFolder);
free(sto->stateFile);
@@ -98,6 +100,15 @@ void AQH_Storage_SetStateFile(AQH_STORAGE *sto, const char *s)
GWEN_STRINGLIST *AQH_Storage_GetRecvdTopicList(const AQH_STORAGE *sto)
{
return sto?sto->recvdTopicList:NULL;
}
void AQH_Storage_AddRoom(AQH_STORAGE *sto, AQH_ROOM *r)
{
if (sto && r) {
@@ -363,6 +374,7 @@ void AQH_Storage_HandleMqttPublish(AQH_STORAGE *sto, const char *sTopic, const c
}
else {
DBG_INFO(AQH_LOGDOMAIN, "Unknown MQTT topic \"%s\"", sTopic);
GWEN_StringList_AppendString(sto->recvdTopicList, sTopic, 0, 1);
}
}
}

View File

@@ -89,6 +89,7 @@ AQHOME_API int AQH_Storage_WriteState(AQH_STORAGE *sto);
AQHOME_API void AQH_Storage_HandleMqttPublish(AQH_STORAGE *sto, const char *topic, const char *value);
AQHOME_API GWEN_STRINGLIST *AQH_Storage_GetRecvdTopicList(const AQH_STORAGE *sto);

View File

@@ -46,6 +46,8 @@ struct AQH_STORAGE {
AQH_DATAFILE_LIST *dataFileList;
GWEN_STRINGLIST *recvdTopicList;
uint32_t runtimeFlags;
};