diff --git a/examples/platform/linux/CommissionableInit.cpp b/examples/platform/linux/CommissionableInit.cpp index 24fc347153c053..2669f52cf492ff 100644 --- a/examples/platform/linux/CommissionableInit.cpp +++ b/examples/platform/linux/CommissionableInit.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "CommissionableInit.h" @@ -99,6 +100,35 @@ CHIP_ERROR InitConfigurationManager(ConfigurationManagerImpl & configManager, Li configManager.StoreProductId(options.payload.productID); } + if (options.vendorName.HasValue()) + { + CharSpan vendor_name(options.vendorName.Value().c_str(), options.vendorName.Value().size()); + VerifyOrDie(configManager.StoreVendorName(vendor_name) == CHIP_NO_ERROR); + } + if (options.productName.HasValue()) + { + CharSpan product_name(options.productName.Value().c_str(), options.productName.Value().size()); + VerifyOrDie(configManager.StoreProductName(product_name) == CHIP_NO_ERROR); + } + if (options.hardwareVersionString.HasValue()) + { + CharSpan hardware_version_string(options.hardwareVersionString.Value().c_str(), + options.hardwareVersionString.Value().size()); + VerifyOrDie(configManager.StoreHardwareVersionString(hardware_version_string) == CHIP_NO_ERROR); + } + if (options.softwareVersionString.HasValue()) + { + CharSpan software_version_string(options.softwareVersionString.Value().c_str(), + options.softwareVersionString.Value().size()); + VerifyOrDie(configManager.StoreSoftwareVersionString(software_version_string) == CHIP_NO_ERROR); + } + + if (options.serialNumber.HasValue()) + { + CharSpan serial_number(options.serialNumber.Value().c_str(), options.serialNumber.Value().size()); + VerifyOrDie(configManager.StoreSerialNumber(serial_number) == CHIP_NO_ERROR); + } + return CHIP_NO_ERROR; } diff --git a/examples/platform/linux/Options.cpp b/examples/platform/linux/Options.cpp index 6f8afea5bb496b..56ca139b2e4bca 100644 --- a/examples/platform/linux/Options.cpp +++ b/examples/platform/linux/Options.cpp @@ -116,9 +116,17 @@ enum #if CHIP_WITH_NLFAULTINJECTION kDeviceOption_FaultInjection, #endif + #if CHIP_DEVICE_CONFIG_ENABLE_WIFIPAF kDeviceOption_WiFi_PAF, #endif + + kDeviceOption_VendorName = 0x1028, + kDeviceOption_ProductName = 0x1029, + kDeviceOption_HardwareVersionString = 0x102a, + kDeviceOption_SoftwareVersionString = 0x102b, + kDeviceOption_SerialNumber = 0x102c, + }; constexpr unsigned kAppUsageLength = 64; @@ -140,6 +148,11 @@ OptionDef sDeviceOptionDefs[] = { { "version", kArgumentRequired, kDeviceOption_Version }, { "vendor-id", kArgumentRequired, kDeviceOption_VendorID }, { "product-id", kArgumentRequired, kDeviceOption_ProductID }, + { "vendor-name", kArgumentRequired, kDeviceOption_VendorName }, + { "product-name", kArgumentRequired, kDeviceOption_ProductName }, + { "hardware-version-string", kArgumentRequired, kDeviceOption_HardwareVersionString }, + { "software-version-string", kArgumentRequired, kDeviceOption_SoftwareVersionString }, + { "serial-number", kArgumentRequired, kDeviceOption_SerialNumber }, { "custom-flow", kArgumentRequired, kDeviceOption_CustomFlow }, { "capabilities", kArgumentRequired, kDeviceOption_Capabilities }, { "discriminator", kArgumentRequired, kDeviceOption_Discriminator }, @@ -230,6 +243,21 @@ const char * sDeviceOptionHelp = " --product-id \n" " The Product ID is specified by vendor.\n" "\n" + " --vendor-name \n" + " The vendor name specified by the vendor.\n" + "\n" + " --product-name \n" + " The product name specified by vendor.\n" + "\n" + " --hardware-version-string \n" + " The HardwareVersionString used in the basic information cluster.\n" + "\n" + " --software-version-string \n" + " The SoftwareVersionString used in the basic information cluster.\n" + "\n" + " --serial-number \n" + " The serial number specified by vendor.\n" + "\n" " --custom-flow \n" " A 2-bit unsigned enumeration specifying manufacturer-specific custom flow options.\n" "\n" @@ -685,6 +713,26 @@ bool HandleOption(const char * aProgram, OptionSet * aOptions, int aIdentifier, break; } #endif + case kDeviceOption_VendorName: + LinuxDeviceOptions::GetInstance().vendorName.SetValue(std::string{ aValue }); + break; + + case kDeviceOption_ProductName: + LinuxDeviceOptions::GetInstance().productName.SetValue(std::string{ aValue }); + break; + + case kDeviceOption_HardwareVersionString: + LinuxDeviceOptions::GetInstance().hardwareVersionString.SetValue(std::string{ aValue }); + break; + + case kDeviceOption_SoftwareVersionString: + LinuxDeviceOptions::GetInstance().softwareVersionString.SetValue(std::string{ aValue }); + break; + + case kDeviceOption_SerialNumber: + LinuxDeviceOptions::GetInstance().serialNumber.SetValue(std::string{ aValue }); + break; + default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); retval = false; diff --git a/examples/platform/linux/Options.h b/examples/platform/linux/Options.h index 11a9061efcade8..23189e564635a1 100644 --- a/examples/platform/linux/Options.h +++ b/examples/platform/linux/Options.h @@ -87,10 +87,18 @@ struct LinuxDeviceOptions int32_t subscriptionCapacity = CHIP_IM_MAX_NUM_SUBSCRIPTIONS; int32_t subscriptionResumptionRetryIntervalSec = -1; #endif + #if CHIP_CONFIG_USE_ACCESS_RESTRICTIONS chip::Optional> commissioningArlEntries; chip::Optional> arlEntries; #endif + + chip::Optional vendorName; + chip::Optional productName; + chip::Optional hardwareVersionString; + chip::Optional softwareVersionString; + chip::Optional serialNumber; + static LinuxDeviceOptions & GetInstance(); }; diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index c7158d22c58d5e..b808f0c40d8062 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -114,7 +114,6 @@ class ConfigurationManager #endif virtual CHIP_ERROR GetRegulatoryLocation(uint8_t & location) = 0; virtual CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) = 0; - virtual CHIP_ERROR StoreSerialNumber(const char * serialNum, size_t serialNumLen) = 0; virtual CHIP_ERROR StoreManufacturingDate(const char * mfgDate, size_t mfgDateLen) = 0; virtual CHIP_ERROR StoreSoftwareVersion(uint32_t softwareVer) = 0; virtual CHIP_ERROR StoreHardwareVersion(uint16_t hardwareVer) = 0; @@ -133,6 +132,16 @@ class ConfigurationManager virtual CHIP_ERROR SetFailSafeArmed(bool val) = 0; virtual CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo) = 0; + virtual CHIP_ERROR StoreSerialNumber(CharSpan serialNumber) = 0; + virtual CHIP_ERROR StoreVendorName(CharSpan vendorName) = 0; + virtual CHIP_ERROR StoreProductName(CharSpan productName) = 0; + virtual CHIP_ERROR StoreHardwareVersionString(CharSpan hardwareVersionString) = 0; + virtual CHIP_ERROR StoreSoftwareVersionString(CharSpan softwareVersionString) = 0; + + virtual CHIP_ERROR StoreVendorName(const char * vendorName, size_t vendorNameLen) = 0; + virtual CHIP_ERROR StoreProductName(const char * productName, size_t productNameLen) = 0; + virtual CHIP_ERROR StoreHardwareVersionString(const char * hardwareVersionString, size_t hardwareVersionStringLen) = 0; + virtual CHIP_ERROR StoreSoftwareVersionString(const char * softwareVersionString, size_t softwareVersionStringLen) = 0; #if CHIP_CONFIG_TEST virtual void RunUnitTests() = 0; diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.h b/src/include/platform/internal/GenericConfigurationManagerImpl.h index fa7e19503f845e..ecfc9cc78c431f 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -68,7 +68,7 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreSoftwareVersion(uint32_t softwareVer) override; CHIP_ERROR GetFirmwareBuildChipEpochTime(System::Clock::Seconds32 & buildTime) override; CHIP_ERROR SetFirmwareBuildChipEpochTime(System::Clock::Seconds32 buildTime) override; - CHIP_ERROR StoreSerialNumber(const char * serialNum, size_t serialNumLen) override; + CHIP_ERROR StoreSerialNumber(CharSpan serialNumber) override; CHIP_ERROR GetPrimaryMACAddress(MutableByteSpan buf) override; CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override; CHIP_ERROR GetPrimary802154MACAddress(uint8_t * buf) override; @@ -103,6 +103,17 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR GetUniqueId(char * buf, size_t bufSize) override; CHIP_ERROR StoreUniqueId(const char * uniqueId, size_t uniqueIdLen) override; CHIP_ERROR GenerateUniqueId(char * buf, size_t bufSize) override; + + CHIP_ERROR StoreVendorName(CharSpan vendorName) override; + CHIP_ERROR StoreProductName(CharSpan productName) override; + CHIP_ERROR StoreHardwareVersionString(CharSpan hardwareVersionString) override; + CHIP_ERROR StoreSoftwareVersionString(CharSpan softwareVersionString) override; + + CHIP_ERROR StoreVendorName(const char * vendorName, size_t vendorNameLen) override; + CHIP_ERROR StoreProductName(const char * productName, size_t productNameLen) override; + CHIP_ERROR StoreHardwareVersionString(const char * hardwareVersionString, size_t hardwareVersionStringLen) override; + CHIP_ERROR StoreSoftwareVersionString(const char * softwareVersionString, size_t softwareVersionStringLen) override; + #if CHIP_CONFIG_TEST void RunUnitTests() override; #endif diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp index 9b36f341042aa9..bdd63365d38aef 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -351,15 +351,74 @@ CHIP_ERROR GenericConfigurationManagerImpl::GetSecondaryPairingHint template CHIP_ERROR GenericConfigurationManagerImpl::GetSoftwareVersionString(char * buf, size_t bufSize) { - ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING), CHIP_ERROR_BUFFER_TOO_SMALL); - strcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING); - return CHIP_NO_ERROR; + + CHIP_ERROR err = CHIP_NO_ERROR; + size_t softwareVersionStringLen = 0; // without counting null-terminator + + err = ReadConfigValueStr(ConfigClass::kConfigKey_SoftwareVersionString, buf, bufSize, softwareVersionStringLen); + + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING, sizeof(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING)); + + return CHIP_NO_ERROR; + } + + VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL); + + return err; } template -CHIP_ERROR GenericConfigurationManagerImpl::StoreSerialNumber(const char * serialNum, size_t serialNumLen) +CHIP_ERROR GenericConfigurationManagerImpl::StoreSerialNumber(CharSpan serialNumber) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_SerialNum, serialNumber.data(), serialNumber.size()); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreVendorName(CharSpan vendorName) +{ + + return WriteConfigValueStr(ConfigClass::kConfigKey_VendorName, vendorName.data(), vendorName.size()); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreProductName(CharSpan productName) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_ProductName, productName.data(), productName.size()); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreHardwareVersionString(CharSpan hardwareVersionString) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_HardwareVersionString, hardwareVersionString.data(), + hardwareVersionString.size()); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreSoftwareVersionString(CharSpan softwareVersionString) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_SoftwareVersionString, softwareVersionString.data(), + softwareVersionString.size()); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreVendorName(const char * vendorName, size_t vendorNameLen) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_VendorName, vendorName, vendorNameLen); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreProductName(const char * productName, size_t productNameLen) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_ProductName, productName, productNameLen); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreHardwareVersionString(const char * hardwareVersionString, + size_t hardwareVersionStringLen) +{ + return WriteConfigValueStr(ConfigClass::kConfigKey_HardwareVersionString, hardwareVersionString, hardwareVersionStringLen); +} +template +CHIP_ERROR GenericConfigurationManagerImpl::StoreSoftwareVersionString(const char * softwareVersionString, + size_t softwareVersionStringLen) { - return WriteConfigValueStr(ConfigClass::kConfigKey_SerialNum, serialNum, serialNumLen); + return WriteConfigValueStr(ConfigClass::kConfigKey_SoftwareVersionString, softwareVersionString, softwareVersionStringLen); } template diff --git a/src/include/platform/internal/GenericDeviceInstanceInfoProvider.ipp b/src/include/platform/internal/GenericDeviceInstanceInfoProvider.ipp index 549c3eb360aa95..af05ac4d3b134b 100644 --- a/src/include/platform/internal/GenericDeviceInstanceInfoProvider.ipp +++ b/src/include/platform/internal/GenericDeviceInstanceInfoProvider.ipp @@ -38,18 +38,42 @@ CHIP_ERROR GenericDeviceInstanceInfoProvider::GetProductId(uint16_t template CHIP_ERROR GenericDeviceInstanceInfoProvider::GetVendorName(char * buf, size_t bufSize) { - ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME), CHIP_ERROR_BUFFER_TOO_SMALL); - strcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME); - return CHIP_NO_ERROR; + ChipError err = CHIP_NO_ERROR; + size_t vendorNameLen = 0; // without counting null-terminator + + err = mGenericConfigManager.ReadConfigValueStr(ConfigClass::kConfigKey_VendorName, buf, bufSize, vendorNameLen); + + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME, sizeof(CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME)); + err = CHIP_NO_ERROR; + } + + VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL); + + return err; } template CHIP_ERROR GenericDeviceInstanceInfoProvider::GetProductName(char * buf, size_t bufSize) { - ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME), CHIP_ERROR_BUFFER_TOO_SMALL); - strcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME); - return CHIP_NO_ERROR; + ChipError err = CHIP_NO_ERROR; + size_t productNameLen = 0; // without counting null-terminator + + err = mGenericConfigManager.ReadConfigValueStr(ConfigClass::kConfigKey_ProductName, buf, bufSize, productNameLen); + + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(buf, CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME, sizeof(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME)); + err = CHIP_NO_ERROR; + } + + VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL); + + return err; } template @@ -96,19 +120,15 @@ CHIP_ERROR GenericDeviceInstanceInfoProvider::GetSerialNumber(char err = mGenericConfigManager.ReadConfigValueStr(ConfigClass::kConfigKey_SerialNum, buf, bufSize, serialNumLen); -#ifdef CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - if (CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER[0] != 0 && err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { ReturnErrorCodeIf(sizeof(CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER) > bufSize, CHIP_ERROR_BUFFER_TOO_SMALL); memcpy(buf, CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER, sizeof(CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER)); - serialNumLen = sizeof(CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER) - 1; - err = CHIP_NO_ERROR; + + err = CHIP_NO_ERROR; } -#endif // CHIP_DEVICE_CONFIG_TEST_SERIAL_NUMBER - ReturnErrorOnFailure(err); - ReturnErrorCodeIf(serialNumLen >= bufSize, CHIP_ERROR_BUFFER_TOO_SMALL); - ReturnErrorCodeIf(buf[serialNumLen] != 0, CHIP_ERROR_INVALID_STRING_LENGTH); + VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL); return err; } @@ -176,9 +196,24 @@ CHIP_ERROR GenericDeviceInstanceInfoProvider::GetHardwareVersion(ui template CHIP_ERROR GenericDeviceInstanceInfoProvider::GetHardwareVersionString(char * buf, size_t bufSize) { - ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING), CHIP_ERROR_BUFFER_TOO_SMALL); - strcpy(buf, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING); - return CHIP_NO_ERROR; + + ChipError err = CHIP_NO_ERROR; + size_t hardwareVersionStringLen = 0; // without counting null-terminator + + err = mGenericConfigManager.ReadConfigValueStr(ConfigClass::kConfigKey_HardwareVersionString, buf, bufSize, + hardwareVersionStringLen); + + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + ReturnErrorCodeIf(bufSize < sizeof(CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(buf, CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING, + sizeof(CHIP_DEVICE_CONFIG_DEFAULT_DEVICE_HARDWARE_VERSION_STRING)); + err = CHIP_NO_ERROR; + } + + VerifyOrReturnError(err == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL); + + return err; } template diff --git a/src/platform/ASR/ASRConfig.cpp b/src/platform/ASR/ASRConfig.cpp index 1e87f3af518804..2a07f631384a29 100644 --- a/src/platform/ASR/ASRConfig.cpp +++ b/src/platform/ASR/ASRConfig.cpp @@ -80,6 +80,11 @@ const ASRConfig::Key ASRConfig::kConfigKey_WiFiSecurity = { kConfigNamespa const ASRConfig::Key ASRConfig::kConfigKey_WiFiMode = { kConfigNamespace_ChipConfig, "wifimode" }; const ASRConfig::Key ASRConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipConfig, "unique-id" }; +const ASRConfig::Key ASRConfig::kConfigKey_VendorName = { kConfigNamespace_ChipConfig, "vendor-name" }; +const ASRConfig::Key ASRConfig::kConfigKey_ProductName = { kConfigNamespace_ChipConfig, "product-name" }; +const ASRConfig::Key ASRConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipConfig, "hardware-version-string" }; +const ASRConfig::Key ASRConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "software-version-string" }; + // Keys stored in the Chip-counters namespace const ASRConfig::Key ASRConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const ASRConfig::Key ASRConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/ASR/ASRConfig.h b/src/platform/ASR/ASRConfig.h index 71c90a3a79b242..b27f77dd5ffd10 100755 --- a/src/platform/ASR/ASRConfig.h +++ b/src/platform/ASR/ASRConfig.h @@ -91,6 +91,11 @@ class ASRConfig static const Key kCounterKey_UpTime; static const Key kCounterKey_TotalOperationalHours; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // Config value accessors. static CHIP_ERROR ReadConfigValue(Key key, bool & val); static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val); diff --git a/src/platform/Ameba/AmebaConfig.cpp b/src/platform/Ameba/AmebaConfig.cpp index 6ac7948da07794..c59221ddbcf710 100644 --- a/src/platform/Ameba/AmebaConfig.cpp +++ b/src/platform/Ameba/AmebaConfig.cpp @@ -79,6 +79,11 @@ const AmebaConfig::Key AmebaConfig::kConfigKey_RegulatoryLocation = { k const AmebaConfig::Key AmebaConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" }; const AmebaConfig::Key AmebaConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; +const AmebaConfig::Key AmebaConfig::kConfigKey_VendorName = { kConfigNamespace_ChipConfig, "vendor-name" }; +const AmebaConfig::Key AmebaConfig::kConfigKey_ProductName = { kConfigNamespace_ChipConfig, "product-name" }; +const AmebaConfig::Key AmebaConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipConfig, "hardware-version-string" }; +const AmebaConfig::Key AmebaConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "software-version-string" }; + // Keys stored in the Chip-counters namespace const AmebaConfig::Key AmebaConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const AmebaConfig::Key AmebaConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/Ameba/AmebaConfig.h b/src/platform/Ameba/AmebaConfig.h index 0c78e0e3a742bd..0c100b4713bd05 100755 --- a/src/platform/Ameba/AmebaConfig.h +++ b/src/platform/Ameba/AmebaConfig.h @@ -74,6 +74,11 @@ class AmebaConfig static const Key kCounterKey_TotalOperationalHours; static const Key kCounterKey_BootReason; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // Config value accessors. static CHIP_ERROR ReadConfigValue(Key key, bool & val); static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val); diff --git a/src/platform/Beken/BekenConfig.cpp b/src/platform/Beken/BekenConfig.cpp index 60e2cdb09645f7..593001f9c8c73e 100644 --- a/src/platform/Beken/BekenConfig.cpp +++ b/src/platform/Beken/BekenConfig.cpp @@ -79,6 +79,11 @@ const BekenConfig::Key BekenConfig::kConfigKey_RegulatoryLocation = { k const BekenConfig::Key BekenConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; const BekenConfig::Key BekenConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; +const BekenConfig::Key BekenConfig::kConfigKey_VendorName = { kConfigNamespace_ChipConfig, "vendor-name" }; +const BekenConfig::Key BekenConfig::kConfigKey_ProductName = { kConfigNamespace_ChipConfig, "product-name" }; +const BekenConfig::Key BekenConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipConfig, "hardware-version-string" }; +const BekenConfig::Key BekenConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "software-version-string" }; + // Keys stored in the Chip-counters namespace const BekenConfig::Key BekenConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const BekenConfig::Key BekenConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/Beken/BekenConfig.h b/src/platform/Beken/BekenConfig.h index 94362c092296f8..819d379267a3fd 100755 --- a/src/platform/Beken/BekenConfig.h +++ b/src/platform/Beken/BekenConfig.h @@ -74,6 +74,11 @@ class BekenConfig static const Key kCounterKey_TotalOperationalHours; static const Key kCounterKey_BootReason; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const char kGroupKeyNamePrefix[]; // Config value accessors. diff --git a/src/platform/Darwin/PosixConfig.cpp b/src/platform/Darwin/PosixConfig.cpp index d54713edf532de..4fbd4da4671883 100644 --- a/src/platform/Darwin/PosixConfig.cpp +++ b/src/platform/Darwin/PosixConfig.cpp @@ -56,6 +56,11 @@ const PosixConfig::Key PosixConfig::kConfigKey_Spake2pVerifier = { kConfig const PosixConfig::Key PosixConfig::kConfigKey_VendorId = { kConfigNamespace_ChipFactory, "vendor-id" }; const PosixConfig::Key PosixConfig::kConfigKey_ProductId = { kConfigNamespace_ChipFactory, "product-id" }; +const PosixConfig::Key PosixConfig::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_ProductName = { kConfigNamespace_ChipFactory, "product-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipFactory, "hardware-version-string" }; +const PosixConfig::Key PosixConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipFactory, "software-version-string" }; + // Keys stored in the Chip-config namespace const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNamespace_ChipConfig, "fail-safe-armed" }; const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; diff --git a/src/platform/Darwin/PosixConfig.h b/src/platform/Darwin/PosixConfig.h index fe4c1dd48a4250..822f04a4335a9d 100644 --- a/src/platform/Darwin/PosixConfig.h +++ b/src/platform/Darwin/PosixConfig.h @@ -72,6 +72,11 @@ class PosixConfig static const Key kCounterKey_RebootCount; static const Key kCounterKey_BootReason; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + #if !CHIP_DISABLE_PLATFORM_KVS static CHIP_ERROR Init(void); diff --git a/src/platform/ESP32/ESP32Config.cpp b/src/platform/ESP32/ESP32Config.cpp index df48f5f2955793..1d4528ad00584e 100644 --- a/src/platform/ESP32/ESP32Config.cpp +++ b/src/platform/ESP32/ESP32Config.cpp @@ -101,6 +101,8 @@ const ESP32Config::Key ESP32Config::kConfigKey_WeekDaySchedules = { kConfigNam const ESP32Config::Key ESP32Config::kConfigKey_YearDaySchedules = { kConfigNamespace_ChipConfig, "year-day-sched" }; const ESP32Config::Key ESP32Config::kConfigKey_HolidaySchedules = { kConfigNamespace_ChipConfig, "holiday-sched" }; +const ESP32Config::Key ESP32Config::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "sw-ver-str" }; + // Keys stored in the Chip-counters namespace const ESP32Config::Key ESP32Config::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const ESP32Config::Key ESP32Config::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/ESP32/ESP32Config.h b/src/platform/ESP32/ESP32Config.h index f2f03cf7f9074b..c3e7a26bf15792 100644 --- a/src/platform/ESP32/ESP32Config.h +++ b/src/platform/ESP32/ESP32Config.h @@ -103,6 +103,8 @@ class ESP32Config static const Key kConfigKey_YearDaySchedules; static const Key kConfigKey_HolidaySchedules; + static const Key kConfigKey_SoftwareVersionString; + // CHIP Counter keys static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; diff --git a/src/platform/Infineon/CYW30739/CYW30739Config.h b/src/platform/Infineon/CYW30739/CYW30739Config.h index 24b074689d0ecf..47079943908b2a 100644 --- a/src/platform/Infineon/CYW30739/CYW30739Config.h +++ b/src/platform/Infineon/CYW30739/CYW30739Config.h @@ -71,6 +71,8 @@ class CYW30739Config static constexpr Key kConfigKey_DACKey = CYW30739ConfigKey(kChipFactory_KeyBase, 0x21); static constexpr Key kConfigKey_PAICert = CYW30739ConfigKey(kChipFactory_KeyBase, 0x22); static constexpr Key kConfigKey_CertDeclaration = CYW30739ConfigKey(kChipFactory_KeyBase, 0x23); + static constexpr Key kConfigKey_SoftwareVersionString = CYW30739ConfigKey(kChipFactory_KeyBase, 0x24); + // CHIP Config Keys static constexpr Key kConfigKey_ServiceConfig = CYW30739ConfigKey(kChipConfig_KeyBase, 0x00); static constexpr Key kConfigKey_PairedAccountId = CYW30739ConfigKey(kChipConfig_KeyBase, 0x01); diff --git a/src/platform/Infineon/PSOC6/PSOC6Config.cpp b/src/platform/Infineon/PSOC6/PSOC6Config.cpp index 1c040811686fa3..0e64767b0847af 100644 --- a/src/platform/Infineon/PSOC6/PSOC6Config.cpp +++ b/src/platform/Infineon/PSOC6/PSOC6Config.cpp @@ -82,12 +82,13 @@ const PSOC6Config::Key PSOC6Config::kConfigKey_LockUserName = { kConfigNam const PSOC6Config::Key PSOC6Config::kConfigKey_CredentialData = { kConfigNamespace_ChipConfig, "credential-data" }; const PSOC6Config::Key PSOC6Config::kConfigKey_UserCredentials = { kConfigNamespace_ChipConfig, "user-credentials" }; const PSOC6Config::Key PSOC6Config::kConfigKey_WeekDaySchedules = { kConfigNamespace_ChipConfig, "weekday-schedules" }; -; -const PSOC6Config::Key PSOC6Config::kConfigKey_YearDaySchedules = { kConfigNamespace_ChipConfig, "yearday-schedules" }; -; -const PSOC6Config::Key PSOC6Config::kConfigKey_HolidaySchedules = { kConfigNamespace_ChipConfig, "holiday-schedules" }; -; +const PSOC6Config::Key PSOC6Config::kConfigKey_YearDaySchedules = { kConfigNamespace_ChipConfig, "yearday-schedules" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_HolidaySchedules = { kConfigNamespace_ChipConfig, "holiday-schedules" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_VendorName = { kConfigNamespace_ChipConfig, "vendor-name" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_ProductName = { kConfigNamespace_ChipConfig, "product-name" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipConfig, "hardware-version-string" }; +const PSOC6Config::Key PSOC6Config::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "software-version-string" }; // Keys stored in the Chip-counters namespace const PSOC6Config::Key PSOC6Config::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const PSOC6Config::Key PSOC6Config::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/Infineon/PSOC6/PSOC6Config.h b/src/platform/Infineon/PSOC6/PSOC6Config.h index 17fa896346c348..a1c77c648526f6 100644 --- a/src/platform/Infineon/PSOC6/PSOC6Config.h +++ b/src/platform/Infineon/PSOC6/PSOC6Config.h @@ -89,6 +89,11 @@ class PSOC6Config static const Key kConfigKey_YearDaySchedules; static const Key kConfigKey_HolidaySchedules; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // CHIP Counter keys static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; diff --git a/src/platform/Linux/PosixConfig.cpp b/src/platform/Linux/PosixConfig.cpp index 61a1fbd4dda6ed..c44a67d4fb3d23 100644 --- a/src/platform/Linux/PosixConfig.cpp +++ b/src/platform/Linux/PosixConfig.cpp @@ -63,6 +63,11 @@ const PosixConfig::Key PosixConfig::kConfigKey_Spake2pVerifier = { kConfig const PosixConfig::Key PosixConfig::kConfigKey_VendorId = { kConfigNamespace_ChipFactory, "vendor-id" }; const PosixConfig::Key PosixConfig::kConfigKey_ProductId = { kConfigNamespace_ChipFactory, "product-id" }; +const PosixConfig::Key PosixConfig::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_ProductName = { kConfigNamespace_ChipFactory, "product-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipFactory, "hardware-version-string" }; +const PosixConfig::Key PosixConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipFactory, "software-version-string" }; + // Keys stored in the Chip-config namespace const PosixConfig::Key PosixConfig::kConfigKey_ServiceConfig = { kConfigNamespace_ChipConfig, "service-config" }; const PosixConfig::Key PosixConfig::kConfigKey_PairedAccountId = { kConfigNamespace_ChipConfig, "account-id" }; diff --git a/src/platform/Linux/PosixConfig.h b/src/platform/Linux/PosixConfig.h index c04d4a9be1093f..22c78e30d457fc 100644 --- a/src/platform/Linux/PosixConfig.h +++ b/src/platform/Linux/PosixConfig.h @@ -83,6 +83,11 @@ class PosixConfig static const Key kCounterKey_TotalOperationalHours; static const Key kCounterKey_BootReason; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static CHIP_ERROR Init(); // Config value accessors. diff --git a/src/platform/NuttX/PosixConfig.cpp b/src/platform/NuttX/PosixConfig.cpp index 8e8feda20de202..d357ff24e363e2 100644 --- a/src/platform/NuttX/PosixConfig.cpp +++ b/src/platform/NuttX/PosixConfig.cpp @@ -74,6 +74,11 @@ const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" }; const PosixConfig::Key PosixConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipFactory, "unique-id" }; +const PosixConfig::Key PosixConfig::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_ProductName = { kConfigNamespace_ChipFactory, "product-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipFactory, "hardware-version-string" }; +const PosixConfig::Key PosixConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipFactory, "software-version-string" }; + // Keys stored in the Chip-counters namespace const PosixConfig::Key PosixConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const PosixConfig::Key PosixConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/NuttX/PosixConfig.h b/src/platform/NuttX/PosixConfig.h index c04d4a9be1093f..d0594cf69ed788 100644 --- a/src/platform/NuttX/PosixConfig.h +++ b/src/platform/NuttX/PosixConfig.h @@ -78,6 +78,11 @@ class PosixConfig static const Key kConfigKey_VendorId; static const Key kConfigKey_ProductId; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; static const Key kCounterKey_TotalOperationalHours; diff --git a/src/platform/Tizen/ConfigurationManagerImpl.cpp b/src/platform/Tizen/ConfigurationManagerImpl.cpp index 8efe079993b7aa..dd6a33fac62fc7 100644 --- a/src/platform/Tizen/ConfigurationManagerImpl.cpp +++ b/src/platform/Tizen/ConfigurationManagerImpl.cpp @@ -26,6 +26,7 @@ #include "ConfigurationManagerImpl.h" #include +#include #include #include #include @@ -59,12 +60,24 @@ CHIP_ERROR ConfigurationManagerImpl::Init() SuccessOrExit(error); } + if (!Internal::PosixConfig::ConfigValueExists(Internal::PosixConfig::kConfigKey_VendorName)) + { + error = StoreVendorName(chip::CharSpan::fromCharString(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME)); + SuccessOrExit(error); + } + if (!Internal::PosixConfig::ConfigValueExists(Internal::PosixConfig::kConfigKey_ProductId)) { error = StoreProductId(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID); SuccessOrExit(error); } + if (!Internal::PosixConfig::ConfigValueExists(Internal::PosixConfig::kConfigKey_ProductName)) + { + error = StoreProductName(chip::CharSpan::fromCharString(CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME)); + SuccessOrExit(error); + } + error = CHIP_NO_ERROR; exit: diff --git a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp index 93ad7a18015762..022e40a0f491d5 100644 --- a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp +++ b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.cpp @@ -33,5 +33,17 @@ CHIP_ERROR DeviceInstanceInfoProviderImpl::GetProductId(uint16_t & productId) return Internal::PosixConfig::ReadConfigValue(Internal::PosixConfig::kConfigKey_ProductId, productId); } +CHIP_ERROR DeviceInstanceInfoProviderImpl::GetVendorName(char * buf, size_t bufSize) +{ + size_t vendorNameLen = 0; + return Internal::PosixConfig::ReadConfigValueStr(Internal::PosixConfig::kConfigKey_VendorName, buf, bufSize, vendorNameLen); +} + +CHIP_ERROR DeviceInstanceInfoProviderImpl::GetProductName(char * buf, size_t bufSize) +{ + size_t productNameLen = 0; + return Internal::PosixConfig::ReadConfigValueStr(Internal::PosixConfig::kConfigKey_ProductName, buf, bufSize, productNameLen); +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h index 32e6a2cc5abec0..13f8045f6e4cbe 100644 --- a/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h +++ b/src/platform/Tizen/DeviceInstanceInfoProviderImpl.h @@ -34,6 +34,8 @@ class DeviceInstanceInfoProviderImpl : public Internal::GenericDeviceInstanceInf public: CHIP_ERROR GetVendorId(uint16_t & vendorId) override; CHIP_ERROR GetProductId(uint16_t & productId) override; + CHIP_ERROR GetVendorName(char * buf, size_t bufSize) override; + CHIP_ERROR GetProductName(char * buf, size_t bufSize) override; DeviceInstanceInfoProviderImpl(ConfigurationManagerImpl & configManager) : Internal::GenericDeviceInstanceInfoProvider(configManager) diff --git a/src/platform/Tizen/PosixConfig.cpp b/src/platform/Tizen/PosixConfig.cpp index e6f18834ef6396..046d40a9c7a303 100644 --- a/src/platform/Tizen/PosixConfig.cpp +++ b/src/platform/Tizen/PosixConfig.cpp @@ -66,6 +66,11 @@ const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; const PosixConfig::Key PosixConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipConfig, "unique-id" }; +const PosixConfig::Key PosixConfig::kConfigKey_VendorName = { kConfigNamespace_ChipConfig, "vendor-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_ProductName = { kConfigNamespace_ChipConfig, "product-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipConfig, "hardware-version-string" }; +const PosixConfig::Key PosixConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipConfig, "software-version-string" }; + // Keys stored in the Chip-counters namespace const PosixConfig::Key PosixConfig::kCounterKey_TotalOperationalHours = { kConfigNamespace_ChipCounters, "total-operational-hours" }; diff --git a/src/platform/Tizen/PosixConfig.h b/src/platform/Tizen/PosixConfig.h index a5d8d6a6a8d45d..68353b2b4131ca 100644 --- a/src/platform/Tizen/PosixConfig.h +++ b/src/platform/Tizen/PosixConfig.h @@ -75,6 +75,11 @@ class PosixConfig static const Key kConfigKey_VendorId; static const Key kConfigKey_ProductId; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const Key kCounterKey_TotalOperationalHours; static const Key kCounterKey_BootReason; diff --git a/src/platform/Zephyr/ZephyrConfig.cpp b/src/platform/Zephyr/ZephyrConfig.cpp index f548e95bca09a7..ceb4e54e00bd0e 100644 --- a/src/platform/Zephyr/ZephyrConfig.cpp +++ b/src/platform/Zephyr/ZephyrConfig.cpp @@ -73,6 +73,11 @@ const ZephyrConfig::Key ZephyrConfig::kConfigKey_RegulatoryLocation = CONFIG_KEY const ZephyrConfig::Key ZephyrConfig::kConfigKey_CountryCode = CONFIG_KEY(NAMESPACE_CONFIG "country-code"); const ZephyrConfig::Key ZephyrConfig::kConfigKey_UniqueId = CONFIG_KEY(NAMESPACE_CONFIG "unique-id"); +const ZephyrConfig::Key ZephyrConfig::kConfigKey_VendorName = CONFIG_KEY(NAMESPACE_CONFIG "vendor-name"); +const ZephyrConfig::Key ZephyrConfig::kConfigKey_ProductName = CONFIG_KEY(NAMESPACE_CONFIG "product-name"); +const ZephyrConfig::Key ZephyrConfig::kConfigKey_HardwareVersionString = CONFIG_KEY(NAMESPACE_CONFIG "hardware-version-string"); +const ZephyrConfig::Key ZephyrConfig::kConfigKey_SoftwareVersionString = CONFIG_KEY(NAMESPACE_CONFIG "software-version-string"); + // Keys stored in the counters namespace const ZephyrConfig::Key ZephyrConfig::kCounterKey_RebootCount = CONFIG_KEY(NAMESPACE_COUNTERS "reboot-count"); const ZephyrConfig::Key ZephyrConfig::kCounterKey_BootReason = CONFIG_KEY(NAMESPACE_COUNTERS "boot-reason"); diff --git a/src/platform/Zephyr/ZephyrConfig.h b/src/platform/Zephyr/ZephyrConfig.h index b451d0c13997e9..7e43667a76204e 100644 --- a/src/platform/Zephyr/ZephyrConfig.h +++ b/src/platform/Zephyr/ZephyrConfig.h @@ -66,6 +66,11 @@ class ZephyrConfig static const Key kConfigKey_Spake2pVerifier; static const Key kConfigKey_CertificationDeclaration; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const Key kCounterKey_RebootCount; static const Key kCounterKey_BootReason; static const Key kCounterKey_TotalOperationalHours; diff --git a/src/platform/android/AndroidConfig.cpp b/src/platform/android/AndroidConfig.cpp index afca2b43f3e96b..4ee83f18bec90a 100644 --- a/src/platform/android/AndroidConfig.cpp +++ b/src/platform/android/AndroidConfig.cpp @@ -82,6 +82,7 @@ const AndroidConfig::Key AndroidConfig::kConfigKey_Spake2pSalt = { kCo const AndroidConfig::Key AndroidConfig::kConfigKey_Spake2pVerifier = { kConfigNamespace_ChipFactory, "verifier" }; const AndroidConfig::Key AndroidConfig::kConfigKey_DeviceTypeId = { kConfigNamespace_ChipFactory, "device-type-id" }; const AndroidConfig::Key AndroidConfig::kConfigKey_DeviceName = { kConfigNamespace_ChipFactory, "device-name" }; +const AndroidConfig::Key AndroidConfig::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" }; // Keys stored in the Chip-config namespace const AndroidConfig::Key AndroidConfig::kConfigKey_ServiceConfig = { kConfigNamespace_ChipConfig, "service-config" }; diff --git a/src/platform/android/AndroidConfig.h b/src/platform/android/AndroidConfig.h index 507a2b62e87da8..4d3d03638943e4 100644 --- a/src/platform/android/AndroidConfig.h +++ b/src/platform/android/AndroidConfig.h @@ -84,6 +84,8 @@ class AndroidConfig static const Key kConfigKey_DeviceTypeId; static const Key kConfigKey_DeviceName; + static const Key kConfigKey_VendorName; + static CHIP_ERROR Init(); // Config value accessors. diff --git a/src/platform/bouffalolab/common/BLConfig.h b/src/platform/bouffalolab/common/BLConfig.h index bb9f57fd01b639..7f9885731b2136 100644 --- a/src/platform/bouffalolab/common/BLConfig.h +++ b/src/platform/bouffalolab/common/BLConfig.h @@ -77,6 +77,11 @@ class BLConfig static constexpr char kBLKey_factoryResetFlag[] = ("__factory_reset_pending"); + static constexpr char kConfigKey_VendorName[] = ("vendor-name"); + static constexpr char kConfigKey_ProductName[] = ("product-name"); + static constexpr char kConfigKey_HardwareVersionString[] = ("hardware-version-string"); + static constexpr char kConfigKey_SoftwareVersionString[] = ("software-version-string"); + static void Init(void); // Config value accessors. diff --git a/src/platform/cc13xx_26xx/CC13XX_26XXConfig.cpp b/src/platform/cc13xx_26xx/CC13XX_26XXConfig.cpp index b4ea1ec2924378..d983b3b19ea6e7 100644 --- a/src/platform/cc13xx_26xx/CC13XX_26XXConfig.cpp +++ b/src/platform/cc13xx_26xx/CC13XX_26XXConfig.cpp @@ -123,6 +123,18 @@ const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_UniqueId = { { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipConfig, .subID = 0x0001d } }; +const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_VendorName = { + { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipConfig, .subID = 0x0001e } +}; +const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_ProductName = { + { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipConfig, .subID = 0x0001f } +}; +const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_HardwareVersionString = { + { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipConfig, .subID = 0x00020 } +}; +const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_SoftwareVersionString = { + { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipConfig, .subID = 0x00021 } +}; /* Internal for the KVS interface. */ const CC13XX_26XXConfig::Key CC13XX_26XXConfig::kConfigKey_KVS_key = { { .systemID = kCC13XX_26XXMatter_SysID, .itemID = kCC13XX_26XXMatter_ItemID_ChipKVS_key } }; diff --git a/src/platform/cc13xx_26xx/CC13XX_26XXConfig.h b/src/platform/cc13xx_26xx/CC13XX_26XXConfig.h index 2450c0f8c50544..0dcc405fc19553 100644 --- a/src/platform/cc13xx_26xx/CC13XX_26XXConfig.h +++ b/src/platform/cc13xx_26xx/CC13XX_26XXConfig.h @@ -82,6 +82,11 @@ class CC13XX_26XXConfig static const Key kConfigKey_TotalOperationalHours; static const Key kConfigKey_LifeTimeCounter; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static CHIP_ERROR Init(void); // Config value accessors. diff --git a/src/platform/cc32xx/CC32XXConfig.cpp b/src/platform/cc32xx/CC32XXConfig.cpp index 7eace22b7dbc5e..1dcfc9f37ef43a 100644 --- a/src/platform/cc32xx/CC32XXConfig.cpp +++ b/src/platform/cc32xx/CC32XXConfig.cpp @@ -318,6 +318,11 @@ const CC32XXConfig::Key CC32XXConfig::kConfigKey_Spake2pIterationCount = { "TI_k const CC32XXConfig::Key CC32XXConfig::kConfigKey_Spake2pSalt = { "TI_kConfigKey_Spake2pSalt" }; const CC32XXConfig::Key CC32XXConfig::kConfigKey_Spake2pVerifier = { "TI_kConfigKey_Spake2pVerifier" }; +const CC32XXConfig::Key CC32XXConfig::kConfigKey_VendorName = { "TI_kConfigKey_VendorName" }; +const CC32XXConfig::Key CC32XXConfig::kConfigKey_ProductName = { "TI_kConfigKey_ProductName" }; +const CC32XXConfig::Key CC32XXConfig::kConfigKey_HardwareVersionString = { "TI_kConfigKey_HardwareVersionString" }; +const CC32XXConfig::Key CC32XXConfig::kConfigKey_SoftwareVersionString = { "TI_kConfigKey_SoftwareVersionString" }; + CC32XXKVSList * pList; CHIP_ERROR CC32XXConfig::Init() diff --git a/src/platform/cc32xx/CC32XXConfig.h b/src/platform/cc32xx/CC32XXConfig.h index 8179d9877a4489..73c503b929d4c8 100644 --- a/src/platform/cc32xx/CC32XXConfig.h +++ b/src/platform/cc32xx/CC32XXConfig.h @@ -57,6 +57,11 @@ class CC32XXConfig static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_UniqueId; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/fake/ConfigurationManagerImpl.h b/src/platform/fake/ConfigurationManagerImpl.h index 510b2fc0dacc83..89e0c59c0d7df4 100644 --- a/src/platform/fake/ConfigurationManagerImpl.h +++ b/src/platform/fake/ConfigurationManagerImpl.h @@ -49,7 +49,11 @@ class ConfigurationManagerImpl : public ConfigurationManager } CHIP_ERROR GetSoftwareVersion(uint32_t & softwareVer) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR StoreSoftwareVersion(uint32_t softwareVer) override { return CHIP_ERROR_NOT_IMPLEMENTED; } - CHIP_ERROR StoreSerialNumber(const char * serialNum, size_t serialNumLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreSerialNumber(CharSpan serialNumber) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreVendorName(CharSpan vendorName) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreProductName(CharSpan productName) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreHardwareVersionString(CharSpan hardwareVersionString) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreSoftwareVersionString(CharSpan softwareVersionString) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetPrimaryMACAddress(MutableByteSpan buf) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetPrimaryWiFiMACAddress(uint8_t * buf) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetPrimary802154MACAddress(uint8_t * buf) override { return CHIP_ERROR_NOT_IMPLEMENTED; } @@ -85,6 +89,18 @@ class ConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR GetUniqueId(char * buf, size_t bufSize) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR StoreUniqueId(const char * uniqueId, size_t uniqueIdLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GenerateUniqueId(char * buf, size_t bufSize) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + + CHIP_ERROR StoreVendorName(const char * vendorName, size_t vendorNameLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreProductName(const char * productName, size_t productNameLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + CHIP_ERROR StoreHardwareVersionString(const char * hardwareVersionString, size_t hardwareVersionStringLen) override + { + return CHIP_ERROR_NOT_IMPLEMENTED; + } + CHIP_ERROR StoreSoftwareVersionString(const char * softwareVersionString, size_t softwareVersionStringLen) override + { + return CHIP_ERROR_NOT_IMPLEMENTED; + } + #if CHIP_CONFIG_TEST void RunUnitTests() override {} #endif diff --git a/src/platform/mbed/MbedConfig.cpp b/src/platform/mbed/MbedConfig.cpp index 63d5f87295c145..39ddacea059a29 100644 --- a/src/platform/mbed/MbedConfig.cpp +++ b/src/platform/mbed/MbedConfig.cpp @@ -85,6 +85,11 @@ const MbedConfig::Key MbedConfig::kConfigKey_RegulatoryLocation = { CONFIG_KEY(" const MbedConfig::Key MbedConfig::kConfigKey_CountryCode = { CONFIG_KEY("country-code") }; const MbedConfig::Key MbedConfig::kConfigKey_UniqueId = { CONFIG_KEY("unique-id") }; +const MbedConfig::Key MbedConfig::kConfigKey_VendorName = { CONFIG_KEY("vendor-name") }; +const MbedConfig::Key MbedConfig::kConfigKey_ProductName = { CONFIG_KEY("product-name") }; +const MbedConfig::Key MbedConfig::kConfigKey_HardwareVersionString = { CONFIG_KEY("hardware-version-string") }; +const MbedConfig::Key MbedConfig::kConfigKey_SoftwareVersionString = { CONFIG_KEY("software-version-string") }; + // Keys stored in the Chip-counters namespace const MbedConfig::Key MbedConfig::kCounterKey_RebootCount = { COUNTER_KEY("reboot-count") }; const MbedConfig::Key MbedConfig::kCounterKey_UpTime = { COUNTER_KEY("up-time") }; diff --git a/src/platform/mbed/MbedConfig.h b/src/platform/mbed/MbedConfig.h index 70b1dfa6890a24..8482cd6866165c 100644 --- a/src/platform/mbed/MbedConfig.h +++ b/src/platform/mbed/MbedConfig.h @@ -72,6 +72,11 @@ class MbedConfig static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // CHIP Counter keys static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; diff --git a/src/platform/mt793x/MT793XConfig.cpp b/src/platform/mt793x/MT793XConfig.cpp index a524315657a762..12b303f93b1bc1 100644 --- a/src/platform/mt793x/MT793XConfig.cpp +++ b/src/platform/mt793x/MT793XConfig.cpp @@ -100,6 +100,14 @@ const MT793XConfig::Key MT793XConfig::kConfigKey_YearDaySchedules = { .Namespace .Name = "yearday-sched" }; const MT793XConfig::Key MT793XConfig::kConfigKey_HolidaySchedules = { .Namespace = kConfigNamespace_ChipConfig, .Name = "holiday-sched" }; + +const MT793XConfig::Key MT793XConfig::kConfigKey_VendorName = { .Namespace = kConfigNamespace_ChipConfig, .Name = "vendor-name" }; +const MT793XConfig::Key MT793XConfig::kConfigKey_ProductName = { .Namespace = kConfigNamespace_ChipConfig, .Name = "product-name" }; +const MT793XConfig::Key MT793XConfig::kConfigKey_HardwareVersionString = { .Namespace = kConfigNamespace_ChipConfig, + .Name = "hardware-version-string" }; +const MT793XConfig::Key MT793XConfig::kConfigKey_SoftwareVersionString = { .Namespace = kConfigNamespace_ChipConfig, + .Name = "software-version-string" }; + // CHIP Counter Keys const MT793XConfig::Key MT793XConfig::kConfigKey_BootCount = { .Namespace = kConfigNamespace_ChipCounters, .Name = "boot-count" }; const MT793XConfig::Key MT793XConfig::kConfigKey_TotalOperationalHours = { .Namespace = kConfigNamespace_ChipCounters, diff --git a/src/platform/mt793x/MT793XConfig.h b/src/platform/mt793x/MT793XConfig.h index 33358d4d064f4a..8e922f47265999 100644 --- a/src/platform/mt793x/MT793XConfig.h +++ b/src/platform/mt793x/MT793XConfig.h @@ -101,6 +101,11 @@ class MT793XConfig static const Key kConfigKey_WeekDaySchedules; static const Key kConfigKey_YearDaySchedules; static const Key kConfigKey_HolidaySchedules; + + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; // CHIP Counter Keys static const Key kConfigKey_BootCount; static const Key kConfigKey_TotalOperationalHours; diff --git a/src/platform/nxp/common/NXPConfig.h b/src/platform/nxp/common/NXPConfig.h index 7de3beab2b37ed..781e476950983f 100644 --- a/src/platform/nxp/common/NXPConfig.h +++ b/src/platform/nxp/common/NXPConfig.h @@ -100,6 +100,11 @@ class NXPConfig static constexpr Key kConfigKey_Spake2pSalt = config_key(kFileId_ChipFactory, 0x0B); static constexpr Key kConfigKey_Spake2pVerifier = config_key(kFileId_ChipFactory, 0x0C); + static constexpr Key kConfigKey_VendorName = config_key(kFileId_ChipFactory, 0x0D); + static constexpr Key kConfigKey_ProductName = config_key(kFileId_ChipFactory, 0x0E); + static constexpr Key kConfigKey_HardwareVersionString = config_key(kFileId_ChipFactory, 0x0F); + static constexpr Key kConfigKey_SoftwareVersionString = config_key(kFileId_ChipFactory, 0x10); + // CHIP Config Keys static constexpr Key kConfigKey_FabricId = config_key(kFileId_ChipConfig, 0x00); static constexpr Key kConfigKey_ServiceConfig = config_key(kFileId_ChipConfig, 0x01); diff --git a/src/platform/nxp/k32w0/K32W0Config.cpp b/src/platform/nxp/k32w0/K32W0Config.cpp index 2054ef5da619bf..994327312bf701 100644 --- a/src/platform/nxp/k32w0/K32W0Config.cpp +++ b/src/platform/nxp/k32w0/K32W0Config.cpp @@ -53,6 +53,11 @@ const K32WConfig::Key K32WConfig::kConfigKey_Spake2pIterationCount{ &K32WConfig: const K32WConfig::Key K32WConfig::kConfigKey_Spake2pSalt{ &K32WConfig::sFactoryStorage, kKeyId_Factory, 0x0A }; const K32WConfig::Key K32WConfig::kConfigKey_Spake2pVerifier{ &K32WConfig::sFactoryStorage, kKeyId_Factory, 0x0B }; +const K32WConfig::Key K32WConfig::kConfigKey_VendorName{ &K32WConfig::sFactoryStorage, kKeyId_Config, 0x0C }; +const K32WConfig::Key K32WConfig::kConfigKey_ProductName{ &K32WConfig::sFactoryStorage, kKeyId_Config, 0x0D }; +const K32WConfig::Key K32WConfig::kConfigKey_HardwareVersionString{ &K32WConfig::sFactoryStorage, kKeyId_Config, 0x0E }; +const K32WConfig::Key K32WConfig::kConfigKey_SoftwareVersionString{ &K32WConfig::sFactoryStorage, kKeyId_Config, 0x0F }; + const K32WConfig::Key K32WConfig::kConfigKey_ServiceConfig{ &K32WConfig::sConfigStorage, kKeyId_Config, 0x01 }; const K32WConfig::Key K32WConfig::kConfigKey_PairedAccountId{ &K32WConfig::sConfigStorage, kKeyId_Config, 0x02 }; const K32WConfig::Key K32WConfig::kConfigKey_ServiceId{ &K32WConfig::sConfigStorage, kKeyId_Config, 0x03 }; diff --git a/src/platform/nxp/k32w0/K32W0Config.h b/src/platform/nxp/k32w0/K32W0Config.h index 7080e62e747bf1..1a42ea4a60f21e 100644 --- a/src/platform/nxp/k32w0/K32W0Config.h +++ b/src/platform/nxp/k32w0/K32W0Config.h @@ -75,6 +75,11 @@ class K32WConfig static const Key kConfigKey_SoftwareVersion; static const Key kConfigKey_SoftwareUpdateCompleted; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // CHIP Counter Keys static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; diff --git a/src/platform/nxp/k32w0/args.gni b/src/platform/nxp/k32w0/args.gni index fda52672cf50e0..4dd218a0c65a77 100644 --- a/src/platform/nxp/k32w0/args.gni +++ b/src/platform/nxp/k32w0/args.gni @@ -56,6 +56,8 @@ chip_mdns = "platform" #chip_automation_logging = true #chip_error_logging = true +chip_progress_logging = false + chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false diff --git a/src/platform/nxp/mcxw71_k32w1/K32W1Config.h b/src/platform/nxp/mcxw71_k32w1/K32W1Config.h index ceeae82a8dc273..83f9508d93a2f2 100644 --- a/src/platform/nxp/mcxw71_k32w1/K32W1Config.h +++ b/src/platform/nxp/mcxw71_k32w1/K32W1Config.h @@ -92,6 +92,11 @@ class NXPConfig static constexpr Key kConfigKey_UniqueId = K32WConfigKey(kFileId_ChipConfig, 0x0A); static constexpr Key kConfigKey_SoftwareVersion = K32WConfigKey(kFileId_ChipConfig, 0x0B); + static constexpr Key kConfigKey_VendorName = K32WConfigKey(kFileId_ChipConfig, 0x0C); + static constexpr Key kConfigKey_ProductName = K32WConfigKey(kFileId_ChipConfig, 0x0D); + static constexpr Key kConfigKey_HardwareVersionString = K32WConfigKey(kFileId_ChipConfig, 0x0E); + static constexpr Key kConfigKey_SoftwareVersionString = K32WConfigKey(kFileId_ChipConfig, 0x0F); + // CHIP Counter Keys static constexpr Key kCounterKey_RebootCount = K32WConfigKey(kFileId_ChipCounter, 0x00); static constexpr Key kCounterKey_UpTime = K32WConfigKey(kFileId_ChipCounter, 0x01); diff --git a/src/platform/nxp/mw320/MW320Config.h b/src/platform/nxp/mw320/MW320Config.h index fbe66f66875061..8e7924667902eb 100644 --- a/src/platform/nxp/mw320/MW320Config.h +++ b/src/platform/nxp/mw320/MW320Config.h @@ -81,6 +81,11 @@ class MW320Config static constexpr Key kConfigKey_Spake2pSalt = ConfigKey(kFileId_ChipFactory, 0x0A); static constexpr Key kConfigKey_Spake2pVerifier = ConfigKey(kFileId_ChipFactory, 0x0B); + static constexpr Key kConfigKey_VendorName = ConfigKey(kFileId_ChipFactory, 0x0C); + static constexpr Key kConfigKey_ProductName = ConfigKey(kFileId_ChipFactory, 0x0D); + static constexpr Key kConfigKey_HardwareVersionString = ConfigKey(kFileId_ChipFactory, 0x0E); + static constexpr Key kConfigKey_SoftwareVersionString = ConfigKey(kFileId_ChipFactory, 0x0F); + // CHIP Config Keys static constexpr Key kConfigKey_FabricId = ConfigKey(kFileId_ChipConfig, 0x00); static constexpr Key kConfigKey_ServiceConfig = ConfigKey(kFileId_ChipConfig, 0x01); diff --git a/src/platform/openiotsdk/KVPsaPsStore.cpp b/src/platform/openiotsdk/KVPsaPsStore.cpp index 26215bf2e4431a..88083c37372abe 100644 --- a/src/platform/openiotsdk/KVPsaPsStore.cpp +++ b/src/platform/openiotsdk/KVPsaPsStore.cpp @@ -67,6 +67,11 @@ const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_CountryCode = GetPsaPaKe const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_LocationCapability = GetPsaPaKey(kMatterConfig_KeyOffset, 0x08); const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_UniqueId = GetPsaPaKey(kMatterConfig_KeyOffset, 0x09); +const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_VendorName = GetPsaPaKey(kMatterConfig_KeyOffset, 0x0A); +const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_ProductName = GetPsaPaKey(kMatterConfig_KeyOffset, 0x0B); +const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_HardwareVersionString = GetPsaPaKey(kMatterConfig_KeyOffset, 0x0C); +const KVPsaPsStore::Key KVPsaPsStore::kConfigKey_SoftwareVersionString = GetPsaPaKey(kMatterConfig_KeyOffset, 0x0D); + // Keys stored in the Matter counters group const KVPsaPsStore::Key KVPsaPsStore::kCounterKey_RebootCount = GetPsaPaKey(kMatterCounter_KeyOffset, 0x00); const KVPsaPsStore::Key KVPsaPsStore::kCounterKey_UpTime = GetPsaPaKey(kMatterCounter_KeyOffset, 0x01); diff --git a/src/platform/openiotsdk/KVPsaPsStore.h b/src/platform/openiotsdk/KVPsaPsStore.h index acd3f695765650..297f6e24514f8a 100644 --- a/src/platform/openiotsdk/KVPsaPsStore.h +++ b/src/platform/openiotsdk/KVPsaPsStore.h @@ -89,6 +89,11 @@ class KVPsaPsStore static const Key kConfigKey_VendorId; static const Key kConfigKey_ProductId; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + // Config Keys static const Key kConfigKey_ServiceConfig; static const Key kConfigKey_PairedAccountId; diff --git a/src/platform/qpg/qpgConfig.h b/src/platform/qpg/qpgConfig.h index bc3e943926f7b5..47867112b5319c 100644 --- a/src/platform/qpg/qpgConfig.h +++ b/src/platform/qpg/qpgConfig.h @@ -76,6 +76,11 @@ class QPGConfig static constexpr Key kConfigKey_Spake2pSalt = QorvoConfigKey(kFileId_ChipFactory, 0x09); static constexpr Key kConfigKey_Spake2pVerifier = QorvoConfigKey(kFileId_ChipFactory, 0x0A); + static constexpr Key kConfigKey_VendorName = QorvoConfigKey(kFileId_ChipFactory, 0x0B); + static constexpr Key kConfigKey_ProductName = QorvoConfigKey(kFileId_ChipFactory, 0x0C); + static constexpr Key kConfigKey_HardwareVersionString = QorvoConfigKey(kFileId_ChipFactory, 0x0D); + static constexpr Key kConfigKey_SoftwareVersionString = QorvoConfigKey(kFileId_ChipFactory, 0x0E); + static constexpr Key kConfigKey_ServiceConfig = QorvoConfigKey(kFileId_ChipConfig, 0x01); static constexpr Key kConfigKey_PairedAccountId = QorvoConfigKey(kFileId_ChipConfig, 0x02); static constexpr Key kConfigKey_ServiceId = QorvoConfigKey(kFileId_ChipConfig, 0x03); diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index cef9ca323f74d2..5bcb80fd00bb54 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -132,7 +132,8 @@ class SilabsConfig static constexpr Key kConfigKey_Provision_Request = SilabsConfigKey(kMatterFactory_KeyBase, 0x28); static constexpr Key kConfigKey_Provision_Version = SilabsConfigKey(kMatterFactory_KeyBase, 0x29); - static constexpr Key kOtaTlvEncryption_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x30); + static constexpr Key kOtaTlvEncryption_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x30); + static constexpr Key kConfigKey_SoftwareVersionString = SilabsConfigKey(kMatterFactory_KeyBase, 0x31); // Matter Config Keys static constexpr Key kConfigKey_ServiceConfig = SilabsConfigKey(kMatterConfig_KeyBase, 0x01); diff --git a/src/platform/stm32/STM32Config.h b/src/platform/stm32/STM32Config.h index f1df1dc7638861..2d1d38261f4e13 100644 --- a/src/platform/stm32/STM32Config.h +++ b/src/platform/stm32/STM32Config.h @@ -67,6 +67,12 @@ class STM32Config static constexpr Key kConfigKey_Breadcrumb = 22; static constexpr Key kConfigKey_UniqueId = 23; static constexpr Key kConfigKey_ProductRevision = 24; + + static constexpr Key kConfigKey_VendorName = 25; + static constexpr Key kConfigKey_ProductName = 26; + static constexpr Key kConfigKey_HardwareVersionString = 27; + static constexpr Key kConfigKey_SoftwareVersionString = 28; + // Set key id limits for each group. static constexpr Key kConfigKey_Base = kConfigKey_SerialNum; static constexpr Key kConfigKey_Max = kConfigKey_UniqueId; diff --git a/src/platform/tests/TestConfigurationMgr.cpp b/src/platform/tests/TestConfigurationMgr.cpp index d40c600c5d03f3..43c55efd786e7b 100644 --- a/src/platform/tests/TestConfigurationMgr.cpp +++ b/src/platform/tests/TestConfigurationMgr.cpp @@ -83,25 +83,25 @@ TEST_F(TestConfigurationMgr, SerialNumber) CHIP_ERROR err = CHIP_NO_ERROR; char buf[64]; - const char * serialNumber = "89051AAZZ236"; + CharSpan serialNumber = "89051AAZZ236"_span; - err = ConfigurationMgr().StoreSerialNumber(serialNumber, strlen(serialNumber)); + err = ConfigurationMgr().StoreSerialNumber(serialNumber); EXPECT_EQ(err, CHIP_NO_ERROR); err = GetDeviceInstanceInfoProvider()->GetSerialNumber(buf, 64); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(strlen(buf), 12u); - EXPECT_STREQ(buf, serialNumber); + EXPECT_STREQ(buf, serialNumber.data()); - err = ConfigurationMgr().StoreSerialNumber(serialNumber, 5); + err = ConfigurationMgr().StoreSerialNumber(serialNumber.SubSpan(5)); EXPECT_EQ(err, CHIP_NO_ERROR); err = GetDeviceInstanceInfoProvider()->GetSerialNumber(buf, 64); EXPECT_EQ(err, CHIP_NO_ERROR); - EXPECT_EQ(strlen(buf), 5u); - EXPECT_STREQ(buf, "89051"); + EXPECT_EQ(strlen(buf), 7u); + EXPECT_STREQ(buf, "AAZZ236"); } TEST_F(TestConfigurationMgr, UniqueId) diff --git a/src/platform/webos/PosixConfig.cpp b/src/platform/webos/PosixConfig.cpp index 79cbd2e0eaa49b..5675bf6bba7ffe 100644 --- a/src/platform/webos/PosixConfig.cpp +++ b/src/platform/webos/PosixConfig.cpp @@ -78,6 +78,11 @@ const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" }; const PosixConfig::Key PosixConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipFactory, "unique-id" }; +const PosixConfig::Key PosixConfig::kConfigKey_VendorName = { kConfigNamespace_ChipFactory, "vendor-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_ProductName = { kConfigNamespace_ChipFactory, "product-name" }; +const PosixConfig::Key PosixConfig::kConfigKey_HardwareVersionString = { kConfigNamespace_ChipFactory, "hardware-version-string" }; +const PosixConfig::Key PosixConfig::kConfigKey_SoftwareVersionString = { kConfigNamespace_ChipFactory, "software-version-string" }; + // Keys stored in the Chip-counters namespace const PosixConfig::Key PosixConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; const PosixConfig::Key PosixConfig::kCounterKey_UpTime = { kConfigNamespace_ChipCounters, "up-time" }; diff --git a/src/platform/webos/PosixConfig.h b/src/platform/webos/PosixConfig.h index 8835bd04c60310..e948f381f6cab5 100644 --- a/src/platform/webos/PosixConfig.h +++ b/src/platform/webos/PosixConfig.h @@ -82,6 +82,11 @@ class PosixConfig static const Key kConfigKey_VendorId; static const Key kConfigKey_ProductId; + static const Key kConfigKey_VendorName; + static const Key kConfigKey_ProductName; + static const Key kConfigKey_HardwareVersionString; + static const Key kConfigKey_SoftwareVersionString; + static const Key kCounterKey_RebootCount; static const Key kCounterKey_UpTime; static const Key kCounterKey_TotalOperationalHours;