Skip to content

Commit

Permalink
Spec rename of HomeLocationStruct to LocationDescriptorStruct (projec…
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson authored and j-ororke committed Jul 31, 2024
1 parent 140ec48 commit 5eabc59
Show file tree
Hide file tree
Showing 26 changed files with 134 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ limitations under the License.
<struct name="EcosystemLocationStruct" isFabricScoped="true" apiMaturity="provisional">
<cluster code="0x0750"/>
<item fieldId="0" name="UniqueLocationID" type="char_string" isFabricSensitive="true" length="64"/>
<item fieldId="1" name="LocationDescriptor" type="HomeLocationStruct" isFabricSensitive="true"/>
<item fieldId="1" name="LocationDescriptor" type="LocationDescriptorStruct" isFabricSensitive="true"/>
<item fieldId="2" name="LocationDescriptorLastEdit" type="epoch_us" isFabricSensitive="true" default="0"/>
</struct>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ TODO: Make these structures global rather than defining them for each cluster.

<configurator>
<domain name="CHIP"/>
<struct name="HomeLocationStruct">
<struct name="LocationDescriptorStruct">
<cluster code="0x0150"/> <!-- Service Area Cluster -->
<cluster code="0x0750"/> <!-- Ecosystem Information Cluster -->
<!-- TODO: add Basic Information Cluster code="0x0028" -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ limitations under the License.
<domain name="CHIP"/>

Data types
<struct name="LocationInfoStruct">
<struct name="LocationInfoStruct" apiMaturity="provisional">
<cluster code="0x0150"/>
<item name="LocationInfo" type="HomeLocationStruct" optional="false" isNullable="true"/>
<item name="LandmarkTag" type="LandmarkTag" optional="false" isNullable="true"/>
<item name="PositionTag" type="PositionTag" optional="false" isNullable="true"/>
<item name="SurfaceTag" type="FloorSurfaceTag" optional="false" isNullable="true"/>
<item name="LocationInfo" type="LocationDescriptorStruct" optional="false" isNullable="true"/>
<item name="LandmarkTag" type="LandmarkTag" optional="false" isNullable="true"/>
<item name="PositionTag" type="PositionTag" optional="false" isNullable="true"/>
<item name="SurfaceTag" type="FloorSurfaceTag" optional="false" isNullable="true"/>
</struct>

<struct name="MapStruct">
Expand Down Expand Up @@ -71,7 +71,7 @@ limitations under the License.
<item value="0x02" name="InvalidInMode"/>
</enum>

<cluster>
<cluster apiMaturity="provisional">
<domain>General</domain>
<name>Service Area</name>
<description>The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location.</description>
Expand Down
10 changes: 5 additions & 5 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -6133,7 +6133,7 @@ deprecated cluster BarrierControl = 259 {
}

/** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */
cluster ServiceArea = 336 {
provisional cluster ServiceArea = 336 {
revision 1; // NOTE: Default/not specifically set

enum AreaTypeTag : enum8 {
Expand Down Expand Up @@ -6358,14 +6358,14 @@ cluster ServiceArea = 336 {
kSelectWhileRunning = 0x2;
}

struct HomeLocationStruct {
struct LocationDescriptorStruct {
char_string<128> locationName = 0;
nullable int16s floorNumber = 1;
nullable AreaTypeTag areaType = 2;
}

struct LocationInfoStruct {
nullable HomeLocationStruct locationInfo = 0;
nullable LocationDescriptorStruct locationInfo = 0;
nullable LandmarkTag landmarkTag = 1;
nullable PositionTag positionTag = 2;
nullable FloorSurfaceTag surfaceTag = 3;
Expand Down Expand Up @@ -9347,15 +9347,15 @@ provisional cluster EcosystemInformation = 1872 {
kWorkshop = 94;
}

struct HomeLocationStruct {
struct LocationDescriptorStruct {
char_string<128> locationName = 0;
nullable int16s floorNumber = 1;
nullable AreaTypeTag areaType = 2;
}

fabric_scoped struct EcosystemLocationStruct {
fabric_sensitive char_string<64> uniqueLocationID = 0;
fabric_sensitive HomeLocationStruct locationDescriptor = 1;
fabric_sensitive LocationDescriptorStruct locationDescriptor = 1;
fabric_sensitive epoch_us locationDescriptorLastEdit = 2;
fabric_idx fabricIndex = 254;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8943,15 +8943,15 @@ public String toString() {
return output.toString();
}
}
public static class ServiceAreaClusterHomeLocationStruct {
public static class ServiceAreaClusterLocationDescriptorStruct {
public String locationName;
public @Nullable Integer floorNumber;
public @Nullable Integer areaType;
private static final long LOCATION_NAME_ID = 0L;
private static final long FLOOR_NUMBER_ID = 1L;
private static final long AREA_TYPE_ID = 2L;

public ServiceAreaClusterHomeLocationStruct(
public ServiceAreaClusterLocationDescriptorStruct(
String locationName,
@Nullable Integer floorNumber,
@Nullable Integer areaType
Expand All @@ -8970,7 +8970,7 @@ public StructType encodeTlv() {
return new StructType(values);
}

public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValue) {
public static ServiceAreaClusterLocationDescriptorStruct decodeTlv(BaseTLVType tlvValue) {
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
Expand All @@ -8995,7 +8995,7 @@ public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValu
}
}
}
return new ServiceAreaClusterHomeLocationStruct(
return new ServiceAreaClusterLocationDescriptorStruct(
locationName,
floorNumber,
areaType
Expand All @@ -9005,7 +9005,7 @@ public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValu
@Override
public String toString() {
StringBuilder output = new StringBuilder();
output.append("ServiceAreaClusterHomeLocationStruct {\n");
output.append("ServiceAreaClusterLocationDescriptorStruct {\n");
output.append("\tlocationName: ");
output.append(locationName);
output.append("\n");
Expand All @@ -9020,7 +9020,7 @@ public String toString() {
}
}
public static class ServiceAreaClusterLocationInfoStruct {
public @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo;
public @Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo;
public @Nullable Integer landmarkTag;
public @Nullable Integer positionTag;
public @Nullable Integer surfaceTag;
Expand All @@ -9030,7 +9030,7 @@ public static class ServiceAreaClusterLocationInfoStruct {
private static final long SURFACE_TAG_ID = 3L;

public ServiceAreaClusterLocationInfoStruct(
@Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo,
@Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo,
@Nullable Integer landmarkTag,
@Nullable Integer positionTag,
@Nullable Integer surfaceTag
Expand All @@ -9055,15 +9055,15 @@ public static ServiceAreaClusterLocationInfoStruct decodeTlv(BaseTLVType tlvValu
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
@Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo = null;
@Nullable ChipStructs.ServiceAreaClusterLocationDescriptorStruct locationInfo = null;
@Nullable Integer landmarkTag = null;
@Nullable Integer positionTag = null;
@Nullable Integer surfaceTag = null;
for (StructElement element: ((StructType)tlvValue).value()) {
if (element.contextTagNum() == LOCATION_INFO_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Struct) {
StructType castingValue = element.value(StructType.class);
locationInfo = ChipStructs.ServiceAreaClusterHomeLocationStruct.decodeTlv(castingValue);
locationInfo = ChipStructs.ServiceAreaClusterLocationDescriptorStruct.decodeTlv(castingValue);
}
} else if (element.contextTagNum() == LANDMARK_TAG_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
Expand Down Expand Up @@ -12283,15 +12283,15 @@ public String toString() {
return output.toString();
}
}
public static class EcosystemInformationClusterHomeLocationStruct {
public static class EcosystemInformationClusterLocationDescriptorStruct {
public String locationName;
public @Nullable Integer floorNumber;
public @Nullable Integer areaType;
private static final long LOCATION_NAME_ID = 0L;
private static final long FLOOR_NUMBER_ID = 1L;
private static final long AREA_TYPE_ID = 2L;

public EcosystemInformationClusterHomeLocationStruct(
public EcosystemInformationClusterLocationDescriptorStruct(
String locationName,
@Nullable Integer floorNumber,
@Nullable Integer areaType
Expand All @@ -12310,7 +12310,7 @@ public StructType encodeTlv() {
return new StructType(values);
}

public static EcosystemInformationClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValue) {
public static EcosystemInformationClusterLocationDescriptorStruct decodeTlv(BaseTLVType tlvValue) {
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
Expand All @@ -12335,7 +12335,7 @@ public static EcosystemInformationClusterHomeLocationStruct decodeTlv(BaseTLVTyp
}
}
}
return new EcosystemInformationClusterHomeLocationStruct(
return new EcosystemInformationClusterLocationDescriptorStruct(
locationName,
floorNumber,
areaType
Expand All @@ -12345,7 +12345,7 @@ public static EcosystemInformationClusterHomeLocationStruct decodeTlv(BaseTLVTyp
@Override
public String toString() {
StringBuilder output = new StringBuilder();
output.append("EcosystemInformationClusterHomeLocationStruct {\n");
output.append("EcosystemInformationClusterLocationDescriptorStruct {\n");
output.append("\tlocationName: ");
output.append(locationName);
output.append("\n");
Expand All @@ -12361,7 +12361,7 @@ public String toString() {
}
public static class EcosystemInformationClusterEcosystemLocationStruct {
public String uniqueLocationID;
public ChipStructs.EcosystemInformationClusterHomeLocationStruct locationDescriptor;
public ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor;
public Long locationDescriptorLastEdit;
public Integer fabricIndex;
private static final long UNIQUE_LOCATION_I_D_ID = 0L;
Expand All @@ -12371,7 +12371,7 @@ public static class EcosystemInformationClusterEcosystemLocationStruct {

public EcosystemInformationClusterEcosystemLocationStruct(
String uniqueLocationID,
ChipStructs.EcosystemInformationClusterHomeLocationStruct locationDescriptor,
ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor,
Long locationDescriptorLastEdit,
Integer fabricIndex
) {
Expand All @@ -12396,7 +12396,7 @@ public static EcosystemInformationClusterEcosystemLocationStruct decodeTlv(BaseT
return null;
}
String uniqueLocationID = null;
ChipStructs.EcosystemInformationClusterHomeLocationStruct locationDescriptor = null;
ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor = null;
Long locationDescriptorLastEdit = null;
Integer fabricIndex = null;
for (StructElement element: ((StructType)tlvValue).value()) {
Expand All @@ -12408,7 +12408,7 @@ public static EcosystemInformationClusterEcosystemLocationStruct decodeTlv(BaseT
} else if (element.contextTagNum() == LOCATION_DESCRIPTOR_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.Struct) {
StructType castingValue = element.value(StructType.class);
locationDescriptor = ChipStructs.EcosystemInformationClusterHomeLocationStruct.decodeTlv(castingValue);
locationDescriptor = ChipStructs.EcosystemInformationClusterLocationDescriptorStruct.decodeTlv(castingValue);
}
} else if (element.contextTagNum() == LOCATION_DESCRIPTOR_LAST_EDIT_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ structs_sources = [
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterDeviceTypeStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemDeviceStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterHomeLocationStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterLocationDescriptorStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt",
Expand Down Expand Up @@ -120,7 +120,7 @@ structs_sources = [
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationDescriptorStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import matter.tlv.TlvWriter

class EcosystemInformationClusterEcosystemLocationStruct(
val uniqueLocationID: String,
val locationDescriptor: EcosystemInformationClusterHomeLocationStruct,
val locationDescriptor: EcosystemInformationClusterLocationDescriptorStruct,
val locationDescriptorLastEdit: ULong,
val fabricIndex: UInt,
) {
Expand Down Expand Up @@ -61,7 +61,7 @@ class EcosystemInformationClusterEcosystemLocationStruct(
tlvReader.enterStructure(tlvTag)
val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D))
val locationDescriptor =
EcosystemInformationClusterHomeLocationStruct.fromTlv(
EcosystemInformationClusterLocationDescriptorStruct.fromTlv(
ContextSpecificTag(TAG_LOCATION_DESCRIPTOR),
tlvReader,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class EcosystemInformationClusterHomeLocationStruct(
class EcosystemInformationClusterLocationDescriptorStruct(
val locationName: String,
val floorNumber: Int?,
val areaType: UInt?,
) {
override fun toString(): String = buildString {
append("EcosystemInformationClusterHomeLocationStruct {\n")
append("EcosystemInformationClusterLocationDescriptorStruct {\n")
append("\tlocationName : $locationName\n")
append("\tfloorNumber : $floorNumber\n")
append("\tareaType : $areaType\n")
Expand Down Expand Up @@ -58,7 +58,10 @@ class EcosystemInformationClusterHomeLocationStruct(
private const val TAG_FLOOR_NUMBER = 1
private const val TAG_AREA_TYPE = 2

fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EcosystemInformationClusterHomeLocationStruct {
fun fromTlv(
tlvTag: Tag,
tlvReader: TlvReader,
): EcosystemInformationClusterLocationDescriptorStruct {
tlvReader.enterStructure(tlvTag)
val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
val floorNumber =
Expand All @@ -78,7 +81,11 @@ class EcosystemInformationClusterHomeLocationStruct(

tlvReader.exitContainer()

return EcosystemInformationClusterHomeLocationStruct(locationName, floorNumber, areaType)
return EcosystemInformationClusterLocationDescriptorStruct(
locationName,
floorNumber,
areaType,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class ServiceAreaClusterHomeLocationStruct(
class ServiceAreaClusterLocationDescriptorStruct(
val locationName: String,
val floorNumber: Int?,
val areaType: UInt?,
) {
override fun toString(): String = buildString {
append("ServiceAreaClusterHomeLocationStruct {\n")
append("ServiceAreaClusterLocationDescriptorStruct {\n")
append("\tlocationName : $locationName\n")
append("\tfloorNumber : $floorNumber\n")
append("\tareaType : $areaType\n")
Expand Down Expand Up @@ -58,7 +58,7 @@ class ServiceAreaClusterHomeLocationStruct(
private const val TAG_FLOOR_NUMBER = 1
private const val TAG_AREA_TYPE = 2

fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterHomeLocationStruct {
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationDescriptorStruct {
tlvReader.enterStructure(tlvTag)
val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
val floorNumber =
Expand All @@ -78,7 +78,7 @@ class ServiceAreaClusterHomeLocationStruct(

tlvReader.exitContainer()

return ServiceAreaClusterHomeLocationStruct(locationName, floorNumber, areaType)
return ServiceAreaClusterLocationDescriptorStruct(locationName, floorNumber, areaType)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class ServiceAreaClusterLocationInfoStruct(
val locationInfo: ServiceAreaClusterHomeLocationStruct?,
val locationInfo: ServiceAreaClusterLocationDescriptorStruct?,
val landmarkTag: UInt?,
val positionTag: UInt?,
val surfaceTag: UInt?,
Expand Down Expand Up @@ -74,7 +74,7 @@ class ServiceAreaClusterLocationInfoStruct(
tlvReader.enterStructure(tlvTag)
val locationInfo =
if (!tlvReader.isNull()) {
ServiceAreaClusterHomeLocationStruct.fromTlv(
ServiceAreaClusterLocationDescriptorStruct.fromTlv(
ContextSpecificTag(TAG_LOCATION_INFO),
tlvReader,
)
Expand Down
Loading

0 comments on commit 5eabc59

Please sign in to comment.