Skip to content

Commit

Permalink
Add StayActiveDuration to KeepActive in BridgedDevInfo (project-chip#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson authored Jul 30, 2024
1 parent 3a99423 commit 268e7ca
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 25 deletions.
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 @@ -2441,8 +2441,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 @@ -2398,8 +2398,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 @@ -2346,8 +2346,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 @@ -15050,14 +15050,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 @@ -4520,7 +4520,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 @@ -24259,10 +24259,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.

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

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.

0 comments on commit 268e7ca

Please sign in to comment.