Skip to content

Commit

Permalink
[ICD] Update ICDM Cluster XML to latest spec (#30559)
Browse files Browse the repository at this point in the history
* Update ICDM cluster xml

* generated files

* Address review comments
Add response to controller and lit icd app xmls

* Generated files

* fix regen
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Feb 12, 2024
1 parent 6106428 commit 1188175
Show file tree
Hide file tree
Showing 26 changed files with 394 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1270,9 +1270,13 @@ server cluster IcdManagement = 70 {
int32u ICDCounter = 0;
}

response struct StayActiveResponse = 4 {
int32u promisedActiveDuration = 0;
}

fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
command access(invoke: manage) StayActiveRequest(): DefaultSuccess = 3;
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
}

endpoint 0 {
Expand Down Expand Up @@ -1572,6 +1576,7 @@ endpoint 0 {
handle command RegisterClientResponse;
handle command UnregisterClient;
handle command StayActiveRequest;
handle command StayActiveResponse;
}
}

Expand Down
8 changes: 8 additions & 0 deletions examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -3364,6 +3364,14 @@
"source": "client",
"isIncoming": 1,
"isEnabled": 1
},
{
"name": "StayActiveResponse",
"code": 4,
"mfgCode": null,
"source": "server",
"isIncoming": 0,
"isEnabled": 1
}
],
"attributes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ server cluster IcdManagement = 70 {

fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
command access(invoke: manage) StayActiveRequest(): DefaultSuccess = 3;
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
}

/** This cluster provides an interface for observing and managing the state of smoke and CO alarms. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,34 @@ limitations under the License.
<attribute side="server" code="0x07" define="USER_ACTIVE_MODE_TRIGGER_INSTRUCTION" type="char_string" length="128" writable="false" optional="true" isNullable="false">UserActiveModeTriggerInstruction</attribute>

<command source="client" code="0x00" name="RegisterClient" response="RegisterClientResponse" isFabricScoped="true" optional="true">
<description> Register a client to the end device </description>
<description>Register a client to the end device</description>
<arg name="CheckInNodeID" type="node_id" optional="false"/>
<arg name="MonitoredSubject" type="int64u" optional="false"/>
<arg name="Key" type="octet_string" length="16" optional="false"/>
<arg name="VerificationKey" type="octet_string" length="16" optional="true"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="server" code="0x01" name="RegisterClientResponse" optional="false" disableDefaultResponse="true">
<description> RegisterClient response command </description>
<command source="server" code="0x01" name="RegisterClientResponse" optional="true" disableDefaultResponse="true">
<description>RegisterClient response command</description>
<arg name="ICDCounter" type="int32u" isNullable="false"/>
</command>

<command source="client" code="0x02" name="UnregisterClient" isFabricScoped="true" optional="true">
<description> Unregister a client from an end device </description>
<description>Unregister a client from an end device</description>
<arg name="CheckInNodeID" type="node_id"/>
<arg name="VerificationKey" type="octet_string" length="16" optional="true"/>
<access op="invoke" privilege="manage"/>
</command>

<command source="client" code="0x03" name="StayActiveRequest" optional="true">
<command source="client" code="0x03" name="StayActiveRequest" response="StayActiveResponse" optional="true">
<description>Request the end device to stay in Active Mode for an additional ActiveModeThreshold</description>
<access op="invoke" privilege="manage"/>
</command>

<command source="server" code="0x04" name="StayActiveResponse" optional="true" disableDefaultResponse="true">
<description>StayActiveRequest response command</description>
<arg name="PromisedActiveDuration" type="int32u" isNullable="false"/>
</command>
</cluster>
</configurator>
6 changes: 5 additions & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2827,12 +2827,16 @@ client cluster IcdManagement = 70 {
optional octet_string<16> verificationKey = 1;
}

response struct StayActiveResponse = 4 {
int32u promisedActiveDuration = 0;
}

/** Register a client to the end device */
fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0;
/** Unregister a client from an end device */
fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2;
/** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */
command access(invoke: manage) StayActiveRequest(): DefaultSuccess = 3;
command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3;
}

/** This cluster supports creating a simple timer functionality. */
Expand Down
8 changes: 8 additions & 0 deletions src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1946,6 +1946,14 @@
"source": "client",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "StayActiveResponse",
"code": 4,
"mfgCode": null,
"source": "server",
"isIncoming": 1,
"isEnabled": 1
}
],
"attributes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19094,26 +19094,40 @@ public void onResponse(StructType invokeStructValue) {
}}, commandId, value, timedInvokeTimeoutMs);
}

public void stayActiveRequest(DefaultClusterCallback callback) {
public void stayActiveRequest(StayActiveResponseCallback callback) {
stayActiveRequest(callback, 0);
}

public void stayActiveRequest(DefaultClusterCallback callback, int timedInvokeTimeoutMs) {
public void stayActiveRequest(StayActiveResponseCallback callback, int timedInvokeTimeoutMs) {
final long commandId = 3L;

ArrayList<StructElement> elements = new ArrayList<>();
StructType value = new StructType(elements);
invoke(new InvokeCallbackImpl(callback) {
@Override
public void onResponse(StructType invokeStructValue) {
callback.onSuccess();
final long promisedActiveDurationFieldID = 0L;
Long promisedActiveDuration = null;
for (StructElement element: invokeStructValue.value()) {
if (element.contextTagNum() == promisedActiveDurationFieldID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
promisedActiveDuration = castingValue.value(Long.class);
}
}
}
callback.onSuccess(promisedActiveDuration);
}}, commandId, value, timedInvokeTimeoutMs);
}

public interface RegisterClientResponseCallback extends BaseClusterCallback {
void onSuccess(Long ICDCounter);
}

public interface StayActiveResponseCallback extends BaseClusterCallback {
void onSuccess(Long promisedActiveDuration);
}

public interface RegisteredClientsAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<ChipStructs.IcdManagementClusterMonitoringRegistrationStruct> value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6521,6 +6521,28 @@ public void onError(Exception error) {
callback.onFailure(error);
}
}

public static class DelegatedIcdManagementClusterStayActiveResponseCallback implements ChipClusters.IcdManagementCluster.StayActiveResponseCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(Long promisedActiveDuration) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();

CommandResponseInfo promisedActiveDurationResponseValue = new CommandResponseInfo("promisedActiveDuration", "Long");
responseValues.put(promisedActiveDurationResponseValue, promisedActiveDuration);
callback.onSuccess(responseValues);
}

@Override
public void onError(Exception error) {
callback.onFailure(error);
}
}
public static class DelegatedIcdManagementClusterRegisteredClientsAttributeCallback implements ChipClusters.IcdManagementCluster.RegisteredClientsAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
Expand Down Expand Up @@ -20597,12 +20619,12 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {
InteractionInfo icdManagementstayActiveRequestInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.IcdManagementCluster) cluster)
.stayActiveRequest((DefaultClusterCallback) callback
);
},
() -> new DelegatedDefaultClusterCallback(),
.stayActiveRequest((ChipClusters.IcdManagementCluster.StayActiveResponseCallback) callback
);
},
() -> new DelegatedIcdManagementClusterStayActiveResponseCallback(),
icdManagementstayActiveRequestCommandParams
);
);
icdManagementClusterInteractionInfoMap.put("stayActiveRequest", icdManagementstayActiveRequestInteractionInfo);

commandMap.put("icdManagement", icdManagementClusterInteractionInfoMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class IcdManagementCluster(
) {
class RegisterClientResponse(val ICDCounter: UInt)

class StayActiveResponse(val promisedActiveDuration: UInt)

class RegisteredClientsAttribute(
val value: List<IcdManagementClusterMonitoringRegistrationStruct>?
)
Expand Down Expand Up @@ -68,7 +70,7 @@ class IcdManagementCluster(
}
}

suspend fun stayActiveRequest(timedInvokeTimeoutMs: Int? = null) {
suspend fun stayActiveRequest(timedInvokeTimeoutMs: Int? = null): StayActiveResponse {
val commandId = 3L

if (timedInvokeTimeoutMs != null) {
Expand Down
62 changes: 62 additions & 0 deletions src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

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

15 changes: 15 additions & 0 deletions src/controller/java/zap-generated/CHIPInvokeCallbacks.h

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

16 changes: 16 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.

4 changes: 2 additions & 2 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.

8 changes: 4 additions & 4 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.

Loading

0 comments on commit 1188175

Please sign in to comment.