improve get last report data path api in cluster cache (#23431)
-- Return not found error if the last report data path is not concrete cluster path
-- Add doxygen
diff --git a/src/app/ClusterStateCache.cpp b/src/app/ClusterStateCache.cpp
index 1ccff3e..5497dfd 100644
--- a/src/app/ClusterStateCache.cpp
+++ b/src/app/ClusterStateCache.cpp
@@ -534,8 +534,12 @@
CHIP_ERROR ClusterStateCache::GetLastReportDataPath(ConcreteClusterPath & aPath)
{
- aPath = mLastReportDataPath;
- return CHIP_NO_ERROR;
+ if (mLastReportDataPath.IsValidConcreteClusterPath())
+ {
+ aPath = mLastReportDataPath;
+ return CHIP_NO_ERROR;
+ }
+ return CHIP_ERROR_INCORRECT_STATE;
}
} // namespace app
} // namespace chip
diff --git a/src/app/ClusterStateCache.h b/src/app/ClusterStateCache.h
index c6c545e..4b88b05 100644
--- a/src/app/ClusterStateCache.h
+++ b/src/app/ClusterStateCache.h
@@ -483,6 +483,10 @@
mEventStatusCache.clear();
}
+ /*
+ * Get the last concrete report data path, if path is not concrete cluster path, return CHIP_ERROR_NOT_FOUND
+ *
+ */
CHIP_ERROR GetLastReportDataPath(ConcreteClusterPath & aPath);
private: