Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding TimeoutMs to KeepActive command #35154

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2704,6 +2704,7 @@ cluster BridgedDeviceBasicInformation = 57 {

tehampson marked this conversation as resolved.
Show resolved Hide resolved
request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
int32u timeoutMs = 1;
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
Expand Down
1 change: 1 addition & 0 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,7 @@ cluster BridgedDeviceBasicInformation = 57 {

request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
int32u timeoutMs = 1;
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ limitations under the License.

tehampson marked this conversation as resolved.
Show resolved Hide resolved
<command source="client" code="0x80" name="KeepActive" optional="true" apiMaturity="provisional">
<description> The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active.</description>
<arg name="StayActiveDuration" type="int32u"/>
<arg id="0" name="StayActiveDuration" type="int32u"/>
<arg id="1" name="TimeoutMs" type="int32u" min="30000" max="3600000"/>
</command>

<event side="server" code="0x00" name="StartUp" priority="critical" optional="true">
Expand Down
1 change: 1 addition & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2587,6 +2587,7 @@ cluster BridgedDeviceBasicInformation = 57 {

request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
int32u timeoutMs = 1;
yufengwangca marked this conversation as resolved.
Show resolved Hide resolved
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15197,18 +15197,22 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}

public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration) {
keepActive(callback, stayActiveDuration, 0);
public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration, Long timeoutMs) {
keepActive(callback, stayActiveDuration, timeoutMs, 0);
}

public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration, int timedInvokeTimeoutMs) {
public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration, Long timeoutMs, int timedInvokeTimeoutMs) {
final long commandId = 128L;

ArrayList<StructElement> elements = new ArrayList<>();
final long stayActiveDurationFieldID = 0L;
BaseTLVType stayActiveDurationtlvValue = new UIntType(stayActiveDuration);
elements.add(new StructElement(stayActiveDurationFieldID, stayActiveDurationtlvValue));

final long timeoutMsFieldID = 1L;
BaseTLVType timeoutMstlvValue = new UIntType(timeoutMs);
elements.add(new StructElement(timeoutMsFieldID, timeoutMstlvValue));

StructType commandArgs = new StructType(elements);
invoke(new InvokeCallbackImpl(callback) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4543,7 +4543,7 @@ public static Command value(long id) throws NoSuchFieldError {
}
throw new NoSuchFieldError();
}
}public enum KeepActiveCommandField {StayActiveDuration(0),;
}public enum KeepActiveCommandField {StayActiveDuration(0),TimeoutMs(1),;
private final int id;
KeepActiveCommandField(int id) {
this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24443,12 +24443,17 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {

CommandParameterInfo bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo = new CommandParameterInfo("stayActiveDuration", Long.class, Long.class);
bridgedDeviceBasicInformationkeepActiveCommandParams.put("stayActiveDuration",bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo);

CommandParameterInfo bridgedDeviceBasicInformationkeepActivetimeoutMsCommandParameterInfo = new CommandParameterInfo("timeoutMs", Long.class, Long.class);
bridgedDeviceBasicInformationkeepActiveCommandParams.put("timeoutMs",bridgedDeviceBasicInformationkeepActivetimeoutMsCommandParameterInfo);
InteractionInfo bridgedDeviceBasicInformationkeepActiveInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.BridgedDeviceBasicInformationCluster) cluster)
.keepActive((DefaultClusterCallback) callback
, (Long)
commandArguments.get("stayActiveDuration")
, (Long)
commandArguments.get("timeoutMs")
);
},
() -> new DelegatedDefaultClusterCallback(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,21 @@ class BridgedDeviceBasicInformationCluster(
object SubscriptionEstablished : AttributeListAttributeSubscriptionState()
}

suspend fun keepActive(stayActiveDuration: UInt, timedInvokeTimeout: Duration? = null) {
suspend fun keepActive(
stayActiveDuration: UInt,
timeoutMs: UInt,
timedInvokeTimeout: Duration? = null,
) {
val commandId: UInt = 128u

val tlvWriter = TlvWriter()
tlvWriter.startStructure(AnonymousTag)

val TAG_STAY_ACTIVE_DURATION_REQ: Int = 0
tlvWriter.put(ContextSpecificTag(TAG_STAY_ACTIVE_DURATION_REQ), stayActiveDuration)

val TAG_TIMEOUT_MS_REQ: Int = 1
tlvWriter.put(ContextSpecificTag(TAG_TIMEOUT_MS_REQ), timeoutMs)
tlvWriter.endStructure()

val request: InvokeRequest =
Expand Down
1 change: 1 addition & 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.

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.

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.

1 change: 1 addition & 0 deletions zzz_generated/chip-tool/zap-generated/cluster/Commands.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.

Loading