-
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.
Align OTA Requestor Cluster with spec (#13098)
- Update DefaultOtaProviders to be a list of ProviderLocation structs - Add Endpoint field to AnnounceOTAProviders command - Accessors cannot properly handle lists so provide minimal implementation of AttributeAccessInterface for OTA Requestor - Rename ClusterInterface.cpp to ota-requestor-server.cpp to better match other clusters - Add default, isNullable, and contraints to all applicable fields
- Loading branch information
1 parent
3a28cd7
commit b3f7dd0
Showing
56 changed files
with
2,165 additions
and
467 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
87 changes: 87 additions & 0 deletions
87
examples/all-clusters-app/all-clusters-common/src/ota-requestor-stub.cpp
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,87 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 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. | ||
*/ | ||
|
||
#include <app/AttributeAccessInterface.h> | ||
#include <app/util/attribute-storage.h> | ||
#include <platform/OTARequestorInterface.h> | ||
|
||
using namespace chip; | ||
using namespace chip::app; | ||
using namespace chip::app::Clusters; | ||
using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; | ||
|
||
namespace { | ||
|
||
class OtaSoftwareUpdateRequestorAttrAccess : public AttributeAccessInterface | ||
{ | ||
public: | ||
// Register for the OTA Requestor Cluster on all endpoints. | ||
OtaSoftwareUpdateRequestorAttrAccess() : | ||
AttributeAccessInterface(Optional<EndpointId>::Missing(), OtaSoftwareUpdateRequestor::Id) | ||
{} | ||
|
||
CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; | ||
CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; | ||
}; | ||
|
||
OtaSoftwareUpdateRequestorAttrAccess gAttrAccess; | ||
|
||
CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) | ||
{ | ||
switch (aPath.mAttributeId) | ||
{ | ||
case Attributes::DefaultOtaProviders::Id: | ||
return aEncoder.Encode(DataModel::List<uint8_t>()); | ||
default: | ||
break; | ||
} | ||
|
||
return CHIP_NO_ERROR; | ||
} | ||
|
||
CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) | ||
{ | ||
switch (aPath.mAttributeId) | ||
{ | ||
case Attributes::DefaultOtaProviders::Id: { | ||
DataModel::DecodableList<OtaSoftwareUpdateRequestor::Structs::ProviderLocation::DecodableType> list; | ||
ReturnErrorOnFailure(aDecoder.Decode(list)); | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
} // namespace | ||
|
||
bool emberAfOtaSoftwareUpdateRequestorClusterAnnounceOtaProviderCallback( | ||
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | ||
const chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::DecodableType & commandData) | ||
{ | ||
return false; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
// Plugin initialization | ||
|
||
void MatterOtaSoftwareUpdateRequestorPluginServerInitCallback(void) | ||
{ | ||
registerAttributeAccessOverride(&gAttrAccess); | ||
} |
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
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.