Skip to content

Commit db5fc35

Browse files
Add missing Kotlin generated files
1 parent ce37516 commit db5fc35

File tree

2 files changed

+128
-0
lines changed

2 files changed

+128
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 OccupancySensingClusterHoldTimeLimitsStruct(
26+
val holdTimeMin: UInt,
27+
val holdTimeMax: UInt,
28+
val holdTimeDefault: UInt,
29+
) {
30+
override fun toString(): String = buildString {
31+
append("OccupancySensingClusterHoldTimeLimitsStruct {\n")
32+
append("\tholdTimeMin : $holdTimeMin\n")
33+
append("\tholdTimeMax : $holdTimeMax\n")
34+
append("\tholdTimeDefault : $holdTimeDefault\n")
35+
append("}\n")
36+
}
37+
38+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
39+
tlvWriter.apply {
40+
startStructure(tlvTag)
41+
put(ContextSpecificTag(TAG_HOLD_TIME_MIN), holdTimeMin)
42+
put(ContextSpecificTag(TAG_HOLD_TIME_MAX), holdTimeMax)
43+
put(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT), holdTimeDefault)
44+
endStructure()
45+
}
46+
}
47+
48+
companion object {
49+
private const val TAG_HOLD_TIME_MIN = 0
50+
private const val TAG_HOLD_TIME_MAX = 1
51+
private const val TAG_HOLD_TIME_DEFAULT = 2
52+
53+
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OccupancySensingClusterHoldTimeLimitsStruct {
54+
tlvReader.enterStructure(tlvTag)
55+
val holdTimeMin = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_MIN))
56+
val holdTimeMax = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_MAX))
57+
val holdTimeDefault = tlvReader.getUInt(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT))
58+
59+
tlvReader.exitContainer()
60+
61+
return OccupancySensingClusterHoldTimeLimitsStruct(holdTimeMin, holdTimeMax, holdTimeDefault)
62+
}
63+
}
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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 OccupancySensingClusterHoldTimeLimitsStruct(
26+
val holdTimeMin: UShort,
27+
val holdTimeMax: UShort,
28+
val holdTimeDefault: UShort,
29+
) {
30+
override fun toString(): String = buildString {
31+
append("OccupancySensingClusterHoldTimeLimitsStruct {\n")
32+
append("\tholdTimeMin : $holdTimeMin\n")
33+
append("\tholdTimeMax : $holdTimeMax\n")
34+
append("\tholdTimeDefault : $holdTimeDefault\n")
35+
append("}\n")
36+
}
37+
38+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
39+
tlvWriter.apply {
40+
startStructure(tlvTag)
41+
put(ContextSpecificTag(TAG_HOLD_TIME_MIN), holdTimeMin)
42+
put(ContextSpecificTag(TAG_HOLD_TIME_MAX), holdTimeMax)
43+
put(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT), holdTimeDefault)
44+
endStructure()
45+
}
46+
}
47+
48+
companion object {
49+
private const val TAG_HOLD_TIME_MIN = 0
50+
private const val TAG_HOLD_TIME_MAX = 1
51+
private const val TAG_HOLD_TIME_DEFAULT = 2
52+
53+
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OccupancySensingClusterHoldTimeLimitsStruct {
54+
tlvReader.enterStructure(tlvTag)
55+
val holdTimeMin = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_MIN))
56+
val holdTimeMax = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_MAX))
57+
val holdTimeDefault = tlvReader.getUShort(ContextSpecificTag(TAG_HOLD_TIME_DEFAULT))
58+
59+
tlvReader.exitContainer()
60+
61+
return OccupancySensingClusterHoldTimeLimitsStruct(holdTimeMin, holdTimeMax, holdTimeDefault)
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)