Skip to content

Commit 83db5f6

Browse files
committed
Merge branch 'fix/attribute-types' into 'main'
Fix Attribute Type Inconsistencies in Data Model See merge request app-frameworks/esp-matter!1312
2 parents 1b3af2d + 2dd49d3 commit 83db5f6

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

components/esp_matter/data_model/esp_matter_attribute.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ attribute_t *create_interface_enabled(cluster_t *cluster, bool value)
462462
attribute_t *create_last_networking_status(cluster_t *cluster, nullable<uint8_t> value)
463463
{
464464
return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastNetworkingStatus::Id,
465-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
465+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
466466
}
467467

468468
attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -486,7 +486,7 @@ attribute_t *create_supported_wifi_bands(cluster_t *cluster, uint8_t *value, uin
486486
attribute_t *create_supported_thread_features(cluster_t *cluster, uint16_t value)
487487
{
488488
return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::SupportedThreadFeatures::Id,
489-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value));
489+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_bitmap16(value));
490490
}
491491

492492
attribute_t *create_thread_version(cluster_t *cluster, uint16_t value)
@@ -595,7 +595,7 @@ namespace attribute {
595595
attribute_t *create_window_status(cluster_t *cluster, uint8_t value)
596596
{
597597
return esp_matter::attribute::create(cluster, AdministratorCommissioning::Attributes::WindowStatus::Id,
598-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint8(value));
598+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_enum8(value));
599599
}
600600

601601
attribute_t *create_admin_fabric_index(cluster_t *cluster, uint16_t value)
@@ -774,7 +774,7 @@ attribute_t *create_security_type(cluster_t *cluster, nullable<uint8_t> value)
774774
attribute_t *create_wifi_version(cluster_t *cluster, nullable<uint8_t> value)
775775
{
776776
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id,
777-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
777+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
778778
}
779779

780780
attribute_t *create_channel_number(cluster_t *cluster, nullable<uint16_t> value)
@@ -852,7 +852,7 @@ attribute_t *create_channel(cluster_t *cluster, nullable<uint16_t> value)
852852
attribute_t *create_routing_role(cluster_t *cluster, nullable<uint8_t> value)
853853
{
854854
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RoutingRole::Id,
855-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
855+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
856856
}
857857

858858
attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length)
@@ -897,22 +897,22 @@ attribute_t *create_partition_id(cluster_t *cluster, nullable<uint32_t> value)
897897
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
898898
}
899899

900-
attribute_t *create_weighting(cluster_t *cluster, nullable<uint8_t> value)
900+
attribute_t *create_weighting(cluster_t *cluster, nullable<uint16_t> value)
901901
{
902902
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Weighting::Id,
903-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
903+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
904904
}
905905

906-
attribute_t *create_data_version(cluster_t *cluster, nullable<uint8_t> value)
906+
attribute_t *create_data_version(cluster_t *cluster, nullable<uint16_t> value)
907907
{
908908
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::DataVersion::Id,
909-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
909+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
910910
}
911911

912-
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint8_t> value)
912+
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint16_t> value)
913913
{
914914
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id,
915-
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
915+
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
916916
}
917917

918918
attribute_t *create_leader_router_id(cluster_t *cluster, nullable<uint8_t> value)
@@ -1460,7 +1460,7 @@ attribute_t *create_identify_time(cluster_t *cluster, uint16_t value)
14601460
attribute_t *create_identify_type(cluster_t *cluster, uint8_t value)
14611461
{
14621462
return esp_matter::attribute::create(cluster, Identify::Attributes::IdentifyType::Id, ATTRIBUTE_FLAG_NONE,
1463-
esp_matter_uint8(value));
1463+
esp_matter_enum8(value));
14641464
}
14651465

14661466
} /* attribute */
@@ -1746,7 +1746,7 @@ attribute_t *create_color_loop_active(cluster_t *cluster, uint8_t value)
17461746
attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value)
17471747
{
17481748
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorLoopDirection::Id,
1749-
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value));
1749+
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
17501750
}
17511751

17521752
attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value)
@@ -1971,7 +1971,7 @@ attribute_t *create_outdoor_temperature(cluster_t *cluster, nullable<int16_t> va
19711971
attribute_t *create_occupancy(cluster_t *cluster, uint8_t value)
19721972
{
19731973
return esp_matter::attribute::create(cluster, Thermostat::Attributes::Occupancy::Id, ATTRIBUTE_FLAG_NONE,
1974-
esp_matter_enum8(value));
1974+
esp_matter_bitmap8(value));
19751975
}
19761976

19771977
attribute_t *create_abs_min_heat_setpoint_limit(cluster_t *cluster, int16_t value)
@@ -2146,7 +2146,7 @@ attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value)
21462146
attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value)
21472147
{
21482148
return esp_matter::attribute::create(cluster, Thermostat::Attributes::SetpointChangeSource::Id,
2149-
ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value));
2149+
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
21502150
}
21512151

21522152
attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable<int16_t> value)
@@ -2155,10 +2155,10 @@ attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable<int16_t>
21552155
ATTRIBUTE_FLAG_NONE, esp_matter_nullable_int16(value));
21562156
}
21572157

2158-
attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint16_t value)
2158+
attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value)
21592159
{
21602160
return esp_matter::attribute::create(cluster, Thermostat::Attributes::SetpointChangeSourceTimestamp::Id,
2161-
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
2161+
ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
21622162
}
21632163

21642164
attribute_t *create_occupied_setback(cluster_t *cluster, nullable<uint8_t> value)
@@ -2208,7 +2208,7 @@ attribute_t *create_emergency_heat_delta(cluster_t *cluster, uint8_t value)
22082208
attribute_t *create_ac_type(cluster_t *cluster, uint8_t value)
22092209
{
22102210
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ACType::Id,
2211-
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
2211+
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
22122212
}
22132213

22142214
attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value)
@@ -2220,13 +2220,13 @@ attribute_t *create_ac_capacity(cluster_t *cluster, uint16_t value)
22202220
attribute_t *create_ac_refrigerant_type(cluster_t *cluster, uint8_t value)
22212221
{
22222222
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ACRefrigerantType::Id,
2223-
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
2223+
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
22242224
}
22252225

22262226
attribute_t *create_ac_compressor_type(cluster_t *cluster, uint8_t value)
22272227
{
22282228
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ACCompressorType::Id,
2229-
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
2229+
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
22302230
}
22312231

22322232
attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value)
@@ -2238,7 +2238,7 @@ attribute_t *create_ac_error_code(cluster_t *cluster, uint32_t value)
22382238
attribute_t *create_ac_louver_position(cluster_t *cluster, uint8_t value)
22392239
{
22402240
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ACLouverPosition::Id,
2241-
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
2241+
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
22422242
}
22432243

22442244
attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable<int16_t> value)
@@ -2250,7 +2250,7 @@ attribute_t *create_ac_coil_temperature(cluster_t *cluster, nullable<int16_t> va
22502250
attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value)
22512251
{
22522252
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ACCapacityformat::Id,
2253-
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
2253+
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
22542254
}
22552255

22562256
attribute_t *create_preset_types(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
@@ -2512,10 +2512,10 @@ attribute_t *create_operational_state(cluster_t *cluster, uint8_t value)
25122512
esp_matter_enum8(value));
25132513
}
25142514

2515-
attribute_t *create_operational_error(cluster_t *cluster, uint8_t value)
2515+
attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
25162516
{
25172517
return esp_matter::attribute::create(cluster, OperationalState::Attributes::OperationalError::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY,
2518-
esp_matter_enum8(value));
2518+
esp_matter_array(value, length, count));
25192519
}
25202520

25212521
} /* attribute */
@@ -2563,7 +2563,7 @@ attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value,
25632563
attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable<uint8_t> value)
25642564
{
25652565
return esp_matter::attribute::create(cluster, LaundryDryerControls::Attributes::SelectedDrynessLevel::Id,
2566-
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_uint8(value));
2566+
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_enum8(value));
25672567

25682568
}
25692569

@@ -2659,7 +2659,7 @@ namespace attribute {
26592659
attribute_t *create_lock_state(cluster_t *cluster, nullable<uint8_t> value)
26602660
{
26612661
return esp_matter::attribute::create(cluster, DoorLock::Attributes::LockState::Id, ATTRIBUTE_FLAG_NULLABLE,
2662-
esp_matter_nullable_uint8(value));
2662+
esp_matter_nullable_enum8(value));
26632663
}
26642664

26652665
attribute_t *create_lock_type(cluster_t *cluster, uint8_t value)
@@ -3953,17 +3953,17 @@ namespace refrigerator_alarm {
39533953
namespace attribute {
39543954
attribute_t *create_mask(cluster_t *cluster, uint32_t value)
39553955
{
3956-
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::Mask::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
3956+
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::Mask::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value));
39573957
}
39583958

39593959
attribute_t *create_state(cluster_t *cluster, uint32_t value)
39603960
{
3961-
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::State::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
3961+
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::State::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value));
39623962
}
39633963

39643964
attribute_t *create_supported(cluster_t *cluster, uint32_t value)
39653965
{
3966-
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::Supported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
3966+
return esp_matter::attribute::create(cluster, RefrigeratorAlarm::Attributes::Supported::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap32(value));
39673967
}
39683968

39693969
} /* attribute */
@@ -4794,7 +4794,7 @@ attribute_t *create_dst_offset_list_max_size(cluster_t *cluster, uint8_t value)
47944794
attribute_t *create_supports_dns_resolve(cluster_t *cluster, bool value)
47954795
{
47964796
return esp_matter::attribute::create(cluster, TimeSynchronization::Attributes::SupportsDNSResolve::Id,
4797-
ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value));
4797+
ATTRIBUTE_FLAG_NONE, esp_matter_bool(value));
47984798
}
47994799

48004800
} /* attribute */

components/esp_matter/data_model/esp_matter_attribute.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16
250250
attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
251251
attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
252252
attribute_t *create_partition_id(cluster_t *cluster, nullable<uint32_t> value);
253-
attribute_t *create_weighting(cluster_t *cluster, nullable<uint8_t> value);
254-
attribute_t *create_data_version(cluster_t *cluster, nullable<uint8_t> value);
255-
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint8_t> value);
253+
attribute_t *create_weighting(cluster_t *cluster, nullable<uint16_t> value);
254+
attribute_t *create_data_version(cluster_t *cluster, nullable<uint16_t> value);
255+
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint16_t> value);
256256
attribute_t *create_leader_router_id(cluster_t *cluster, nullable<uint8_t> value);
257257
attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
258258
attribute_t *create_channel_page0_mask(cluster_t *cluster, uint8_t *value, uint16_t length);
@@ -511,7 +511,7 @@ attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, ui
511511
attribute_t *create_thermostat_running_state(cluster_t *cluster, uint16_t value);
512512
attribute_t *create_setpoint_change_source(cluster_t *cluster, uint8_t value);
513513
attribute_t *create_setpoint_change_amount(cluster_t *cluster, nullable<int16_t> value);
514-
attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint16_t value);
514+
attribute_t *create_setpoint_change_source_timestamp(cluster_t *cluster, uint32_t value);
515515
attribute_t *create_occupied_setback(cluster_t *cluster, nullable<uint8_t> value);
516516
attribute_t *create_occupied_setback_min(cluster_t *cluster, nullable<uint8_t> value);
517517
attribute_t *create_occupied_setback_max(cluster_t *cluster, nullable<uint8_t> value);
@@ -638,7 +638,7 @@ attribute_t *create_current_phase(cluster_t *cluster, nullable<uint8_t> value);
638638
attribute_t *create_countdown_time(cluster_t *cluster, nullable<uint32_t> value);
639639
attribute_t *create_operational_state_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
640640
attribute_t *create_operational_state(cluster_t *cluster, uint8_t value);
641-
attribute_t *create_operational_error(cluster_t *cluster, uint8_t value);
641+
attribute_t *create_operational_error(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
642642
} /* attribute */
643643
} /* operational_state */
644644

components/esp_matter/data_model/esp_matter_cluster.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,9 +770,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
770770
attribute::create_neighbor_table(cluster, NULL, 0, 0);
771771
attribute::create_route_table(cluster, NULL, 0, 0);
772772
attribute::create_partition_id(cluster, nullable<uint32_t>(0));
773-
attribute::create_weighting(cluster, nullable<uint8_t>(0));
774-
attribute::create_data_version(cluster, nullable<uint8_t>(0));
775-
attribute::create_stable_data_version(cluster, nullable<uint8_t>(0));
773+
attribute::create_weighting(cluster, nullable<uint16_t>(0));
774+
attribute::create_data_version(cluster, nullable<uint16_t>(0));
775+
attribute::create_stable_data_version(cluster, nullable<uint16_t>(0));
776776
attribute::create_leader_router_id(cluster, nullable<uint8_t>(0));
777777
attribute::create_security_policy(cluster, NULL, 0, 0);
778778
attribute::create_channel_page0_mask(cluster, NULL, 0);
@@ -1712,7 +1712,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
17121712
attribute::create_current_phase(cluster, 0);
17131713
attribute::create_operational_state_list(cluster, NULL, 0, 0);
17141714
attribute::create_operational_state(cluster, 0);
1715-
attribute::create_operational_error(cluster, 0);
1715+
attribute::create_operational_error(cluster, NULL, 0, 0);
17161716

17171717
/* Attributes not managed internally */
17181718
global::attribute::create_cluster_revision(cluster, cluster_revision);
@@ -3027,7 +3027,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
30273027
operational_state::attribute::create_current_phase(cluster, 0);
30283028
operational_state::attribute::create_operational_state_list(cluster, NULL, 0, 0);
30293029
operational_state::attribute::create_operational_state(cluster, 0);
3030-
operational_state::attribute::create_operational_error(cluster, 0);
3030+
operational_state::attribute::create_operational_error(cluster, NULL, 0, 0);
30313031

30323032
/* Attributes not managed internally */
30333033
global::attribute::create_cluster_revision(cluster, cluster_revision);

0 commit comments

Comments
 (0)