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