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

Add StayActiveDuration to KeepActive in BridgedDevInfo #34631

Merged
merged 3 commits into from
Jul 30, 2024
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
6 changes: 5 additions & 1 deletion examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2387,8 +2387,12 @@ cluster BridgedDeviceBasicInformation = 57 {
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
command KeepActive(): DefaultSuccess = 128;
command KeepActive(KeepActiveRequest): DefaultSuccess = 128;
}

/** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices.
Expand Down
6 changes: 5 additions & 1 deletion examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2344,8 +2344,12 @@ cluster BridgedDeviceBasicInformation = 57 {
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
command KeepActive(): DefaultSuccess = 128;
command KeepActive(KeepActiveRequest): DefaultSuccess = 128;
}

/** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ limitations under the License.

<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"/>
</command>

<event side="server" code="0x00" name="StartUp" priority="critical" optional="true">
Expand Down
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 @@ -2292,8 +2292,12 @@ cluster BridgedDeviceBasicInformation = 57 {
readonly attribute bitmap32 featureMap = 65532;
readonly attribute int16u clusterRevision = 65533;

request struct KeepActiveRequest {
int32u stayActiveDuration = 0;
}

/** The server SHALL attempt to keep the devices specified active for StayActiveDuration milliseconds when they are next active. */
command KeepActive(): DefaultSuccess = 128;
command KeepActive(KeepActiveRequest): DefaultSuccess = 128;
}

/** This cluster exposes interactions with a switch device, for the purpose of using those interactions by other devices.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14963,14 +14963,18 @@ public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}

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

public void keepActive(DefaultClusterCallback callback, int timedInvokeTimeoutMs) {
public void keepActive(DefaultClusterCallback callback, Long stayActiveDuration, 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));

StructType commandArgs = new StructType(elements);
invoke(new InvokeCallbackImpl(callback) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4498,7 +4498,24 @@ public static Command value(long id) throws NoSuchFieldError {
}
throw new NoSuchFieldError();
}
}@Override
}public enum KeepActiveCommandField {StayActiveDuration(0),;
private final int id;
KeepActiveCommandField(int id) {
this.id = id;
}

public int getID() {
return id;
}
public static KeepActiveCommandField value(int id) throws NoSuchFieldError {
for (KeepActiveCommandField field : KeepActiveCommandField.values()) {
if (field.getID() == id) {
return field;
}
}
throw new NoSuchFieldError();
}
}@Override
public String getAttributeName(long id) throws NoSuchFieldError {
return Attribute.value(id).toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24181,10 +24181,15 @@ public Map<String, Map<String, InteractionInfo>> getCommandMap() {
Map<String, InteractionInfo> bridgedDeviceBasicInformationClusterInteractionInfoMap = new LinkedHashMap<>();

Map<String, CommandParameterInfo> bridgedDeviceBasicInformationkeepActiveCommandParams = new LinkedHashMap<String, CommandParameterInfo>();

CommandParameterInfo bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo = new CommandParameterInfo("stayActiveDuration", Long.class, Long.class);
bridgedDeviceBasicInformationkeepActiveCommandParams.put("stayActiveDuration",bridgedDeviceBasicInformationkeepActivestayActiveDurationCommandParameterInfo);
InteractionInfo bridgedDeviceBasicInformationkeepActiveInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.BridgedDeviceBasicInformationCluster) cluster)
.keepActive((DefaultClusterCallback) callback
, (Long)
commandArguments.get("stayActiveDuration")
);
},
() -> new DelegatedDefaultClusterCallback(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import matter.controller.cluster.structs.*
import matter.controller.model.AttributePath
import matter.controller.model.CommandPath
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

Expand Down Expand Up @@ -100,11 +101,14 @@ class BridgedDeviceBasicInformationCluster(
object SubscriptionEstablished : AttributeListAttributeSubscriptionState()
}

suspend fun keepActive(timedInvokeTimeout: Duration? = null) {
suspend fun keepActive(stayActiveDuration: 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)
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.

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

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

4 changes: 1 addition & 3 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.

6 changes: 1 addition & 5 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusters.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.

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