update the status field of progress elements at the end of a clean. (#34919)
* update the status field of progress elements at the end of a clean.
* Added some style suggestions from the review of PR 34887.
* update the readme.
* Restyled by prettier-markdown
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/examples/rvc-app/README.md b/examples/rvc-app/README.md
index 1be714f..8cc6e73 100644
--- a/examples/rvc-app/README.md
+++ b/examples/rvc-app/README.md
@@ -156,3 +156,13 @@
Example command:
`./scripts/tests/run_python_test.py --script src/python_testing/TC_SEAR_1_4.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1`
+
+#### TC 1.5
+
+Example command:
+`./scripts/tests/run_python_test.py --script src/python_testing/TC_SEAR_1_5.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1"`
+
+#### TC 1.6
+
+Example command:
+`./scripts/tests/run_python_test.py --script src/python_testing/TC_SEAR_1_6.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1`
diff --git a/examples/rvc-app/rvc-common/include/rvc-device.h b/examples/rvc-app/rvc-common/include/rvc-device.h
index 97f3475..40a5232 100644
--- a/examples/rvc-app/rvc-common/include/rvc-device.h
+++ b/examples/rvc-app/rvc-common/include/rvc-device.h
@@ -138,6 +138,12 @@
void HandleClearErrorMessage();
void HandleResetMessage();
+
+ /**
+ * Updates the Service area progress elements when an activity has ended.
+ * Sets any remaining Operating or Pending states to Skipped.
+ */
+ void UpdateServiceAreaProgressOnExit();
};
} // namespace Clusters
diff --git a/examples/rvc-app/rvc-common/src/rvc-device.cpp b/examples/rvc-app/rvc-common/src/rvc-device.cpp
index db938a5..8619d28 100644
--- a/examples/rvc-app/rvc-common/src/rvc-device.cpp
+++ b/examples/rvc-app/rvc-common/src/rvc-device.cpp
@@ -69,6 +69,8 @@
mRunModeInstance.UpdateCurrentMode(newMode);
mOperationalStateInstance.SetOperationalState(to_underlying(RvcOperationalState::OperationalStateEnum::kSeekingCharger));
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
+
+ UpdateServiceAreaProgressOnExit();
return;
}
break;
@@ -311,6 +313,7 @@
mServiceAreaInstance.SetCurrentArea(DataModel::NullNullable);
mServiceAreaInstance.SetEstimatedEndTime(DataModel::NullNullable);
+ UpdateServiceAreaProgressOnExit();
}
void RvcDevice::HandleAreaCompletedEvent()
@@ -404,3 +407,23 @@
mServiceAreaInstance.SetCurrentArea(DataModel::NullNullable);
mServiceAreaInstance.SetEstimatedEndTime(DataModel::NullNullable);
}
+
+void RvcDevice::UpdateServiceAreaProgressOnExit()
+{
+ if (!mServiceAreaInstance.HasFeature(ServiceArea::Feature::kProgressReporting))
+ {
+ return;
+ }
+
+ uint32_t i = 0;
+ ServiceArea::Structs::ProgressStruct::Type progressElement;
+ while (mServiceAreaDelegate.GetProgressElementByIndex(i, progressElement))
+ {
+ if (progressElement.status == ServiceArea::OperationalStatusEnum::kOperating ||
+ progressElement.status == ServiceArea::OperationalStatusEnum::kPending)
+ {
+ mServiceAreaInstance.SetProgressStatus(progressElement.areaID, ServiceArea::OperationalStatusEnum::kSkipped);
+ }
+ i++;
+ }
+}
diff --git a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp
index 11daac1..f7e17aa 100644
--- a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp
+++ b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp
@@ -132,13 +132,13 @@
}
}
- // If there are less than 2 supported maps, any combination of areas is valid.
+ // If there is 1 or 0 supported maps, any combination of areas is valid.
if (!GetInstance()->HasFeature(Feature::kMaps) || GetNumberOfSupportedMaps() <= 1)
{
return true;
}
- // Check that all the areas are in the same map.
+ // Check that all the requested areas are in the same map.
auto newAreasIter = req.newAreas.begin();
newAreasIter.Next();