Skip to content

Commit

Permalink
Merge branch 'master' into add_presets_to_Sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
hasty authored Jul 30, 2024
2 parents c6e07d0 + 268e7ca commit 4b03da7
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,16 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool):
provided_field_name = provided_field_name[0].lower(
) + provided_field_name[1:]

if provided_field_name in value and provided_field_name != field_name:
if provided_field_name in value:
value[field_name] = self.run(
specs,
value[provided_field_name],
cluster_name,
field_type,
field_array
)
del value[provided_field_name]
if provided_field_name != field_name:
del value[provided_field_name]

if specs.is_fabric_scoped(struct):
if _FABRIC_INDEX_FIELD_CODE in value:
Expand Down
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 @@ -24286,10 +24286,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.

6 changes: 5 additions & 1 deletion src/messaging/tests/java/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ shared_library("jni") {
defines = [ "JAVA_MATTER_CONTROLLER_TEST" ]
include_dirs = java_matter_controller_dependent_paths

deps += [ "${chip_root}/src/platform/Linux" ]
if (current_os == "mac") {
deps += [ "${chip_root}/src/platform/Darwin" ]
} else {
deps += [ "${chip_root}/src/platform/Linux" ]
}

cflags = [ "-Wno-unknown-pragmas" ]

Expand Down

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 4b03da7

Please sign in to comment.