Skip to content

Commit

Permalink
Fixes the Service Area server's SkipArea handling (project-chip#35019)
Browse files Browse the repository at this point in the history
* Updated the rvc-example PICS XML files.

* update the handling of the SkipArea command to match the latest spec.

* Updated the name of SkipCurrentArea to SkipArea in the Instance and Delegate classes.

* Refactored SkipCurrentArea names to SkipArea in the RVC example app.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and PeterC1965 committed Aug 28, 2024
1 parent 3c345a7 commit 9393f7a
Show file tree
Hide file tree
Showing 11 changed files with 399 additions and 129 deletions.
4 changes: 2 additions & 2 deletions examples/rvc-app/rvc-common/include/rvc-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class RvcDevice
mOperationalStateDelegate.SetGoHomeCallback(&RvcDevice::HandleOpStateGoHomeCallback, this);

mServiceAreaDelegate.SetIsSetSelectedAreasAllowedCallback(&RvcDevice::SaIsSetSelectedAreasAllowed, this);
mServiceAreaDelegate.SetHandleSkipCurrentAreaCallback(&RvcDevice::SaHandleSkipCurrentArea, this);
mServiceAreaDelegate.SetHandleSkipAreaCallback(&RvcDevice::SaHandleSkipArea, this);
mServiceAreaDelegate.SetIsSupportedAreasChangeAllowedCallback(&RvcDevice::SaIsSupportedAreasChangeAllowed, this);
mServiceAreaDelegate.SetIsSupportedMapChangeAllowedCallback(&RvcDevice::SaIsSupportedMapChangeAllowed, this);
}
Expand Down Expand Up @@ -104,7 +104,7 @@ class RvcDevice

bool SaIsSetSelectedAreasAllowed(MutableCharSpan & statusText);

bool SaHandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText);
bool SaHandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText);

bool SaIsSupportedAreasChangeAllowed();

Expand Down
14 changes: 7 additions & 7 deletions examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace Clusters {
class RvcDevice;

typedef bool (RvcDevice::*IsSetSelectedAreasAllowedCallback)(MutableCharSpan & statusText);
typedef bool (RvcDevice::*HandleSkipCurrentAreaCallback)(uint32_t skippedArea, MutableCharSpan & skipStatusText);
typedef bool (RvcDevice::*HandleSkipAreaCallback)(uint32_t skippedArea, MutableCharSpan & skipStatusText);
typedef bool (RvcDevice::*IsChangeAllowedSimpleCallback)();

namespace ServiceArea {
Expand All @@ -46,8 +46,8 @@ class RvcServiceAreaDelegate : public Delegate

RvcDevice * mIsSetSelectedAreasAllowedDeviceInstance;
IsSetSelectedAreasAllowedCallback mIsSetSelectedAreasAllowedCallback;
RvcDevice * mHandleSkipCurrentAreaDeviceInstance;
HandleSkipCurrentAreaCallback mHandleSkipCurrentAreaCallback;
RvcDevice * mHandleSkipAreaDeviceInstance;
HandleSkipAreaCallback mHandleSkipAreaCallback;
RvcDevice * mIsSupportedAreasChangeAllowedDeviceInstance;
IsChangeAllowedSimpleCallback mIsSupportedAreasChangeAllowedCallback;
RvcDevice * mIsSupportedMapChangeAllowedDeviceInstance;
Expand Down Expand Up @@ -82,7 +82,7 @@ class RvcServiceAreaDelegate : public Delegate
bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req,
ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override;

bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override;
bool HandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override;

//*************************************************************************
// Supported Areas accessors
Expand Down Expand Up @@ -169,10 +169,10 @@ class RvcServiceAreaDelegate : public Delegate
mIsSetSelectedAreasAllowedDeviceInstance = instance;
}

void SetHandleSkipCurrentAreaCallback(HandleSkipCurrentAreaCallback callback, RvcDevice * instance)
void SetHandleSkipAreaCallback(HandleSkipAreaCallback callback, RvcDevice * instance)
{
mHandleSkipCurrentAreaCallback = callback;
mHandleSkipCurrentAreaDeviceInstance = instance;
mHandleSkipAreaCallback = callback;
mHandleSkipAreaDeviceInstance = instance;
}

void SetIsSupportedAreasChangeAllowedCallback(IsChangeAllowedSimpleCallback callback, RvcDevice * instance)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?xml version="1.0" encoding="utf-8"?><!--
Autogenerated xml file - Version No:V_21_TE2-FALL2023
Generated date:2023-08-03 21:56:43
Autogenerated xml file - Version No:V_32_1_4_TE2_FALL_2024
Generated date:2024-08-09 05:01:19
Cluster Name -RVC Clean Mode Cluster Test Plan
XML PICS -Ref Document:
version master a35005c,
version master 8f9bd8c,
Draft
2023-08-03 08:35:53 -0700
2024-08-08 16:19:15 -0700
--><clusterPICS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Generic-PICS-XML-Schema.xsd">
<!--General cluster information-->
<!--General cluster information
Notes:
- PICS definition table contains PICS from other clusters that may be needed to run all the test cases.
- To load these PICS, refer to the following clusters.
PICS Cluster Name Reference
RVCRUNM.S.A0000 RVC Run Mode Cluster Test Plan 103.2.2. [TC-RVCCLEANM-2.2] Change to Mode restrictions with DUT as Server - allclusters.html[pdf]
RVCRUNM.S.A0001 RVC Run Mode Cluster Test Plan 103.2.2. [TC-RVCCLEANM-2.2] Change to Mode restrictions with DUT as Server - allclusters.html[pdf]
-->
<name>RVC Clean Mode Cluster Test Plan</name>
<clusterId> </clusterId>
<picsRoot> </picsRoot>
Expand All @@ -16,7 +23,7 @@ Draft
<picsItem>
<itemNumber>RVCCLEANM.S</itemNumber>
<feature>Does the device implement the RVCCLEANM cluster as a server?</feature>
<reference>89.1. Role - allclusters.html[pdf]</reference>
<reference>99.1. Role - allclusters.html[pdf]</reference>
<status>O</status>
<support>true</support>
</picsItem>
Expand All @@ -26,16 +33,14 @@ Draft
<pixitItem>
<itemNumber>PIXIT.RVCCLEANM.MODE_CHANGE_FAIL</itemNumber>
<feature>Id of mode the device will fail to transition to, given its current state</feature>
<reference>90. PIXIT Definition - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>0x01</support>
<reference>100. PIXIT Definition - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status><support>n/a</support>
</pixitItem>
<pixitItem>
<itemNumber>PIXIT.RVCCLEANM.MODE_CHANGE_OK</itemNumber>
<feature>Id of mode the device will successfully transition to, given its current state</feature>
<reference>90. PIXIT Definition - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>0x01</support>
<reference>100. PIXIT Definition - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status><support>n/a</support>
</pixitItem>
</pixit>
<!--Server side PICS-->
Expand All @@ -45,31 +50,17 @@ Draft
<picsItem>
<itemNumber>RVCCLEANM.S.A0000</itemNumber>
<feature>Does the device implement the SupportedModes attribute?</feature>
<reference>89.2.2. Attributes - allclusters.html[pdf]</reference>
<reference>99.2.1. Attributes - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">M</status>
<support>true</support>
</picsItem>
<picsItem>
<itemNumber>RVCCLEANM.S.A0001</itemNumber>
<feature>Does the device implement the CurrentMode attribute?</feature>
<reference>89.2.2. Attributes - allclusters.html[pdf]</reference>
<reference>99.2.1. Attributes - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">M</status>
<support>true</support>
</picsItem>
<picsItem>
<itemNumber>RVCCLEANM.S.A0002</itemNumber>
<feature>Does the device implement the StartUpMode attribute?</feature>
<reference>89.2.2. Attributes - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>false</support>
</picsItem>
<picsItem>
<itemNumber>RVCCLEANM.S.A0003</itemNumber>
<feature>Does the device implement the OnMode attribute?</feature>
<reference>89.2.2. Attributes - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S.F00">M</status>
<support>false</support>
</picsItem>
</attributes>
<!--Events PICS write-->
<events/>
Expand All @@ -78,7 +69,7 @@ Draft
<picsItem>
<itemNumber>RVCCLEANM.S.C01.Tx</itemNumber>
<feature>Does the device implement sending the ChangeToModeResponse command?</feature>
<reference>89.2.4. Commands generated - allclusters.html[pdf]</reference>
<reference>99.2.3. Commands generated - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">M</status>
<support>true</support>
</picsItem>
Expand All @@ -88,17 +79,17 @@ Draft
<picsItem>
<itemNumber>RVCCLEANM.S.C00.Rsp</itemNumber>
<feature>Does the device implement receiving the ChangeToMode command?</feature>
<reference>89.2.3. Commands received - allclusters.html[pdf]</reference>
<reference>99.2.2. Commands received - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">M</status>
<support>true</support>
</picsItem>
</commandsReceived>
<!--Features PICS write-->
<features>
<picsItem>
<itemNumber>RVCCLEANM.S.F00</itemNumber>
<feature>Does the device support depending on an On/Off cluster implemented on the same endpoint?</feature>
<reference>89.2.1. Features - allclusters.html[pdf]</reference>
<itemNumber>RVCCLEANM.S.F16</itemNumber>
<feature>Does the device support changing clean modes from non-Idle states?</feature>
<reference>101.1. Features - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>false</support>
</picsItem>
Expand All @@ -108,10 +99,17 @@ Draft
<picsItem>
<itemNumber>RVCCLEANM.S.M.CAN_TEST_MODE_FAILURE</itemNumber>
<feature>Does the DUT support testing the failed ChangeToMode command?</feature>
<reference>89.2.5. Manual controllable - allclusters.html[pdf]</reference>
<reference>99.2.4. Manual controllable - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>true</support>
</picsItem>
<picsItem>
<itemNumber>RVCCLEANM.S.M.CAN_MANUALLY_CONTROLLED</itemNumber>
<feature>Can the mode change be manually controlled?</feature>
<reference>99.2.4. Manual controllable - allclusters.html[pdf]</reference>
<status cond="RVCCLEANM.S">O</status>
<support>false</support>
</picsItem>
</manually>
</clusterSide>
<!--Client side PICS-->
Expand Down
Loading

0 comments on commit 9393f7a

Please sign in to comment.