Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ameba] Fix Read Product Appearance #28860

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/platform/Ameba/FactoryDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <platform/internal/GenericConfigurationManagerImpl.ipp>

using namespace ::chip::DeviceLayer::Internal;
using namespace chip::app::Clusters::BasicInformation;

namespace chip {
namespace DeviceLayer {
Expand Down Expand Up @@ -664,5 +665,19 @@ CHIP_ERROR FactoryDataProvider::GetRotatingDeviceIdUniqueId(MutableByteSpan & un
return err;
}

CHIP_ERROR FactoryDataProvider::GetProductFinish(ProductFinishEnum * finish)
{
CHIP_ERROR err = CHIP_NO_ERROR;
*finish = ProductFinishEnum::kOther;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Product appearance is optional to implement, and just making up an invalid value is not a useful way of implementing it. Why is this being done?

return err;
}

CHIP_ERROR FactoryDataProvider::GetProductPrimaryColor(ColorEnum * primaryColor)
{
CHIP_ERROR err = CHIP_NO_ERROR;
*primaryColor = ColorEnum::kBlack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankore Is there a reason this is not just returning error? Color is optional to return....

return err;
}

} // namespace DeviceLayer
} // namespace chip
2 changes: 2 additions & 0 deletions src/platform/Ameba/FactoryDataProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class FactoryDataProvider : public chip::Credentials::DeviceAttestationCredentia
CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override;
CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override;
CHIP_ERROR GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) override;
CHIP_ERROR GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) override;
CHIP_ERROR GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) override;

bool kReadFromFlash = false;

Expand Down