diff --git a/aqhome/data/storage.c b/aqhome/data/storage.c index 1aa9a59..e702512 100644 --- a/aqhome/data/storage.c +++ b/aqhome/data/storage.c @@ -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); } } } diff --git a/aqhome/data/storage.h b/aqhome/data/storage.h index 7122c20..8aee5f4 100644 --- a/aqhome/data/storage.h +++ b/aqhome/data/storage.h @@ -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); diff --git a/aqhome/data/storage_p.h b/aqhome/data/storage_p.h index 0327dee..3eb91ef 100644 --- a/aqhome/data/storage_p.h +++ b/aqhome/data/storage_p.h @@ -46,6 +46,8 @@ struct AQH_STORAGE { AQH_DATAFILE_LIST *dataFileList; + GWEN_STRINGLIST *recvdTopicList; + uint32_t runtimeFlags; };