Skip to content

Commit 681f951

Browse files
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>
1 parent f53050c commit 681f951

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

examples/rvc-app/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,13 @@ PICS`SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS=1`. PIXIT: `` Example command:
156156

157157
Example command:
158158
`./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`
159+
160+
#### TC 1.5
161+
162+
Example command:
163+
`./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"`
164+
165+
#### TC 1.6
166+
167+
Example command:
168+
`./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`

examples/rvc-app/rvc-common/include/rvc-device.h

+6
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ class RvcDevice
138138
void HandleClearErrorMessage();
139139

140140
void HandleResetMessage();
141+
142+
/**
143+
* Updates the Service area progress elements when an activity has ended.
144+
* Sets any remaining Operating or Pending states to Skipped.
145+
*/
146+
void UpdateServiceAreaProgressOnExit();
141147
};
142148

143149
} // namespace Clusters

examples/rvc-app/rvc-common/src/rvc-device.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ void RvcDevice::HandleRvcRunChangeToMode(uint8_t newMode, ModeBase::Commands::Ch
6969
mRunModeInstance.UpdateCurrentMode(newMode);
7070
mOperationalStateInstance.SetOperationalState(to_underlying(RvcOperationalState::OperationalStateEnum::kSeekingCharger));
7171
response.status = to_underlying(ModeBase::StatusCode::kSuccess);
72+
73+
UpdateServiceAreaProgressOnExit();
7274
return;
7375
}
7476
break;
@@ -311,6 +313,7 @@ void RvcDevice::HandleActivityCompleteEvent()
311313

312314
mServiceAreaInstance.SetCurrentArea(DataModel::NullNullable);
313315
mServiceAreaInstance.SetEstimatedEndTime(DataModel::NullNullable);
316+
UpdateServiceAreaProgressOnExit();
314317
}
315318

316319
void RvcDevice::HandleAreaCompletedEvent()
@@ -404,3 +407,23 @@ void RvcDevice::HandleResetMessage()
404407
mServiceAreaInstance.SetCurrentArea(DataModel::NullNullable);
405408
mServiceAreaInstance.SetEstimatedEndTime(DataModel::NullNullable);
406409
}
410+
411+
void RvcDevice::UpdateServiceAreaProgressOnExit()
412+
{
413+
if (!mServiceAreaInstance.HasFeature(ServiceArea::Feature::kProgressReporting))
414+
{
415+
return;
416+
}
417+
418+
uint32_t i = 0;
419+
ServiceArea::Structs::ProgressStruct::Type progressElement;
420+
while (mServiceAreaDelegate.GetProgressElementByIndex(i, progressElement))
421+
{
422+
if (progressElement.status == ServiceArea::OperationalStatusEnum::kOperating ||
423+
progressElement.status == ServiceArea::OperationalStatusEnum::kPending)
424+
{
425+
mServiceAreaInstance.SetProgressStatus(progressElement.areaID, ServiceArea::OperationalStatusEnum::kSkipped);
426+
}
427+
i++;
428+
}
429+
}

examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas::
132132
}
133133
}
134134

135-
// If there are less than 2 supported maps, any combination of areas is valid.
135+
// If there is 1 or 0 supported maps, any combination of areas is valid.
136136
if (!GetInstance()->HasFeature(Feature::kMaps) || GetNumberOfSupportedMaps() <= 1)
137137
{
138138
return true;
139139
}
140140

141-
// Check that all the areas are in the same map.
141+
// Check that all the requested areas are in the same map.
142142
auto newAreasIter = req.newAreas.begin();
143143
newAreasIter.Next();
144144

0 commit comments

Comments
 (0)