15
15
* See the License for the specific language governing permissions and
16
16
* limitations under the License.
17
17
*/
18
+ #include " app/AttributePathExpandIterator.h"
18
19
#include " lib/support/CodeUtils.h"
19
20
#include < app/AppConfig.h>
20
21
#include < app/InteractionModelEngine.h>
@@ -854,18 +855,11 @@ void ReadHandler::ResetPathIterator()
854
855
855
856
void ReadHandler::AttributePathIsDirty (DataModel::Provider * apDataModel, const AttributePathParams & aAttributeChanged)
856
857
{
857
- bool bHasNext = false ;
858
- ConcreteAttributePath path;
859
-
860
858
mDirtyGeneration = mManagementCallback .GetInteractionModelEngine ()->GetReportingEngine ().GetDirtySetGeneration ();
861
859
862
- {
863
- // Inside a separate block, to allow the read and rollback to happen as one unit.
864
- // we want to look at what `next` would be but not actually change state as we need to reset the
865
- // current cluster
866
- PeekAttributePathExpandIterator iterator (apDataModel, mAttributePathExpandState );
867
- bHasNext = iterator.Next (path);
868
- }
860
+ // we want to get the value, but not advance the state
861
+ AttributePathExpandIterator::State tempState = mAttributePathExpandState ;
862
+ ConcreteAttributePath path;
869
863
870
864
// We won't reset the path iterator for every AttributePathIsDirty call to reduce the number of full data reports.
871
865
// The iterator will be reset after finishing each report session.
@@ -876,7 +870,8 @@ void ReadHandler::AttributePathIsDirty(DataModel::Provider * apDataModel, const
876
870
// TODO (#16699): Currently we can only guarantee the reports generated from a single path in the request are consistent. The
877
871
// data might be inconsistent if the user send a request with two paths from the same cluster. We need to clearify the behavior
878
872
// or make it consistent.
879
- if (bHasNext && (aAttributeChanged.HasWildcardEndpointId () || aAttributeChanged.mEndpointId == path.mEndpointId ) &&
873
+ if (AttributePathExpandIterator (apDataModel, tempState).Next (path) &&
874
+ (aAttributeChanged.HasWildcardEndpointId () || aAttributeChanged.mEndpointId == path.mEndpointId ) &&
880
875
(aAttributeChanged.HasWildcardClusterId () || aAttributeChanged.mClusterId == path.mClusterId ))
881
876
{
882
877
ChipLogDetail (DataManagement,
0 commit comments