Skip to content

Commit

Permalink
Merge branch 'master' into global_attributes_in_im
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Feb 3, 2025
2 parents db8d178 + dd0ce89 commit 0e22237
Show file tree
Hide file tree
Showing 23 changed files with 414 additions and 81 deletions.
12 changes: 5 additions & 7 deletions docs/platforms/esp32/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ CONFIG_LWIP_IPV4=n
### Executable component not in "main" component

The ESP-IDF framework allows renaming the main component, which can be useful if
you want to place the app_main() function in a different component.
you want to place the `app_main()` function in a different component.

For required changes in the executable component, please refer to the
[esp-idf documentation](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/build-system.html#renaming-main-component).

If you're building applications that support Matter and want to place app_main()
in a component other than main, use the following command:

```
idf.py -DEXECUTABLE_COMPONENT_NAME="your_component" build
```
You need to list the required components in `idf_component_register()`. If this
module contains Matter related code, you may need to include
`chip, app_update, spi_flash, and nvs_flash` as `PRIV_REQUIRES`, along with any
other necessary dependencies.
6 changes: 4 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
class ModelCommand : public CHIPCommand
{
public:
ModelCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, bool supportsMultipleEndpoints = false) :
CHIPCommand(commandName, credsIssuerConfig), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
ModelCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, bool supportsMultipleEndpoints = false,
const char * helpText = nullptr) :
CHIPCommand(commandName, credsIssuerConfig, helpText),
mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this), mSupportsMultipleEndpoints(supportsMultipleEndpoints)
{}

Expand Down
48 changes: 32 additions & 16 deletions examples/chip-tool/commands/clusters/ReportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
class ReportCommand : public InteractionModelReports, public ModelCommand, public chip::app::ReadClient::Callback
{
public:
ReportCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelReports(this), ModelCommand(commandName, credsIssuerConfig, /* supportsMultipleEndpoints = */ true)
ReportCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
InteractionModelReports(this),
ModelCommand(commandName, credsIssuerConfig, /* supportsMultipleEndpoints = */ true, helpText)
{}

/////////// ReadClient Callback Interface /////////
Expand Down Expand Up @@ -133,8 +134,8 @@ class ReportCommand : public InteractionModelReports, public ModelCommand, publi
class ReadCommand : public ReportCommand
{
protected:
ReadCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
ReportCommand(commandName, credsIssuerConfig)
ReadCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
ReportCommand(commandName, credsIssuerConfig, helpText)
{}

void OnDone(chip::app::ReadClient * aReadClient) override
Expand All @@ -147,8 +148,8 @@ class ReadCommand : public ReportCommand
class SubscribeCommand : public ReportCommand
{
protected:
SubscribeCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
ReportCommand(commandName, credsIssuerConfig)
SubscribeCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
ReportCommand(commandName, credsIssuerConfig, helpText)
{}

void OnSubscriptionEstablished(chip::SubscriptionId subscriptionId) override
Expand Down Expand Up @@ -187,7 +188,8 @@ class SubscribeCommand : public ReportCommand
class ReadAttribute : public ReadCommand
{
public:
ReadAttribute(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-by-id", credsIssuerConfig)
ReadAttribute(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-by-id", credsIssuerConfig, "Read attributes for the given attribute path (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand All @@ -198,7 +200,8 @@ class ReadAttribute : public ReadCommand
}

ReadAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
ReadCommand("read-by-id", credsIssuerConfig, "Read attributes from this cluster; allows wildcard endpoint and attribute."),
mClusterIds(1, clusterId)
{
AddAttributeIdArgument();
AddCommonArguments();
Expand Down Expand Up @@ -245,7 +248,9 @@ class ReadAttribute : public ReadCommand
class SubscribeAttribute : public SubscribeCommand
{
public:
SubscribeAttribute(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-by-id", credsIssuerConfig)
SubscribeAttribute(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-by-id", credsIssuerConfig,
"Subscribe to attributes for the given attribute path (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to subscribe to (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF "
Expand All @@ -256,7 +261,9 @@ class SubscribeAttribute : public SubscribeCommand
}

SubscribeAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
SubscribeCommand("subscribe-by-id", credsIssuerConfig,
"Subscribe to attributes from this cluster; allows wildcard endpoint and attribute."),
mClusterIds(1, clusterId)
{
AddAttributeIdArgument();
AddCommonArguments();
Expand Down Expand Up @@ -312,7 +319,8 @@ class SubscribeAttribute : public SubscribeCommand
class ReadEvent : public ReadCommand
{
public:
ReadEvent(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-event-by-id", credsIssuerConfig)
ReadEvent(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-event-by-id", credsIssuerConfig, "Read events for the given event path (which may include wildcards).")
{
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterIds);
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
Expand All @@ -322,7 +330,8 @@ class ReadEvent : public ReadCommand
}

ReadEvent(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-event-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
ReadCommand("read-event-by-id", credsIssuerConfig, "Read events from this cluster; allows wildcard endpoint and event."),
mClusterIds(1, clusterId)
{
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("fabric-filtered", 0, 1, &mFabricFiltered);
Expand Down Expand Up @@ -356,7 +365,9 @@ class ReadEvent : public ReadCommand
class SubscribeEvent : public SubscribeCommand
{
public:
SubscribeEvent(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-event-by-id", credsIssuerConfig)
SubscribeEvent(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig,
"Subscribe to events for the given event path (which may include wildcards).")
{
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterIds);
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
Expand All @@ -365,7 +376,9 @@ class SubscribeEvent : public SubscribeCommand
}

SubscribeEvent(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig,
"Subscribe to events from this cluster; allows wildcard endpoint and event."),
mClusterIds(1, clusterId)
{
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddCommonArguments();
Expand Down Expand Up @@ -447,7 +460,8 @@ class ReadNone : public ReadCommand
class ReadAll : public ReadCommand
{
public:
ReadAll(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-all", credsIssuerConfig)
ReadAll(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-all", credsIssuerConfig, "Read attributes and events for the given paths (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand Down Expand Up @@ -513,7 +527,9 @@ class SubscribeNone : public SubscribeCommand
class SubscribeAll : public SubscribeCommand
{
public:
SubscribeAll(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-all", credsIssuerConfig)
SubscribeAll(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-all", credsIssuerConfig,
"Subscribe to attributes and events for the given paths (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
105 : Upgrade android docker with new kotlin/gradle
106 : Upgrade android docker with java 17 and adjust the location for android cmdline tool
4 changes: 2 additions & 2 deletions integrations/docker/images/stage-2/chip-build-java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL org.opencontainers.image.source https://github.com/project-chip/connectedh
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy \
openjdk-11-jdk \
openjdk-17-jdk \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

Expand All @@ -20,4 +20,4 @@ RUN set -x \
&& : # last line

ENV PATH $PATH:/usr/lib/kotlinc/bin
ENV JAVA_PATH=/usr/lib/jvm/java-11-openjdk-amd64
ENV JAVA_PATH=/usr/lib/jvm/java-17-openjdk-amd64
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ RUN set -x \
&& : # last line

# Download and install android command line tool (for installing `sdkmanager`)
# We need create latest folder inide cmdline-tools, since latest android commandline tool looks for this latest folder
# when running sdkmanager --licenses
RUN set -x \
&& wget -O /tmp/cmdline-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
&& cd /opt/android/sdk \
&& unzip /tmp/cmdline-tools.zip \
&& rm -f /tmp/cmdline-tools.zip \
&& mkdir -p temp \
&& unzip /tmp/cmdline-tools.zip -d temp \
&& mkdir -p cmdline-tools/latest \
&& cp -rf temp/cmdline-tools/* cmdline-tools/latest \
&& rm -rf temp \
&& test -d /opt/android/sdk/cmdline-tools \
&& : # last line

Expand Down
10 changes: 10 additions & 0 deletions src/app/data-model-provider/Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ class Provider : public ProviderMetadataTree
/// This includes cases where command handling and value return will be done asynchronously.
/// - returning a value other than Success implies an error reply (error and data are mutually exclusive)
///
/// Preconditions:
/// - `request.path` MUST be valid: Invoke` is only guaranteed to function correctly for
/// VALID paths (i.e. use `ProviderMetadataTree::AcceptedCommands` to check). This is
/// because we assume ACL or flags (like timed invoke) have to happen before invoking
/// this command.
/// - TODO: as interfaces are updated, we may want to make the above requirement more
/// relaxed, as it seems desirable for users of this interface to have guaranteed
/// behavior (like error on invalid paths) where as today this seems unclear as some
/// command intercepts do not validate if the path is valid per endpoints.
///
/// Return value expectations:
/// - if a response has been placed into `handler` then std::nullopt MUST be returned. In particular
/// note that CHIP_NO_ERROR is NOT the same as std::nullopt:
Expand Down
9 changes: 5 additions & 4 deletions src/controller/java/AndroidLogDownloadFromNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void AndroidLogDownloadFromNode::OnResponseRetrieveLogs(void * context,
using namespace chip::app::Clusters::DiagnosticLogs;
if (data.status == StatusEnum::kSuccess)
{
ChipLogProgress(Controller, "Success. Will receive log from BDX protocol.")
ChipLogProgress(Controller, "Success. Will receive log from BDX protocol.");
}
else if (data.status == StatusEnum::kExhausted)
{
Expand Down Expand Up @@ -210,8 +210,8 @@ void AndroidLogDownloadFromNode::FinishLogDownloadFromNode(void * context, CHIP_
JniLocalReferenceScope scope(env);

jobject jCallback = self->mJavaCallback.ObjectRef();
jint jFabricIndex = self->mController->GetFabricIndex();
jlong jremoteNodeId = self->mRemoteNodeId;
jint jFabricIndex = static_cast<jint>(self->mController->GetFabricIndex());
jlong jremoteNodeId = static_cast<jlong>(self->mRemoteNodeId);

VerifyOrExit(env != nullptr, ChipLogError(Controller, "Could not get JNIEnv for current thread"));

Expand Down Expand Up @@ -274,7 +274,8 @@ void AndroidLogDownloadFromNode::OnTransferCallback(FabricIndex fabricIndex, Nod

if (ret != JNI_TRUE)
{
ChipLogError(Controller, "Transfer will be rejected.") * errInfoOnFailure = CHIP_ERROR_INTERNAL;
ChipLogError(Controller, "Transfer will be rejected.");
*errInfoOnFailure = CHIP_ERROR_INTERNAL;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/controller/java/CHIPP256KeypairBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ CHIP_ERROR CHIPP256KeypairBridge::ECDSA_sign_msg(const uint8_t * msg, size_t msg
return CHIP_ERROR_INCORRECT_STATE;
}

VerifyOrReturnError(CanCastTo<uint32_t>(msg_length), CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(CanCastTo<jsize>(msg_length), CHIP_ERROR_INVALID_ARGUMENT);

CHIP_ERROR err = CHIP_NO_ERROR;
jbyteArray jniMsg;
jobject signedResult = nullptr;
JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread();
VerifyOrReturnError(env != nullptr, err = CHIP_JNI_ERROR_NO_ENV);
err = JniReferences::GetInstance().N2J_ByteArray(env, msg, static_cast<uint32_t>(msg_length), jniMsg);
err = JniReferences::GetInstance().N2J_ByteArray(env, msg, static_cast<jsize>(msg_length), jniMsg);
VerifyOrReturnError(err == CHIP_NO_ERROR, err);
VerifyOrReturnError(jniMsg != nullptr, err);
VerifyOrReturnError(mDelegate.HasValidObjectRef(), CHIP_ERROR_INCORRECT_STATE);
Expand Down
7 changes: 7 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
*/
- (void)resume MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2));

/**
* Returns the list of node IDs for which this controller has stored
* information. Returns empty list if the controller does not have any
* information stored.
*/
- (NSArray<NSNumber *> *)nodesWithStoredData MTR_AVAILABLE(ios(18.4), macos(15.4), watchos(11.4), tvos(18.4));

/**
* Shut down the controller. Calls to shutdown after the first one are NO-OPs.
* This must be called, either directly or via shutting down the
Expand Down
6 changes: 6 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,12 @@ + (void)forceLocalhostAdvertisingOnly
}
#endif // DEBUG

- (NSArray<NSNumber *> *)nodesWithStoredData
{
MTR_ABSTRACT_METHOD();
return @[];
}

#pragma mark - MTRDeviceControllerDelegate management

// Note these are implemented in the base class so that XPC subclass can use it as well
Expand Down
6 changes: 6 additions & 0 deletions src/darwin/Framework/CHIP/MTRDeviceControllerDataStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ typedef void (^MTRDeviceControllerDataStoreClusterDataHandler)(NSDictionary<NSNu
*/
- (void)synchronouslyPerformBlock:(void (^_Nullable)(void))block;

/**
* Returns the list of node IDs for which this data store has stored data of
* some sort.
*/
- (NSArray<NSNumber *> *)nodesWithStoredData;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 0e22237

Please sign in to comment.