-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e5488b
commit 9708e5d
Showing
4 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...ip/devicecontroller/cluster/eventstructs/WaterHeaterManagementClusterBoostStartedEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package chip.devicecontroller.cluster.eventstructs | ||
|
||
import chip.devicecontroller.cluster.* | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class WaterHeaterManagementClusterBoostStartedEvent( | ||
val boostInfo: | ||
chip.devicecontroller.cluster.structs.WaterHeaterManagementClusterWaterHeaterBoostInfoStruct | ||
) { | ||
override fun toString(): String = buildString { | ||
append("WaterHeaterManagementClusterBoostStartedEvent {\n") | ||
append("\tboostInfo : $boostInfo\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
boostInfo.toTlv(ContextSpecificTag(TAG_BOOST_INFO), this) | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_BOOST_INFO = 0 | ||
|
||
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterManagementClusterBoostStartedEvent { | ||
tlvReader.enterStructure(tlvTag) | ||
val boostInfo = | ||
chip.devicecontroller.cluster.structs.WaterHeaterManagementClusterWaterHeaterBoostInfoStruct | ||
.fromTlv(ContextSpecificTag(TAG_BOOST_INFO), tlvReader) | ||
|
||
tlvReader.exitContainer() | ||
|
||
return WaterHeaterManagementClusterBoostStartedEvent(boostInfo) | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
...evicecontroller/cluster/structs/WaterHeaterManagementClusterWaterHeaterBoostInfoStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package chip.devicecontroller.cluster.structs | ||
|
||
import chip.devicecontroller.cluster.* | ||
import java.util.Optional | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class WaterHeaterManagementClusterWaterHeaterBoostInfoStruct( | ||
val duration: ULong, | ||
val oneShot: Optional<Boolean>, | ||
val emergencyBoost: Optional<Boolean>, | ||
val temporarySetpoint: Optional<Int>, | ||
val targetPercentage: Optional<UInt>, | ||
val targetReheat: Optional<UInt>, | ||
) { | ||
override fun toString(): String = buildString { | ||
append("WaterHeaterManagementClusterWaterHeaterBoostInfoStruct {\n") | ||
append("\tduration : $duration\n") | ||
append("\toneShot : $oneShot\n") | ||
append("\temergencyBoost : $emergencyBoost\n") | ||
append("\ttemporarySetpoint : $temporarySetpoint\n") | ||
append("\ttargetPercentage : $targetPercentage\n") | ||
append("\ttargetReheat : $targetReheat\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
put(ContextSpecificTag(TAG_DURATION), duration) | ||
if (oneShot.isPresent) { | ||
val optoneShot = oneShot.get() | ||
put(ContextSpecificTag(TAG_ONE_SHOT), optoneShot) | ||
} | ||
if (emergencyBoost.isPresent) { | ||
val optemergencyBoost = emergencyBoost.get() | ||
put(ContextSpecificTag(TAG_EMERGENCY_BOOST), optemergencyBoost) | ||
} | ||
if (temporarySetpoint.isPresent) { | ||
val opttemporarySetpoint = temporarySetpoint.get() | ||
put(ContextSpecificTag(TAG_TEMPORARY_SETPOINT), opttemporarySetpoint) | ||
} | ||
if (targetPercentage.isPresent) { | ||
val opttargetPercentage = targetPercentage.get() | ||
put(ContextSpecificTag(TAG_TARGET_PERCENTAGE), opttargetPercentage) | ||
} | ||
if (targetReheat.isPresent) { | ||
val opttargetReheat = targetReheat.get() | ||
put(ContextSpecificTag(TAG_TARGET_REHEAT), opttargetReheat) | ||
} | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_DURATION = 0 | ||
private const val TAG_ONE_SHOT = 1 | ||
private const val TAG_EMERGENCY_BOOST = 2 | ||
private const val TAG_TEMPORARY_SETPOINT = 3 | ||
private const val TAG_TARGET_PERCENTAGE = 4 | ||
private const val TAG_TARGET_REHEAT = 5 | ||
|
||
fun fromTlv( | ||
tlvTag: Tag, | ||
tlvReader: TlvReader, | ||
): WaterHeaterManagementClusterWaterHeaterBoostInfoStruct { | ||
tlvReader.enterStructure(tlvTag) | ||
val duration = tlvReader.getULong(ContextSpecificTag(TAG_DURATION)) | ||
val oneShot = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_ONE_SHOT))) { | ||
Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_ONE_SHOT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val emergencyBoost = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_EMERGENCY_BOOST))) { | ||
Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_EMERGENCY_BOOST))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val temporarySetpoint = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPORARY_SETPOINT))) { | ||
Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_TEMPORARY_SETPOINT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val targetPercentage = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_PERCENTAGE))) { | ||
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_PERCENTAGE))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val targetReheat = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_REHEAT))) { | ||
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TARGET_REHEAT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
|
||
tlvReader.exitContainer() | ||
|
||
return WaterHeaterManagementClusterWaterHeaterBoostInfoStruct( | ||
duration, | ||
oneShot, | ||
emergencyBoost, | ||
temporarySetpoint, | ||
targetPercentage, | ||
targetReheat, | ||
) | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...a/matter/controller/cluster/eventstructs/WaterHeaterManagementClusterBoostStartedEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package matter.controller.cluster.eventstructs | ||
|
||
import matter.controller.cluster.* | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class WaterHeaterManagementClusterBoostStartedEvent( | ||
val boostInfo: | ||
matter.controller.cluster.structs.WaterHeaterManagementClusterWaterHeaterBoostInfoStruct | ||
) { | ||
override fun toString(): String = buildString { | ||
append("WaterHeaterManagementClusterBoostStartedEvent {\n") | ||
append("\tboostInfo : $boostInfo\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
boostInfo.toTlv(ContextSpecificTag(TAG_BOOST_INFO), this) | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_BOOST_INFO = 0 | ||
|
||
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): WaterHeaterManagementClusterBoostStartedEvent { | ||
tlvReader.enterStructure(tlvTag) | ||
val boostInfo = | ||
matter.controller.cluster.structs.WaterHeaterManagementClusterWaterHeaterBoostInfoStruct | ||
.fromTlv(ContextSpecificTag(TAG_BOOST_INFO), tlvReader) | ||
|
||
tlvReader.exitContainer() | ||
|
||
return WaterHeaterManagementClusterBoostStartedEvent(boostInfo) | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
...tter/controller/cluster/structs/WaterHeaterManagementClusterWaterHeaterBoostInfoStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package matter.controller.cluster.structs | ||
|
||
import java.util.Optional | ||
import matter.controller.cluster.* | ||
import matter.tlv.ContextSpecificTag | ||
import matter.tlv.Tag | ||
import matter.tlv.TlvReader | ||
import matter.tlv.TlvWriter | ||
|
||
class WaterHeaterManagementClusterWaterHeaterBoostInfoStruct( | ||
val duration: UInt, | ||
val oneShot: Optional<Boolean>, | ||
val emergencyBoost: Optional<Boolean>, | ||
val temporarySetpoint: Optional<Short>, | ||
val targetPercentage: Optional<UByte>, | ||
val targetReheat: Optional<UByte>, | ||
) { | ||
override fun toString(): String = buildString { | ||
append("WaterHeaterManagementClusterWaterHeaterBoostInfoStruct {\n") | ||
append("\tduration : $duration\n") | ||
append("\toneShot : $oneShot\n") | ||
append("\temergencyBoost : $emergencyBoost\n") | ||
append("\ttemporarySetpoint : $temporarySetpoint\n") | ||
append("\ttargetPercentage : $targetPercentage\n") | ||
append("\ttargetReheat : $targetReheat\n") | ||
append("}\n") | ||
} | ||
|
||
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { | ||
tlvWriter.apply { | ||
startStructure(tlvTag) | ||
put(ContextSpecificTag(TAG_DURATION), duration) | ||
if (oneShot.isPresent) { | ||
val optoneShot = oneShot.get() | ||
put(ContextSpecificTag(TAG_ONE_SHOT), optoneShot) | ||
} | ||
if (emergencyBoost.isPresent) { | ||
val optemergencyBoost = emergencyBoost.get() | ||
put(ContextSpecificTag(TAG_EMERGENCY_BOOST), optemergencyBoost) | ||
} | ||
if (temporarySetpoint.isPresent) { | ||
val opttemporarySetpoint = temporarySetpoint.get() | ||
put(ContextSpecificTag(TAG_TEMPORARY_SETPOINT), opttemporarySetpoint) | ||
} | ||
if (targetPercentage.isPresent) { | ||
val opttargetPercentage = targetPercentage.get() | ||
put(ContextSpecificTag(TAG_TARGET_PERCENTAGE), opttargetPercentage) | ||
} | ||
if (targetReheat.isPresent) { | ||
val opttargetReheat = targetReheat.get() | ||
put(ContextSpecificTag(TAG_TARGET_REHEAT), opttargetReheat) | ||
} | ||
endStructure() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val TAG_DURATION = 0 | ||
private const val TAG_ONE_SHOT = 1 | ||
private const val TAG_EMERGENCY_BOOST = 2 | ||
private const val TAG_TEMPORARY_SETPOINT = 3 | ||
private const val TAG_TARGET_PERCENTAGE = 4 | ||
private const val TAG_TARGET_REHEAT = 5 | ||
|
||
fun fromTlv( | ||
tlvTag: Tag, | ||
tlvReader: TlvReader, | ||
): WaterHeaterManagementClusterWaterHeaterBoostInfoStruct { | ||
tlvReader.enterStructure(tlvTag) | ||
val duration = tlvReader.getUInt(ContextSpecificTag(TAG_DURATION)) | ||
val oneShot = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_ONE_SHOT))) { | ||
Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_ONE_SHOT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val emergencyBoost = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_EMERGENCY_BOOST))) { | ||
Optional.of(tlvReader.getBoolean(ContextSpecificTag(TAG_EMERGENCY_BOOST))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val temporarySetpoint = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TEMPORARY_SETPOINT))) { | ||
Optional.of(tlvReader.getShort(ContextSpecificTag(TAG_TEMPORARY_SETPOINT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val targetPercentage = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_PERCENTAGE))) { | ||
Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TARGET_PERCENTAGE))) | ||
} else { | ||
Optional.empty() | ||
} | ||
val targetReheat = | ||
if (tlvReader.isNextTag(ContextSpecificTag(TAG_TARGET_REHEAT))) { | ||
Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_TARGET_REHEAT))) | ||
} else { | ||
Optional.empty() | ||
} | ||
|
||
tlvReader.exitContainer() | ||
|
||
return WaterHeaterManagementClusterWaterHeaterBoostInfoStruct( | ||
duration, | ||
oneShot, | ||
emergencyBoost, | ||
temporarySetpoint, | ||
targetPercentage, | ||
targetReheat, | ||
) | ||
} | ||
} | ||
} |