mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'sve-bug-fix' into 'main'
Bugfix: Fix the bugs found in SVE See merge request app-frameworks/esp-matter!162
This commit is contained in:
@@ -247,10 +247,10 @@ attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length,
|
|||||||
namespace ota_requestor {
|
namespace ota_requestor {
|
||||||
namespace attribute {
|
namespace attribute {
|
||||||
|
|
||||||
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length)
|
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
|
||||||
{
|
{
|
||||||
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::Id,
|
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::Id,
|
||||||
ATTRIBUTE_FLAG_WRITABLE, esp_matter_octet_str(value, length));
|
ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
attribute_t *create_update_possible(cluster_t *cluster, bool value)
|
attribute_t *create_update_possible(cluster_t *cluster, bool value)
|
||||||
@@ -268,7 +268,7 @@ attribute_t *create_update_state(cluster_t *cluster, uint8_t value)
|
|||||||
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value)
|
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value)
|
||||||
{
|
{
|
||||||
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id,
|
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id,
|
||||||
ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value));
|
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* attribute */
|
} /* attribute */
|
||||||
@@ -1005,6 +1005,111 @@ attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t
|
|||||||
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
|
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attribute_t *create_number_of_primaries(cluster_t *cluster, uint8_t value)
|
||||||
|
{
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::NumberOfPrimaries::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6X::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6Y::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint16(value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
attribute_t *create_primary_n_intensity(cluster_t * cluster, uint8_t value, uint8_t index)
|
||||||
|
{
|
||||||
|
switch (index) {
|
||||||
|
case 1:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6Intensity::Id, ATTRIBUTE_FLAG_NONE,
|
||||||
|
esp_matter_uint8(value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
} /* attribute */
|
} /* attribute */
|
||||||
} /* color_control */
|
} /* color_control */
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length,
|
|||||||
|
|
||||||
namespace ota_requestor {
|
namespace ota_requestor {
|
||||||
namespace attribute {
|
namespace attribute {
|
||||||
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length);
|
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
|
||||||
attribute_t *create_update_possible(cluster_t *cluster, bool value);
|
attribute_t *create_update_possible(cluster_t *cluster, bool value);
|
||||||
attribute_t *create_update_state(cluster_t *cluster, uint8_t value);
|
attribute_t *create_update_state(cluster_t *cluster, uint8_t value);
|
||||||
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value);
|
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value);
|
||||||
@@ -265,6 +265,10 @@ attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value);
|
|||||||
attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value);
|
attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value);
|
||||||
attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value);
|
attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value);
|
||||||
attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value);
|
attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value);
|
||||||
|
attribute_t *create_number_of_primaries(cluster_t *cluster, uint8_t value);
|
||||||
|
attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index);
|
||||||
|
attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t index);
|
||||||
|
attribute_t *create_primary_n_intensity(cluster_t * cluster, uint8_t value, uint8_t index);
|
||||||
} /* attribute */
|
} /* attribute */
|
||||||
} /* color_control */
|
} /* color_control */
|
||||||
|
|
||||||
|
|||||||
@@ -1035,6 +1035,9 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint_id, Clus
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Update val */
|
/* Update val */
|
||||||
|
if (val.type == ESP_MATTER_VAL_TYPE_INVALID) {
|
||||||
|
return EMBER_ZCL_STATUS_FAILURE;
|
||||||
|
}
|
||||||
attribute::set_val(attribute, &val);
|
attribute::set_val(attribute, &val);
|
||||||
return EMBER_ZCL_STATUS_SUCCESS;
|
return EMBER_ZCL_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
|||||||
if (flags & CLUSTER_FLAG_SERVER) {
|
if (flags & CLUSTER_FLAG_SERVER) {
|
||||||
/* Attributes managed internally */
|
/* Attributes managed internally */
|
||||||
global::attribute::create_feature_map(cluster, 0);
|
global::attribute::create_feature_map(cluster, 0);
|
||||||
attribute::create_default_ota_providers(cluster, NULL, 0);
|
attribute::create_default_ota_providers(cluster, NULL, 0, 0);
|
||||||
|
|
||||||
/* Attributes not managed internally */
|
/* Attributes not managed internally */
|
||||||
if (config) {
|
if (config) {
|
||||||
@@ -1007,12 +1007,18 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
|
|||||||
attribute::create_color_control_options(cluster, config->color_control_options);
|
attribute::create_color_control_options(cluster, config->color_control_options);
|
||||||
attribute::create_enhanced_color_mode(cluster, config->enhanced_color_mode);
|
attribute::create_enhanced_color_mode(cluster, config->enhanced_color_mode);
|
||||||
attribute::create_color_capabilities(cluster, config->color_capabilities);
|
attribute::create_color_capabilities(cluster, config->color_capabilities);
|
||||||
|
attribute::create_number_of_primaries(cluster, config->number_of_primaries);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
|
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attributes managed internally */
|
/* Attributes managed internally */
|
||||||
attribute::create_remaining_time(cluster, 0);
|
attribute::create_remaining_time(cluster, 0);
|
||||||
|
for (uint8_t idx = 1; idx <= config->number_of_primaries; ++idx) {
|
||||||
|
attribute::create_primary_n_x(cluster, 0, idx);
|
||||||
|
attribute::create_primary_n_y(cluster, 0, idx);
|
||||||
|
attribute::create_primary_n_intensity(cluster, 0, idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Features */
|
/* Features */
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ typedef struct config {
|
|||||||
bool update_possible;
|
bool update_possible;
|
||||||
uint8_t update_state;
|
uint8_t update_state;
|
||||||
uint8_t update_state_progress;
|
uint8_t update_state_progress;
|
||||||
config() : cluster_revision(1), update_possible(0), update_state(0), update_state_progress(0) {}
|
config() : cluster_revision(1), update_possible(1), update_state(0), update_state_progress(0) {}
|
||||||
} config_t;
|
} config_t;
|
||||||
|
|
||||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||||
@@ -223,13 +223,14 @@ typedef struct config {
|
|||||||
uint8_t color_control_options;
|
uint8_t color_control_options;
|
||||||
uint8_t enhanced_color_mode;
|
uint8_t enhanced_color_mode;
|
||||||
uint16_t color_capabilities;
|
uint16_t color_capabilities;
|
||||||
|
uint8_t number_of_primaries;
|
||||||
feature::hue_saturation::config_t hue_saturation;
|
feature::hue_saturation::config_t hue_saturation;
|
||||||
feature::color_temperature::config_t color_temperature;
|
feature::color_temperature::config_t color_temperature;
|
||||||
feature::xy::config_t xy;
|
feature::xy::config_t xy;
|
||||||
feature::enhanced_hue::config_t enhanced_hue;
|
feature::enhanced_hue::config_t enhanced_hue;
|
||||||
feature::color_loop::config_t color_loop;
|
feature::color_loop::config_t color_loop;
|
||||||
config() : cluster_revision(5), color_mode(1), color_control_options(0), enhanced_color_mode(1),
|
config() : cluster_revision(5), color_mode(1), color_control_options(0), enhanced_color_mode(1),
|
||||||
color_capabilities(0) {}
|
color_capabilities(0), number_of_primaries(0) {}
|
||||||
} config_t;
|
} config_t;
|
||||||
|
|
||||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
|
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
|
||||||
|
|||||||
@@ -18,12 +18,14 @@
|
|||||||
#include <nvs.h>
|
#include <nvs.h>
|
||||||
|
|
||||||
#include <app/clusters/network-commissioning/network-commissioning.h>
|
#include <app/clusters/network-commissioning/network-commissioning.h>
|
||||||
|
#include <app/clusters/general-diagnostics-server/general-diagnostics-server.h>
|
||||||
#include <app/server/Dnssd.h>
|
#include <app/server/Dnssd.h>
|
||||||
#include <app/server/Server.h>
|
#include <app/server/Server.h>
|
||||||
#include <app/util/attribute-storage.h>
|
#include <app/util/attribute-storage.h>
|
||||||
#include <credentials/DeviceAttestationCredsProvider.h>
|
#include <credentials/DeviceAttestationCredsProvider.h>
|
||||||
#include <credentials/examples/DeviceAttestationCredsExample.h>
|
#include <credentials/examples/DeviceAttestationCredsExample.h>
|
||||||
#include <platform/CHIPDeviceLayer.h>
|
#include <platform/CHIPDeviceLayer.h>
|
||||||
|
#include <platform/DiagnosticDataProvider.h>
|
||||||
#include <platform/ESP32/ESP32FactoryDataProvider.h>
|
#include <platform/ESP32/ESP32FactoryDataProvider.h>
|
||||||
#include <platform/ESP32/NetworkCommissioningDriver.h>
|
#include <platform/ESP32/NetworkCommissioningDriver.h>
|
||||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||||
@@ -43,6 +45,8 @@ using chip::DeviceLayer::ConfigurationMgr;
|
|||||||
using chip::DeviceLayer::ConnectivityManager;
|
using chip::DeviceLayer::ConnectivityManager;
|
||||||
using chip::DeviceLayer::ConnectivityMgr;
|
using chip::DeviceLayer::ConnectivityMgr;
|
||||||
using chip::DeviceLayer::PlatformMgr;
|
using chip::DeviceLayer::PlatformMgr;
|
||||||
|
using chip::DeviceLayer::DiagnosticDataProvider;
|
||||||
|
using chip::DeviceLayer::GetDiagnosticDataProvider;
|
||||||
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
|
||||||
using chip::DeviceLayer::ThreadStackMgr;
|
using chip::DeviceLayer::ThreadStackMgr;
|
||||||
#endif
|
#endif
|
||||||
@@ -665,8 +669,15 @@ static void esp_matter_chip_init_task(intptr_t context)
|
|||||||
if (endpoint::enable_all() != ESP_OK) {
|
if (endpoint::enable_all() != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Enable all endpoints failure");
|
ESP_LOGE(TAG, "Enable all endpoints failure");
|
||||||
}
|
}
|
||||||
// Add this function to record start up event in basic information cluster.
|
// The following two events can't be recorded when we start the server because the endpoints are not enabled.
|
||||||
|
// TODO: Find a better way to record the events which should be recorded in matter server init
|
||||||
|
// Record start up event in basic information cluster.
|
||||||
PlatformMgr().HandleServerStarted();
|
PlatformMgr().HandleServerStarted();
|
||||||
|
// Record boot reason evnet in general diagnostics cluster.
|
||||||
|
chip::app::Clusters::GeneralDiagnostics::BootReasonType bootReason;
|
||||||
|
if (GetDiagnosticDataProvider().GetBootReason(bootReason) == CHIP_NO_ERROR) {
|
||||||
|
chip::app::Clusters::GeneralDiagnosticsServer::Instance().OnDeviceReboot(bootReason);
|
||||||
|
}
|
||||||
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
|
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
|
||||||
{
|
{
|
||||||
static chip::app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0,
|
static chip::app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(0,
|
||||||
|
|||||||
Reference in New Issue
Block a user