Skip to content

Commit

Permalink
Add ProductAppearance attribute support. (#25742)
Browse files Browse the repository at this point in the history
* Add ProductAppearance attribute support.

* Regenerate generated code.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 20, 2023
1 parent 444c61c commit 8d5a209
Show file tree
Hide file tree
Showing 89 changed files with 4,291 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,49 @@ server cluster Actions = 37 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down Expand Up @@ -742,6 +780,7 @@ server cluster BasicInformation = 40 {
readonly attribute boolean reachable = 17;
readonly attribute char_string<32> uniqueID = 18;
readonly attribute CapabilityMinimaStruct capabilityMinima = 19;
readonly attribute ProductAppearanceStruct productAppearance = 20;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down Expand Up @@ -4644,8 +4683,9 @@ endpoint 0 {
ram attribute reachable default = 1;
callback attribute uniqueID;
callback attribute capabilityMinima;
callback attribute productAppearance;
ram attribute featureMap default = 0;
ram attribute clusterRevision default = 1;
ram attribute clusterRevision default = 2;
}

server cluster OtaSoftwareUpdateRequestor {
Expand Down
21 changes: 19 additions & 2 deletions examples/all-clusters-app/all-clusters-common/all-clusters-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,22 @@
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "ProductAppearance",
"code": 20,
"mfgCode": null,
"side": "server",
"type": "ProductAppearanceStruct",
"included": 1,
"storageOption": "External",
"singleton": 1,
"bounded": 0,
"defaultValue": "",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
"reportableChange": 0
},
{
"name": "FeatureMap",
"code": 65532,
Expand All @@ -1534,7 +1550,7 @@
"storageOption": "RAM",
"singleton": 1,
"bounded": 0,
"defaultValue": "1",
"defaultValue": "2",
"reportable": 1,
"minInterval": 0,
"maxInterval": 65344,
Expand Down Expand Up @@ -25498,5 +25514,6 @@
"endpointVersion": 1,
"deviceIdentifier": 61442
}
]
],
"log": []
}
63 changes: 63 additions & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <app/util/af.h>
#include <lib/support/CHIPMem.h>
#include <new>
#include <platform/DeviceInstanceInfoProvider.h>
#include <platform/DiagnosticDataProvider.h>
#include <platform/PlatformManager.h>
#include <system/SystemPacketBuffer.h>
Expand Down Expand Up @@ -138,6 +139,61 @@ Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetw
#endif

Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver);

class ExampleDeviceInstanceInfoProvider : public DeviceInstanceInfoProvider
{
public:
void Init(DeviceInstanceInfoProvider * defaultProvider) { mDefaultProvider = defaultProvider; }

CHIP_ERROR GetVendorName(char * buf, size_t bufSize) override { return mDefaultProvider->GetVendorName(buf, bufSize); }
CHIP_ERROR GetVendorId(uint16_t & vendorId) override { return mDefaultProvider->GetVendorId(vendorId); }
CHIP_ERROR GetProductName(char * buf, size_t bufSize) override { return mDefaultProvider->GetProductName(buf, bufSize); }
CHIP_ERROR GetProductId(uint16_t & productId) override { return mDefaultProvider->GetProductId(productId); }
CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override { return mDefaultProvider->GetPartNumber(buf, bufSize); }
CHIP_ERROR GetProductURL(char * buf, size_t bufSize) override { return mDefaultProvider->GetPartNumber(buf, bufSize); }
CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override { return mDefaultProvider->GetProductLabel(buf, bufSize); }
CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override { return mDefaultProvider->GetSerialNumber(buf, bufSize); }
CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override
{
return mDefaultProvider->GetManufacturingDate(year, month, day);
}
CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override
{
return mDefaultProvider->GetHardwareVersion(hardwareVersion);
}
CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override
{
return mDefaultProvider->GetHardwareVersionString(buf, bufSize);
}
CHIP_ERROR GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) override
{
return mDefaultProvider->GetRotatingDeviceIdUniqueId(uniqueIdSpan);
}
CHIP_ERROR GetProductFinish(Clusters::BasicInformation::ProductFinishEnum * finish) override;
CHIP_ERROR GetProductPrimaryColor(Clusters::BasicInformation::ColorEnum * primaryColor) override;

private:
DeviceInstanceInfoProvider * mDefaultProvider;
};

CHIP_ERROR ExampleDeviceInstanceInfoProvider::GetProductFinish(Clusters::BasicInformation::ProductFinishEnum * finish)
{
// Our example device claims to have a Satin finish for now. We can make
// this configurable as needed.
*finish = Clusters::BasicInformation::ProductFinishEnum::kSatin;
return CHIP_NO_ERROR;
}

CHIP_ERROR ExampleDeviceInstanceInfoProvider::GetProductPrimaryColor(Clusters::BasicInformation::ColorEnum * primaryColor)
{
// Our example device claims to have a nice purple color for now. We can
// make this configurable as needed.
*primaryColor = Clusters::BasicInformation::ColorEnum::kPurple;
return CHIP_NO_ERROR;
}

ExampleDeviceInstanceInfoProvider gExampleDeviceInstanceInfoProvider;

} // namespace

void ApplicationInit()
Expand Down Expand Up @@ -201,6 +257,13 @@ void ApplicationInit()
ChipLogError(NotSpecified, "Failed to start CHIP NamedPipeCommands");
sChipNamedPipeCommands.Stop();
}

auto * defaultProvider = GetDeviceInstanceInfoProvider();
if (defaultProvider != &gExampleDeviceInstanceInfoProvider)
{
gExampleDeviceInstanceInfoProvider.Init(defaultProvider);
SetDeviceInstanceInfoProvider(&gExampleDeviceInstanceInfoProvider);
}
}

void ApplicationExit()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,49 @@ server cluster Actions = 37 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down
38 changes: 38 additions & 0 deletions examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,49 @@ server cluster Actions = 37 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,49 @@ server cluster AccessControl = 31 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,49 @@ server cluster AccessControl = 31 {
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location. */
server cluster BasicInformation = 40 {
enum ColorEnum : ENUM8 {
kBlack = 0;
kNavy = 1;
kGreen = 2;
kTeal = 3;
kMaroon = 4;
kPurple = 5;
kOlive = 6;
kGray = 7;
kBlue = 8;
kLime = 9;
kAqua = 10;
kRed = 11;
kFuchsia = 12;
kYellow = 13;
kWhite = 14;
kNickel = 15;
kChrome = 16;
kBrass = 17;
kCopper = 18;
kSilver = 19;
kGold = 20;
}

enum ProductFinishEnum : ENUM8 {
kOther = 0;
kMatte = 1;
kSatin = 2;
kPolished = 3;
kRugged = 4;
kFabric = 5;
}

struct CapabilityMinimaStruct {
int16u caseSessionsPerFabric = 0;
int16u subscriptionsPerFabric = 1;
}

struct ProductAppearanceStruct {
ProductFinishEnum finish = 0;
nullable ColorEnum primaryColor = 1;
}

critical event StartUp = 0 {
INT32U softwareVersion = 0;
}
Expand Down
Loading

0 comments on commit 8d5a209

Please sign in to comment.