Skip to content

Commit 25b8998

Browse files
committed
[v1.4] Backport: components/esp_matter: Added the default values for identify_type attribute in endpoint constructor
1 parent 42b99d2 commit 25b8998

File tree

2 files changed

+112
-13
lines changed

2 files changed

+112
-13
lines changed

components/esp_matter/esp_matter_endpoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
21162116

21172117
cluster_t *descriptor_cluster = cluster::get(endpoint, Descriptor::Id);
21182118
descriptor::feature::taglist::add(descriptor_cluster);
2119-
2119+
21202120
power_source_device::add(endpoint, &config->power_source_device);
21212121

21222122
cluster_t *power_source_cluster = cluster::get(endpoint, PowerSource::Id);

components/esp_matter/esp_matter_endpoint.h

Lines changed: 111 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,12 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
248248

249249
namespace on_off_light {
250250

251-
using config_t = on_off_config;
251+
typedef struct config : on_off_config {
252+
config() {
253+
/* For lighting product, the default identify type should be 0x01: LightOutput*/
254+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput);
255+
}
256+
} config_t;
252257

253258
uint32_t get_device_type_id();
254259
uint8_t get_device_type_version();
@@ -291,7 +296,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
291296

292297
namespace on_off_switch {
293298

294-
using config_t = app_client_config;
299+
typedef struct config : app_client_config {
300+
config() {
301+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
302+
}
303+
} config_t;
295304

296305
uint32_t get_device_type_id();
297306
uint8_t get_device_type_version();
@@ -301,7 +310,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
301310

302311
namespace dimmer_switch {
303312

304-
using config_t = app_client_config;
313+
typedef struct config : app_client_config {
314+
config() {
315+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
316+
}
317+
} config_t;
305318

306319
uint32_t get_device_type_id();
307320
uint8_t get_device_type_version();
@@ -311,7 +324,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
311324

312325
namespace color_dimmer_switch {
313326

314-
using config_t = app_client_config;
327+
typedef struct config : app_client_config {
328+
config() {
329+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
330+
}
331+
} config_t;
315332

316333
uint32_t get_device_type_id();
317334
uint8_t get_device_type_version();
@@ -321,6 +338,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
321338

322339
namespace generic_switch {
323340
typedef struct config : app_base_config {
341+
config() {
342+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
343+
}
324344
cluster::switch_cluster::config_t switch_cluster;
325345
} config_t;
326346

@@ -332,7 +352,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
332352

333353
namespace on_off_plugin_unit {
334354

335-
using config_t = on_off_config;
355+
typedef struct config : on_off_config {
356+
config() {
357+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
358+
}
359+
} config_t;
336360

337361
uint32_t get_device_type_id();
338362
uint8_t get_device_type_version();
@@ -353,6 +377,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
353377

354378
namespace fan {
355379
typedef struct config : app_with_group_config {
380+
config() {
381+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
382+
}
356383
cluster::fan_control::config_t fan_control;
357384
} config_t;
358385

@@ -364,6 +391,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
364391

365392
namespace thermostat {
366393
typedef struct config : app_with_group_config {
394+
config() {
395+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
396+
}
367397
cluster::scenes_management::config_t scenes_management;
368398
cluster::thermostat::config_t thermostat;
369399
} config_t;
@@ -376,6 +406,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
376406

377407
namespace air_quality_sensor {
378408
typedef struct config : app_base_config {
409+
config() {
410+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
411+
}
379412
cluster::air_quality::config_t air_quality;
380413
} config_t;
381414

@@ -387,6 +420,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
387420

388421
namespace air_purifier {
389422
typedef struct config : app_base_config {
423+
config() {
424+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
425+
}
390426
cluster::fan_control::config_t fan_control;
391427
} config_t;
392428

@@ -425,6 +461,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
425461

426462
namespace smoke_co_alarm {
427463
typedef struct config : app_base_config {
464+
config() {
465+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
466+
}
428467
cluster::smoke_co_alarm::config_t smoke_co_alarm;
429468
} config_t;
430469
uint32_t get_device_type_id();
@@ -469,6 +508,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
469508

470509
namespace door_lock {
471510
typedef struct config : app_base_config {
511+
config() {
512+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
513+
}
472514
cluster::door_lock::config_t door_lock;
473515
} config_t;
474516

@@ -482,7 +524,9 @@ namespace window_covering_device {
482524
typedef struct config : app_with_group_config {
483525
cluster::scenes_management::config_t scenes_management;
484526
cluster::window_covering::config_t window_covering;
485-
config(uint8_t end_product_type = 0) : window_covering(end_product_type) {}
527+
config(uint8_t end_product_type = 0) : window_covering(end_product_type) {
528+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
529+
}
486530
} config_t;
487531

488532
uint32_t get_device_type_id();
@@ -493,6 +537,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
493537

494538
namespace temperature_sensor {
495539
typedef struct config : app_base_config {
540+
config() {
541+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
542+
}
496543
cluster::temperature_measurement::config_t temperature_measurement;
497544
} config_t;
498545

@@ -504,6 +551,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
504551

505552
namespace humidity_sensor {
506553
typedef struct config : app_base_config {
554+
config() {
555+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
556+
}
507557
cluster::relative_humidity_measurement::config_t relative_humidity_measurement;
508558
} config_t;
509559

@@ -515,6 +565,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
515565

516566
namespace occupancy_sensor {
517567
typedef struct config : app_base_config {
568+
config() {
569+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
570+
}
518571
cluster::occupancy_sensing::config_t occupancy_sensing;
519572
} config_t;
520573

@@ -525,7 +578,12 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
525578
} /* occupancy_sensor */
526579

527580
namespace contact_sensor {
528-
using config_t = app_with_bool_state_config;
581+
582+
typedef struct config : app_with_bool_state_config {
583+
config() {
584+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
585+
}
586+
} config_t;
529587

530588
uint32_t get_device_type_id();
531589
uint8_t get_device_type_version();
@@ -535,6 +593,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
535593

536594
namespace light_sensor {
537595
typedef struct config : app_base_config {
596+
config() {
597+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
598+
}
538599
cluster::illuminance_measurement::config_t illuminance_measurement;
539600
} config_t;
540601

@@ -546,6 +607,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
546607

547608
namespace pressure_sensor {
548609
typedef struct config : app_base_config {
610+
config() {
611+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
612+
}
549613
cluster::pressure_measurement::config_t pressure_measurement;
550614
} config_t;
551615

@@ -557,6 +621,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
557621

558622
namespace flow_sensor {
559623
typedef struct config : app_base_config {
624+
config() {
625+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
626+
}
560627
cluster::flow_measurement::config_t flow_measurement;
561628
} config_t;
562629

@@ -574,7 +641,9 @@ typedef struct config : app_base_config {
574641
nullable<int16_t> max_pressure = nullable<int16_t>(),
575642
nullable<uint16_t> max_speed = nullable<uint16_t>(),
576643
nullable<uint16_t> max_flow = nullable<uint16_t>()
577-
) : pump_configuration_and_control(max_pressure, max_speed, max_flow) {}
644+
) : pump_configuration_and_control(max_pressure, max_speed, max_flow) {
645+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
646+
}
578647
} config_t;
579648

580649
uint32_t get_device_type_id();
@@ -585,6 +654,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
585654

586655
namespace pump_controller {
587656
typedef struct config : app_client_config {
657+
config() {
658+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
659+
}
588660
cluster::on_off::config_t on_off;
589661
cluster::pump_configuration_and_control::config_t pump_configuration_and_control;
590662
} config_t;
@@ -609,6 +681,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
609681

610682
namespace room_air_conditioner{
611683
typedef struct config : app_base_config {
684+
config() {
685+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
686+
}
612687
cluster::on_off::config_t on_off;
613688
cluster::thermostat::config_t thermostat;
614689
} config_t;
@@ -655,6 +730,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
655730

656731
namespace robotic_vacuum_cleaner{
657732
typedef struct config : app_base_config {
733+
config() {
734+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
735+
}
658736
cluster::rvc_run_mode::config_t rvc_run_mode;
659737
cluster::rvc_operational_state::config_t rvc_operational_state;
660738
} config_t;
@@ -666,7 +744,12 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
666744
} /** robotic_vacuum_cleaner **/
667745

668746
namespace water_leak_detector {
669-
using config_t = app_with_bool_state_config;
747+
748+
typedef struct config : app_with_bool_state_config {
749+
config() {
750+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
751+
}
752+
} config_t;
670753

671754
uint32_t get_device_type_id();
672755
uint8_t get_device_type_version();
@@ -676,7 +759,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
676759

677760
namespace water_freeze_detector {
678761

679-
using config_t = app_with_bool_state_config;
762+
typedef struct config : app_with_bool_state_config {
763+
config() {
764+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
765+
}
766+
} config_t;
680767

681768
uint32_t get_device_type_id();
682769
uint8_t get_device_type_version();
@@ -686,7 +773,11 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
686773

687774
namespace rain_sensor {
688775

689-
using config_t = app_with_bool_state_config;
776+
typedef struct config : app_with_bool_state_config {
777+
config() {
778+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
779+
}
780+
} config_t;
690781

691782
uint32_t get_device_type_id();
692783
uint8_t get_device_type_version();
@@ -772,6 +863,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
772863
namespace water_valve {
773864
typedef struct config : app_base_config {
774865
cluster::valve_configuration_and_control::config_t valve_configuration_and_control;
866+
config() {
867+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
868+
}
775869
} config_t;
776870

777871
uint32_t get_device_type_id();
@@ -819,7 +913,12 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
819913
} /* secondary_network_interface */
820914

821915
namespace mounted_on_off_control {
822-
using config_t = on_off_config;
916+
917+
typedef struct config : on_off_config {
918+
config() {
919+
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
920+
}
921+
} config_t;
823922

824923
uint32_t get_device_type_id();
825924
uint8_t get_device_type_version();

0 commit comments

Comments
 (0)