Skip to content

Commit

Permalink
Updated the PositionTag and AreaDesc field names in the SDK server co…
Browse files Browse the repository at this point in the history
…de and test scripts.
  • Loading branch information
hicklin committed Aug 20, 2024
1 parent 883f280 commit ddb307b
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 103 deletions.
114 changes: 57 additions & 57 deletions data_model/master/clusters/ServiceArea.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
<?xml version="1.0"?>
<!--
Copyright (C) Connectivity Standards Alliance (2024). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
<!--
Copyright (C) Connectivity Standards Alliance (2024). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
-->
<cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd cluster cluster.xsd" id="0x0150" name="Service Area Cluster" revision="1">
<revisionHistory>
Expand Down Expand Up @@ -113,15 +113,15 @@ Davis, CA 95616, USA
<mandatoryConform/>
<constraint type="desc"/>
</field>
<field id="2" name="AreaDesc" type="AreaInfoStruct" default="MS">
<field id="2" name="AreaInfo" type="AreaInfoStruct" default="MS">
<mandatoryConform/>
</field>
</struct>
<struct name="LandmarkInfoStruct">
<field id="0" name="LandmarkTag" type="tag">
<mandatoryConform/>
</field>
<field id="1" name="PositionTag" type="tag">
<field id="1" name="RelativePositionTag" type="tag">
<quality nullable="true"/>
<mandatoryConform/>
</field>
Expand Down
4 changes: 2 additions & 2 deletions examples/rvc-app/linux/RvcAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ void RvcAppCommandHandler::OnAddServiceAreaArea(Json::Value jsonValue)
if (jsonValue.isMember("LandmarkTag"))
{
DataModel::Nullable<Globals::RelativePositionTag> relativePositionTag = DataModel::NullNullable;
if (jsonValue.isMember("PositionTag"))
if (jsonValue.isMember("RelativePositionTag"))
{
relativePositionTag = Globals::RelativePositionTag(jsonValue["PositionTag"].asUInt());
relativePositionTag = Globals::RelativePositionTag(jsonValue["RelativePositionTag"].asUInt());
}

area.SetLandmarkInfo(Globals::LandmarkTag(jsonValue["LandmarkTag"].asUInt()), relativePositionTag);
Expand Down
50 changes: 25 additions & 25 deletions src/app/clusters/service-area-server/service-area-cluster-objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
{
areaID = aOther.areaID;
mapID = aOther.mapID;
SetLocationInfo(aOther.areaDesc.locationInfo);
SetLandmarkInfo(aOther.areaDesc.landmarkInfo);
SetLocationInfo(aOther.areaInfo.locationInfo);
SetLandmarkInfo(aOther.areaInfo.landmarkInfo);

return *this;
}
Expand All @@ -95,7 +95,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::

AreaStructureWrapper & SetLocationInfoNull()
{
areaDesc.locationInfo.SetNull();
areaInfo.locationInfo.SetNull();
return *this;
}

Expand All @@ -108,13 +108,13 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
AreaStructureWrapper & SetLocationInfo(const CharSpan & locationName, const DataModel::Nullable<int16_t> & floorNumber,
const DataModel::Nullable<Globals::AreaTypeTag> & areaType)
{
areaDesc.locationInfo.SetNonNull();
areaInfo.locationInfo.SetNonNull();
// Copy the name
auto sizeToCopy = std::min(sizeof(mAreaNameBuffer), locationName.size());
memcpy(mAreaNameBuffer, locationName.data(), sizeToCopy);
areaDesc.locationInfo.Value().locationName = CharSpan(mAreaNameBuffer, sizeToCopy);
areaDesc.locationInfo.Value().floorNumber = floorNumber;
areaDesc.locationInfo.Value().areaType = areaType;
areaInfo.locationInfo.Value().locationName = CharSpan(mAreaNameBuffer, sizeToCopy);
areaInfo.locationInfo.Value().floorNumber = floorNumber;
areaInfo.locationInfo.Value().areaType = areaType;

return *this;
}
Expand All @@ -136,7 +136,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::

AreaStructureWrapper & SetLandmarkInfoNull()
{
areaDesc.landmarkInfo.SetNull();
areaInfo.landmarkInfo.SetNull();
return *this;
}

Expand All @@ -148,9 +148,9 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
AreaStructureWrapper & SetLandmarkInfo(const Globals::LandmarkTag & landmarkTag,
const DataModel::Nullable<Globals::RelativePositionTag> & relativePositionTag)
{
areaDesc.landmarkInfo.SetNonNull();
areaDesc.landmarkInfo.Value().landmarkTag = landmarkTag;
areaDesc.landmarkInfo.Value().positionTag = relativePositionTag;
areaInfo.landmarkInfo.SetNonNull();
areaInfo.landmarkInfo.Value().landmarkTag = landmarkTag;
areaInfo.landmarkInfo.Value().relativePositionTag = relativePositionTag;

return *this;
}
Expand All @@ -165,7 +165,7 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
return SetLandmarkInfoNull();
}

return SetLandmarkInfo(landmarkInfo.Value().landmarkTag, landmarkInfo.Value().positionTag);
return SetLandmarkInfo(landmarkInfo.Value().landmarkTag, landmarkInfo.Value().relativePositionTag);
}

/**
Expand All @@ -176,9 +176,9 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
*/
bool IsNameEqual(const CharSpan & aAreaName) const
{
if (!areaDesc.locationInfo.IsNull())
if (!areaInfo.locationInfo.IsNull())
{
return areaDesc.locationInfo.Value().locationName.data_equal(aAreaName);
return areaInfo.locationInfo.Value().locationName.data_equal(aAreaName);
}

return false;
Expand Down Expand Up @@ -213,43 +213,43 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
return false;
}

if (areaDesc.locationInfo.IsNull() != aOther.areaDesc.locationInfo.IsNull())
if (areaInfo.locationInfo.IsNull() != aOther.areaInfo.locationInfo.IsNull())
{
return false;
}

if (!areaDesc.locationInfo.IsNull())
if (!areaInfo.locationInfo.IsNull())
{

if (!IsNameEqual(aOther.areaDesc.locationInfo.Value().locationName))
if (!IsNameEqual(aOther.areaInfo.locationInfo.Value().locationName))
{
return false;
}

if (areaDesc.locationInfo.Value().floorNumber != aOther.areaDesc.locationInfo.Value().floorNumber)
if (areaInfo.locationInfo.Value().floorNumber != aOther.areaInfo.locationInfo.Value().floorNumber)
{
return false;
}

if (areaDesc.locationInfo.Value().areaType != aOther.areaDesc.locationInfo.Value().areaType)
if (areaInfo.locationInfo.Value().areaType != aOther.areaInfo.locationInfo.Value().areaType)
{
return false;
}
}

if (areaDesc.landmarkInfo.IsNull() != aOther.areaDesc.landmarkInfo.IsNull())
if (areaInfo.landmarkInfo.IsNull() != aOther.areaInfo.landmarkInfo.IsNull())
{
return false;
}

if (!areaDesc.landmarkInfo.IsNull())
if (!areaInfo.landmarkInfo.IsNull())
{
if (areaDesc.landmarkInfo.Value().landmarkTag != aOther.areaDesc.landmarkInfo.Value().landmarkTag)
if (areaInfo.landmarkInfo.Value().landmarkTag != aOther.areaInfo.landmarkInfo.Value().landmarkTag)
{
return false;
}

if (areaDesc.landmarkInfo.Value().positionTag != aOther.areaDesc.landmarkInfo.Value().positionTag)
if (areaInfo.landmarkInfo.Value().relativePositionTag != aOther.areaInfo.landmarkInfo.Value().relativePositionTag)
{
return false;
}
Expand All @@ -263,12 +263,12 @@ struct AreaStructureWrapper : public chip::app::Clusters::ServiceArea::Structs::
*/
CharSpan GetName()
{
if (areaDesc.locationInfo.IsNull())
if (areaInfo.locationInfo.IsNull())
{
return { mAreaNameBuffer, 0 };
}

return areaDesc.locationInfo.Value().locationName;
return areaInfo.locationInfo.Value().locationName;
}

private:
Expand Down
8 changes: 4 additions & 4 deletions src/app/clusters/service-area-server/service-area-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,18 @@ bool Instance::IsValidSupportedArea(const AreaStructureWrapper & aArea)
{
// If the LocationInfo field is null, the LandmarkInfo field SHALL NOT be null.
// If the LandmarkInfo field is null, the LocationInfo field SHALL NOT be null.
if (aArea.areaDesc.locationInfo.IsNull() && aArea.areaDesc.landmarkInfo.IsNull())
if (aArea.areaInfo.locationInfo.IsNull() && aArea.areaInfo.landmarkInfo.IsNull())
{
ChipLogDetail(Zcl, "IsValidAsSupportedArea %u - must have locationInfo and/or LandmarkInfo", aArea.areaID);
return false;
}

// If LocationInfo is not null, and its LocationName field is an empty string, at least one of the following SHALL NOT
// be null: LocationInfo's FloorNumber field, LocationInfo's AreaType field, the LandmarkInfo
if (!aArea.areaDesc.locationInfo.IsNull())
if (!aArea.areaInfo.locationInfo.IsNull())
{
if (aArea.areaDesc.locationInfo.Value().locationName.empty() && aArea.areaDesc.locationInfo.Value().floorNumber.IsNull() &&
aArea.areaDesc.locationInfo.Value().areaType.IsNull() && aArea.areaDesc.landmarkInfo.IsNull())
if (aArea.areaInfo.locationInfo.Value().locationName.empty() && aArea.areaInfo.locationInfo.Value().floorNumber.IsNull() &&
aArea.areaInfo.locationInfo.Value().areaType.IsNull() && aArea.areaInfo.landmarkInfo.IsNull())
{
ChipLogDetail(Zcl, "IsValidAsSupportedArea %u - AreaName is empty string, FloorNumber, AreaType, LandmarkInfo are null",
aArea.areaID);
Expand Down
30 changes: 15 additions & 15 deletions src/python_testing/TC_SEAR_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def read_and_validate_supported_areas(self, step):
asserts.assert_less_equal(len(supported_areas), 255,
"SupportedAreas should have max 255 entries")
areaid_list = []
areadesc_s = set()
areainfo_s = set()
for a in supported_areas:
asserts.assert_true(a.areaID not in areaid_list, "SupportedAreas must have unique AreaID values!")

Expand All @@ -91,27 +91,27 @@ async def read_and_validate_supported_areas(self, step):
f"SupportedAreas entry with AreaID({a.areaID}) should not have null MapID")
asserts.assert_true(a.mapID in self.mapid_list,
f"SupportedAreas entry with AreaID({a.areaID}) has unknown MapID({a.mapID})")
k = f"mapID:{a.mapID} areaDesc:{a.areaDesc}"
asserts.assert_true(k not in areadesc_s,
f"SupportedAreas must have unique MapID({a.mapID}) + AreaDesc({a.areaDesc}) values!")
areadesc_s.add(k)
k = f"mapID:{a.mapID} areaInfo:{a.areaInfo}"
asserts.assert_true(k not in areainfo_s,
f"SupportedAreas must have unique MapID({a.mapID}) + AreaInfo({a.areaInfo}) values!")
areainfo_s.add(k)
else:
# empty SupportedMaps
asserts.assert_is(a.mapID, NullValue,
f"SupportedAreas entry with AreaID({a.areaID}) should have null MapID")
k = f"areaDesc:{a.areaDesc}"
asserts.assert_true(k not in areadesc_s, f"SupportedAreas must have unique AreaDesc({a.areaDesc}) values!")
areadesc_s.add(k)
k = f"areaInfo:{a.areaInfo}"
asserts.assert_true(k not in areainfo_s, f"SupportedAreas must have unique AreaInfo({a.areaInfo}) values!")
areainfo_s.add(k)

if a.areaDesc.locationInfo is NullValue and a.areaDesc.landmarkInfo is NullValue:
if a.areaInfo.locationInfo is NullValue and a.areaInfo.landmarkInfo is NullValue:
asserts.assert_true(
f"SupportedAreas entry with AreaID({a.areaID}) should not have null LocationInfo and null LandmarkInfo")
if a.areaDesc.landmarkInfo is not NullValue:
asserts.assert_true(a.areaDesc.landmarkInfo.landmarkTag <= self.MAX_LANDMARK_ID,
f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.areaDesc.landmarkInfo.landmarkTag})")
asserts.assert_true(a.areaDesc.landmarkInfo.positionTag is NullValue or a
.areaDesc.landmarkInfo.positionTag in range(0, self.MAX_RELPOS_ID),
f"SupportedAreas entry with AreaID({a.areaID}) has invalid PositionTag({a.areaDesc.landmarkInfo.positionTag})")
if a.areaInfo.landmarkInfo is not NullValue:
asserts.assert_true(a.areaInfo.landmarkInfo.landmarkTag <= self.MAX_LANDMARK_ID,
f"SupportedAreas entry with AreaID({a.areaID}) has invalid LandmarkTag({a.areaInfo.landmarkInfo.landmarkTag})")
asserts.assert_true(a.areaInfo.landmarkInfo.relativePositionTag is NullValue or a
.areaInfo.landmarkInfo.relativePositionTag in range(0, self.MAX_RELPOS_ID),
f"SupportedAreas entry with AreaID({a.areaID}) has invalid RelativePositionTag({a.areaInfo.landmarkInfo.relativePositionTag})")
# save so other methods can use this if needed
self.areaid_list = areaid_list

Expand Down

0 comments on commit ddb307b

Please sign in to comment.