Skip to content

Commit

Permalink
Regenerated the datamodel files
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs committed Jan 11, 2024
1 parent a51831f commit 9d0b14e
Show file tree
Hide file tree
Showing 25 changed files with 432 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19011,6 +19011,7 @@ public static class IcdManagementCluster extends BaseChipCluster {
private static final long CLIENTS_SUPPORTED_PER_FABRIC_ATTRIBUTE_ID = 5L;
private static final long USER_ACTIVE_MODE_TRIGGER_HINT_ATTRIBUTE_ID = 6L;
private static final long USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID = 7L;
private static final long OPERATING_MODE_ATTRIBUTE_ID = 8L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
Expand Down Expand Up @@ -19353,6 +19354,31 @@ public void onSuccess(byte[] tlv) {
}, USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readOperatingModeAttribute(
IntegerAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPERATING_MODE_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, OPERATING_MODE_ATTRIBUTE_ID, true);
}

public void subscribeOperatingModeAttribute(
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPERATING_MODE_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, OPERATING_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readGeneratedCommandListAttribute(
GeneratedCommandListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6035,6 +6035,7 @@ public enum Attribute {
ClientsSupportedPerFabric(5L),
UserActiveModeTriggerHint(6L),
UserActiveModeTriggerInstruction(7L),
OperatingMode(8L),
GeneratedCommandList(65528L),
AcceptedCommandList(65529L),
EventList(65530L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5950,6 +5950,17 @@ private static Map<String, InteractionInfo> readIcdManagementInteractionInfo() {
readIcdManagementUserActiveModeTriggerInstructionCommandParams
);
result.put("readUserActiveModeTriggerInstructionAttribute", readIcdManagementUserActiveModeTriggerInstructionAttributeInteractionInfo);
Map<String, CommandParameterInfo> readIcdManagementOperatingModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readIcdManagementOperatingModeAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.IcdManagementCluster) cluster).readOperatingModeAttribute(
(ChipClusters.IntegerAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readIcdManagementOperatingModeCommandParams
);
result.put("readOperatingModeAttribute", readIcdManagementOperatingModeAttributeInteractionInfo);
Map<String, CommandParameterInfo> readIcdManagementGeneratedCommandListCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readIcdManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import matter.controller.ReadRequest
import matter.controller.StringSubscriptionState
import matter.controller.SubscribeRequest
import matter.controller.SubscriptionState
import matter.controller.UByteSubscriptionState
import matter.controller.UIntSubscriptionState
import matter.controller.UShortSubscriptionState
import matter.controller.cluster.structs.*
Expand Down Expand Up @@ -964,6 +965,97 @@ class IcdManagementCluster(
}
}

suspend fun readOperatingModeAttribute(): UByte? {
val ATTRIBUTE_ID: UInt = 8u

val attributePath =
AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)

val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))

val response = controller.read(readRequest)

if (response.successes.isEmpty()) {
logger.log(Level.WARNING, "Read command failed")
throw IllegalStateException("Read command failed with failures: ${response.failures}")
}

logger.log(Level.FINE, "Read command succeeded")

val attributeData =
response.successes.filterIsInstance<ReadData.Attribute>().firstOrNull {
it.path.attributeId == ATTRIBUTE_ID
}

requireNotNull(attributeData) { "Operatingmode attribute not found in response" }

// Decode the TLV data into the appropriate type
val tlvReader = TlvReader(attributeData.data)
val decodedValue: UByte? =
if (tlvReader.isNextTag(AnonymousTag)) {
tlvReader.getUByte(AnonymousTag)
} else {
null
}

return decodedValue
}

suspend fun subscribeOperatingModeAttribute(
minInterval: Int,
maxInterval: Int
): Flow<UByteSubscriptionState> {
val ATTRIBUTE_ID: UInt = 8u
val attributePaths =
listOf(
AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
)

val subscribeRequest: SubscribeRequest =
SubscribeRequest(
eventPaths = emptyList(),
attributePaths = attributePaths,
minInterval = Duration.ofSeconds(minInterval.toLong()),
maxInterval = Duration.ofSeconds(maxInterval.toLong())
)

return controller.subscribe(subscribeRequest).transform { subscriptionState ->
when (subscriptionState) {
is SubscriptionState.SubscriptionErrorNotification -> {
emit(
UByteSubscriptionState.Error(
Exception(
"Subscription terminated with error code: ${subscriptionState.terminationCause}"
)
)
)
}
is SubscriptionState.NodeStateUpdate -> {
val attributeData =
subscriptionState.updateState.successes
.filterIsInstance<ReadData.Attribute>()
.firstOrNull { it.path.attributeId == ATTRIBUTE_ID }

requireNotNull(attributeData) { "Operatingmode attribute not found in Node State update" }

// Decode the TLV data into the appropriate type
val tlvReader = TlvReader(attributeData.data)
val decodedValue: UByte? =
if (tlvReader.isNextTag(AnonymousTag)) {
tlvReader.getUByte(AnonymousTag)
} else {
null
}

decodedValue?.let { emit(UByteSubscriptionState.Success(it)) }
}
SubscriptionState.SubscriptionEstablished -> {
emit(UByteSubscriptionState.SubscriptionEstablished)
}
}
}
}

suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
val ATTRIBUTE_ID: UInt = 65528u

Expand Down
16 changes: 16 additions & 0 deletions src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/controller/python/chip/clusters/CHIPClusters.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/controller/python/chip/clusters/Objects.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/darwin/Framework/CHIP/templates/availability.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8550,6 +8550,8 @@
- AliroBLEAdvertisingVersion
- NumberOfAliroCredentialIssuerKeysSupported
- NumberOfAliroEndpointKeysSupported
ICDManagement:
- OperatingMode
commands:
DoorLock:
# Aliro is not ready yet.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusters.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9d0b14e

Please sign in to comment.