Skip to content

Commit d853f33

Browse files
committed
Added missed generated files.
1 parent 024714e commit d853f33

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package chip.devicecontroller.cluster.structs
18+
19+
import chip.devicecontroller.cluster.*
20+
import matter.tlv.ContextSpecificTag
21+
import matter.tlv.Tag
22+
import matter.tlv.TlvReader
23+
import matter.tlv.TlvWriter
24+
25+
class BasicInformationClusterHomeLocationStruct(
26+
val locationName: String,
27+
val floorNumber: Int?,
28+
val areaType: UInt?,
29+
) {
30+
override fun toString(): String = buildString {
31+
append("BasicInformationClusterHomeLocationStruct {\n")
32+
append("\tlocationName : $locationName\n")
33+
append("\tfloorNumber : $floorNumber\n")
34+
append("\tareaType : $areaType\n")
35+
append("}\n")
36+
}
37+
38+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
39+
tlvWriter.apply {
40+
startStructure(tlvTag)
41+
put(ContextSpecificTag(TAG_LOCATION_NAME), locationName)
42+
if (floorNumber != null) {
43+
put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber)
44+
} else {
45+
putNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
46+
}
47+
if (areaType != null) {
48+
put(ContextSpecificTag(TAG_AREA_TYPE), areaType)
49+
} else {
50+
putNull(ContextSpecificTag(TAG_AREA_TYPE))
51+
}
52+
endStructure()
53+
}
54+
}
55+
56+
companion object {
57+
private const val TAG_LOCATION_NAME = 0
58+
private const val TAG_FLOOR_NUMBER = 1
59+
private const val TAG_AREA_TYPE = 2
60+
61+
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): BasicInformationClusterHomeLocationStruct {
62+
tlvReader.enterStructure(tlvTag)
63+
val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
64+
val floorNumber =
65+
if (!tlvReader.isNull()) {
66+
tlvReader.getInt(ContextSpecificTag(TAG_FLOOR_NUMBER))
67+
} else {
68+
tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
69+
null
70+
}
71+
val areaType =
72+
if (!tlvReader.isNull()) {
73+
tlvReader.getUInt(ContextSpecificTag(TAG_AREA_TYPE))
74+
} else {
75+
tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE))
76+
null
77+
}
78+
79+
tlvReader.exitContainer()
80+
81+
return BasicInformationClusterHomeLocationStruct(locationName, floorNumber, areaType)
82+
}
83+
}
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package matter.controller.cluster.structs
18+
19+
import matter.controller.cluster.*
20+
import matter.tlv.ContextSpecificTag
21+
import matter.tlv.Tag
22+
import matter.tlv.TlvReader
23+
import matter.tlv.TlvWriter
24+
25+
class BasicInformationClusterHomeLocationStruct(
26+
val locationName: String,
27+
val floorNumber: Short?,
28+
val areaType: UByte?,
29+
) {
30+
override fun toString(): String = buildString {
31+
append("BasicInformationClusterHomeLocationStruct {\n")
32+
append("\tlocationName : $locationName\n")
33+
append("\tfloorNumber : $floorNumber\n")
34+
append("\tareaType : $areaType\n")
35+
append("}\n")
36+
}
37+
38+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
39+
tlvWriter.apply {
40+
startStructure(tlvTag)
41+
put(ContextSpecificTag(TAG_LOCATION_NAME), locationName)
42+
if (floorNumber != null) {
43+
put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber)
44+
} else {
45+
putNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
46+
}
47+
if (areaType != null) {
48+
put(ContextSpecificTag(TAG_AREA_TYPE), areaType)
49+
} else {
50+
putNull(ContextSpecificTag(TAG_AREA_TYPE))
51+
}
52+
endStructure()
53+
}
54+
}
55+
56+
companion object {
57+
private const val TAG_LOCATION_NAME = 0
58+
private const val TAG_FLOOR_NUMBER = 1
59+
private const val TAG_AREA_TYPE = 2
60+
61+
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): BasicInformationClusterHomeLocationStruct {
62+
tlvReader.enterStructure(tlvTag)
63+
val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
64+
val floorNumber =
65+
if (!tlvReader.isNull()) {
66+
tlvReader.getShort(ContextSpecificTag(TAG_FLOOR_NUMBER))
67+
} else {
68+
tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
69+
null
70+
}
71+
val areaType =
72+
if (!tlvReader.isNull()) {
73+
tlvReader.getUByte(ContextSpecificTag(TAG_AREA_TYPE))
74+
} else {
75+
tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE))
76+
null
77+
}
78+
79+
tlvReader.exitContainer()
80+
81+
return BasicInformationClusterHomeLocationStruct(locationName, floorNumber, areaType)
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)