-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into write_handler_validation
- Loading branch information
Showing
45 changed files
with
732 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* | ||
* Copyright (c) 2025 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "pw_status/status.h" | ||
#include <app/AttributeReportBuilder.h> | ||
#include <app/AttributeValueDecoder.h> | ||
#include <app/AttributeValueEncoder.h> | ||
|
||
namespace chip { | ||
namespace rpc { | ||
|
||
/** | ||
* Callback class that clusters can implement in order to interpose custom | ||
* interception logic. | ||
*/ | ||
class PigweedDebugAccessInterceptor | ||
{ | ||
public: | ||
PigweedDebugAccessInterceptor() = default; | ||
virtual ~PigweedDebugAccessInterceptor() = default; | ||
|
||
/** | ||
* Callback for writing attributes. | ||
* | ||
* The implementation can do one of three things: | ||
* | ||
* Returns: | ||
* - `std::nullopt` if the `path` was not handled by this Interceptor. | ||
* Interceptor MUST NOT have attepted to decode `decoder`. | ||
* - A `::pw::Status` value that is considered the FINAL result of the | ||
* write (i.e. write handled) either with success or failure. | ||
*/ | ||
virtual std::optional<::pw::Status> Write(const chip::app::ConcreteDataAttributePath & path, | ||
chip::app::AttributeValueDecoder & decoder) = 0; | ||
}; | ||
|
||
} // namespace rpc | ||
} // namespace chip |
73 changes: 73 additions & 0 deletions
73
examples/common/pigweed/rpc_services/AccessInterceptorRegistry.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* | ||
* Copyright (c) 2025 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "pw_status/status.h" | ||
#include <pigweed/rpc_services/AccessInterceptor.h> | ||
#include <set> | ||
|
||
namespace chip { | ||
namespace rpc { | ||
|
||
/** @brief Custom debug request interceptors. | ||
* | ||
* This class is specifically meant for registering custom Accessors that | ||
* allow mini-handlers to process PigweedRPC read/writes separately from the cluster | ||
* code. It is meant to be used by samples using this PigweedRPC services to allow the RPC | ||
* interface to be used in more ways than simply for example, simulating writes from a Matter | ||
* client at the IM level. Handlers registered here by applications should be attempted before any | ||
* standard processing. | ||
*/ | ||
class PigweedDebugAccessInterceptorRegistry | ||
{ | ||
public: | ||
/** | ||
* Registers an attribute access inteceptor within this registry. Use `Unregister` to | ||
* unregister an interceptor that was previously registered. | ||
* @param attrOverride - the interceptor to be registered. | ||
*/ | ||
void Register(PigweedDebugAccessInterceptor * attrOverride) { mAccessors.insert(attrOverride); } | ||
|
||
void Unregister(PigweedDebugAccessInterceptor * attrOverride) | ||
{ | ||
if (mAccessors.find(attrOverride) == mAccessors.end()) | ||
{ | ||
ChipLogError(Support, "Attempt to unregister accessor that is not registered."); | ||
return; | ||
} | ||
mAccessors.erase(attrOverride); | ||
} | ||
|
||
const std::set<PigweedDebugAccessInterceptor *> & GetAllAccessors() const { return mAccessors; } | ||
|
||
/** | ||
* Returns the singleton instance of the attribute accessor registory. | ||
*/ | ||
static PigweedDebugAccessInterceptorRegistry & Instance() | ||
{ | ||
static PigweedDebugAccessInterceptorRegistry instance; | ||
return instance; | ||
} | ||
|
||
private: | ||
std::set<PigweedDebugAccessInterceptor *> mAccessors; | ||
}; | ||
|
||
} // namespace rpc | ||
} // namespace chip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
109 : [Tizen] Fix race when storing cert credentials | ||
111 : [Android] Update android sdk and java version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.