Skip to content

Commit

Permalink
Regen ZAP
Browse files Browse the repository at this point in the history
  • Loading branch information
tennessee-google committed Jan 23, 2024
1 parent f592592 commit 7072705
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6904,6 +6904,7 @@ internal cluster UnitTesting = 4294048773 {

response struct TestDifferentVendorMeiResponse = 4294049979 {
int8u arg1 = 0;
int64u eventNumber = 1;
}

/** Simple command without any parameters and without a specific response.
Expand Down Expand Up @@ -6976,7 +6977,7 @@ internal cluster UnitTesting = 4294048773 {
command TestBatchHelperRequest(TestBatchHelperRequestRequest): TestBatchHelperResponse = 22;
/** Second command that responds after sleepBeforeResponseTimeMs with an octet_string the size requested with fillCharacter. */
command TestSecondBatchHelperRequest(TestSecondBatchHelperRequestRequest): TestBatchHelperResponse = 23;
/** Command having a different MEI vendor ID than the cluster. */
/** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */
command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5779,6 +5779,7 @@ internal cluster UnitTesting = 4294048773 {

response struct TestDifferentVendorMeiResponse = 4294049979 {
int8u arg1 = 0;
int64u eventNumber = 1;
}

/** Simple command without any parameters and without a specific response.
Expand Down Expand Up @@ -5851,7 +5852,7 @@ internal cluster UnitTesting = 4294048773 {
command TestBatchHelperRequest(TestBatchHelperRequestRequest): TestBatchHelperResponse = 22;
/** Second command that responds after sleepBeforeResponseTimeMs with an octet_string the size requested with fillCharacter. */
command TestSecondBatchHelperRequest(TestSecondBatchHelperRequestRequest): TestBatchHelperResponse = 23;
/** Command having a different MEI vendor ID than the cluster. */
/** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */
command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962;
}

Expand Down
40 changes: 21 additions & 19 deletions src/app/tests/suites/TestUnitTestingClusterMei.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ tests:
- name: "nodeId"
value: nodeId

- label: "Send MEI command in cluster"
command: "TestDifferentVendorMeiRequest"
arguments:
values:
- name: "arg1"
value: 76
response:
values:
- name: "arg1"
value: 76

- label: "Write different vendor MEI attribute"
command: "writeAttribute"
attribute: "mei_int8u"
Expand Down Expand Up @@ -73,6 +62,26 @@ tests:
type: list
contains: [4294070017]

- label: "Send MEI command and force event generation"
command: "TestDifferentVendorMeiRequest"
arguments:
values:
- name: "arg1"
value: 76
response:
values:
- name: "arg1"
value: 76
- name: "eventNumber"
saveAs: firstMeiEventNumber

- label: "Validate event generation 1/2"
command: "readEvent"
event: "TestDifferentVendorMeiEvent"
eventNumber: firstMeiEventNumber
response:
value: { arg1: 76 }

- label: "Force event generation"
command: "TestEmitTestEventRequest"
arguments:
Expand All @@ -88,14 +97,7 @@ tests:
- name: "value"
saveAs: firstEventNumber

- label: "Validate event generation 1/2"
command: "readEvent"
event: "TestDifferentVendorMeiEvent"
eventNumber: firstEventNumber
response:
value: { arg1: 42 }

- label: "Validate event generation 2/2"
command: "readEvent"
event: "TestEvent"
eventNumber: "LastReceivedEventNumber + 1"
eventNumber: firstEventNumber
3 changes: 2 additions & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -9022,6 +9022,7 @@ internal cluster UnitTesting = 4294048773 {

response struct TestDifferentVendorMeiResponse = 4294049979 {
int8u arg1 = 0;
int64u eventNumber = 1;
}

/** Simple command without any parameters and without a specific response.
Expand Down Expand Up @@ -9094,7 +9095,7 @@ internal cluster UnitTesting = 4294048773 {
command TestBatchHelperRequest(TestBatchHelperRequestRequest): TestBatchHelperResponse = 22;
/** Second command that responds after sleepBeforeResponseTimeMs with an octet_string the size requested with fillCharacter. */
command TestSecondBatchHelperRequest(TestSecondBatchHelperRequestRequest): TestBatchHelperResponse = 23;
/** Command having a different MEI vendor ID than the cluster. */
/** Command having a different MEI vendor ID than the cluster. Also emits TestDifferentVendorMeiEvent. */
command TestDifferentVendorMeiRequest(TestDifferentVendorMeiRequestRequest): TestDifferentVendorMeiResponse = 4294049962;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60051,15 +60051,22 @@ public void testDifferentVendorMeiRequest(TestDifferentVendorMeiResponseCallback
public void onResponse(StructType invokeStructValue) {
final long arg1FieldID = 0L;
Integer arg1 = null;
final long eventNumberFieldID = 1L;
Long eventNumber = null;
for (StructElement element: invokeStructValue.value()) {
if (element.contextTagNum() == arg1FieldID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
arg1 = castingValue.value(Integer.class);
}
} else if (element.contextTagNum() == eventNumberFieldID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
eventNumber = castingValue.value(Long.class);
}
}
}
callback.onSuccess(arg1);
callback.onSuccess(arg1, eventNumber);
}}, commandId, value, timedInvokeTimeoutMs);
}

Expand Down Expand Up @@ -60116,7 +60123,7 @@ public interface TestBatchHelperResponseCallback extends BaseClusterCallback {
}

public interface TestDifferentVendorMeiResponseCallback extends BaseClusterCallback {
void onSuccess(Integer arg1);
void onSuccess(Integer arg1, Long eventNumber);
}

public interface ListInt8uAttributeCallback extends BaseAttributeCallback {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18939,11 +18939,13 @@ public void setCallbackDelegate(ClusterCommandCallback callback) {
}

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

CommandResponseInfo arg1ResponseValue = new CommandResponseInfo("arg1", "Integer");
responseValues.put(arg1ResponseValue, arg1);
CommandResponseInfo eventNumberResponseValue = new CommandResponseInfo("eventNumber", "Long");
responseValues.put(eventNumberResponseValue, eventNumber);
callback.onSuccess(responseValues);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class UnitTestingCluster(private val controller: MatterController, private val e

class TestBatchHelperResponse(val buffer: ByteArray)

class TestDifferentVendorMeiResponse(val arg1: UByte)
class TestDifferentVendorMeiResponse(val arg1: UByte, val eventNumber: ULong)

class ListInt8uAttribute(val value: List<UByte>)

Expand Down Expand Up @@ -2365,11 +2365,18 @@ class UnitTestingCluster(private val controller: MatterController, private val e
val TAG_ARG1: Int = 0
var arg1_decoded: UByte? = null

val TAG_EVENT_NUMBER: Int = 1
var eventNumber_decoded: ULong? = null

while (!tlvReader.isEndOfContainer()) {
val tag = tlvReader.peekElement().tag

if (tag == ContextSpecificTag(TAG_ARG1)) {
arg1_decoded = tlvReader.getUByte(tag)
}

if (tag == ContextSpecificTag(TAG_EVENT_NUMBER)) {
eventNumber_decoded = tlvReader.getULong(tag)
} else {
tlvReader.skipElement()
}
Expand All @@ -2379,9 +2386,13 @@ class UnitTestingCluster(private val controller: MatterController, private val e
throw IllegalStateException("arg1 not found in TLV")
}

if (eventNumber_decoded == null) {
throw IllegalStateException("eventNumber not found in TLV")
}

tlvReader.exitContainer()

return TestDifferentVendorMeiResponse(arg1_decoded)
return TestDifferentVendorMeiResponse(arg1_decoded, eventNumber_decoded)
}

suspend fun readBooleanAttribute(): Boolean {
Expand Down
13 changes: 10 additions & 3 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.

2 changes: 2 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: 1 addition & 1 deletion 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.

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.

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.

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

0 comments on commit 7072705

Please sign in to comment.