esp_matter: Add support for nullable attribute setting and getting

This commit is contained in:
WanqQixiang
2022-10-20 21:06:21 +08:00
parent 3401f14266
commit ba454ce389
8 changed files with 1120 additions and 360 deletions
+134 -116
View File
@@ -263,7 +263,8 @@ namespace attribute {
attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{
return esp_matter::attribute::create(cluster, Binding::Attributes::Binding::Id, ATTRIBUTE_FLAG_WRITABLE,
return esp_matter::attribute::create(cluster, Binding::Attributes::Binding::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_array(value, length, count));
}
@@ -276,7 +277,8 @@ namespace attribute {
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,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_array(value, length, count));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_array(value, length, count));
}
attribute_t *create_update_possible(cluster_t *cluster, bool value)
@@ -291,10 +293,10 @@ attribute_t *create_update_state(cluster_t *cluster, uint8_t value)
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
}
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value)
attribute_t *create_update_state_progress(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
} /* attribute */
@@ -369,10 +371,10 @@ attribute_t *create_interface_enabled(cluster_t *cluster, bool value)
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_bool(value));
}
attribute_t *create_last_networking_status(cluster_t *cluster, uint8_t value)
attribute_t *create_last_networking_status(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastNetworkingStatus::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_enum8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -381,10 +383,10 @@ attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t
ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length));
}
attribute_t *create_last_connect_error_value(cluster_t *cluster, int32_t value)
attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable<int32_t> value)
{
return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastConnectErrorValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_int32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int32(value));
}
} /* attribute */
@@ -520,76 +522,76 @@ attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length)
ATTRIBUTE_FLAG_NULLABLE, esp_matter_octet_str(value, length));
}
attribute_t *create_security_type(cluster_t *cluster, uint8_t value)
attribute_t *create_security_type(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::SecurityType::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_enum8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
}
attribute_t *create_wifi_version(cluster_t *cluster, uint8_t value)
attribute_t *create_wifi_version(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_enum8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_channel_number(cluster_t *cluster, uint16_t value)
attribute_t *create_channel_number(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
}
attribute_t *create_rssi(cluster_t *cluster, int8_t value)
attribute_t *create_rssi(cluster_t *cluster, nullable<int8_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::Rssi::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_int8(value));
esp_matter_nullable_int8(value));
}
attribute_t *create_beacon_lost_count(cluster_t *cluster, uint32_t value)
attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_beacon_rx_count(cluster_t *cluster, uint32_t value)
attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, uint32_t value)
attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, uint32_t value)
attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, uint32_t value)
attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, uint32_t value)
attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_current_max_rate(cluster_t *cluster, uint64_t value)
attribute_t *create_current_max_rate(cluster_t *cluster, nullable<uint64_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint64(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value));
}
attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value)
attribute_t *create_overrun_count(cluster_t *cluster, nullable<uint64_t> value)
{
return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::OverrunCount::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint64(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value));
}
} /* attribute */
@@ -598,16 +600,16 @@ attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value)
namespace diagnostics_network_thread {
namespace attribute {
attribute_t *create_channel(cluster_t *cluster, uint16_t value)
attribute_t *create_channel(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Channel::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
}
attribute_t *create_routing_role(cluster_t *cluster, uint8_t value)
attribute_t *create_routing_role(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RoutingRole::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_enum8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length)
@@ -616,16 +618,16 @@ attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t lengt
ATTRIBUTE_FLAG_NULLABLE, esp_matter_char_str(value, length));
}
attribute_t *create_pan_id(cluster_t *cluster, uint16_t value)
attribute_t *create_pan_id(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PanId::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
}
attribute_t *create_extended_pan_id(cluster_t *cluster, uint64_t value)
attribute_t *create_extended_pan_id(cluster_t *cluster, nullable<uint64_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint64(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value));
}
attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -646,34 +648,34 @@ attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t len
ATTRIBUTE_FLAG_NONE, esp_matter_array(value, length, count));
}
attribute_t *create_partition_id(cluster_t *cluster, uint32_t value)
attribute_t *create_partition_id(cluster_t *cluster, nullable<uint32_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PartitionId::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint32(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
}
attribute_t *create_weighting(cluster_t *cluster, uint8_t value)
attribute_t *create_weighting(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Weighting::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_data_version(cluster_t *cluster, uint8_t value)
attribute_t *create_data_version(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::DataVersion::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_stable_data_version(cluster_t *cluster, uint8_t value)
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_leader_router_id(cluster_t *cluster, uint8_t value)
attribute_t *create_leader_router_id(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -728,7 +730,8 @@ namespace attribute {
attribute_t *create_label_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{
return esp_matter::attribute::create(cluster, UserLabel::Attributes::LabelList::Id, ATTRIBUTE_FLAG_WRITABLE,
return esp_matter::attribute::create(cluster, UserLabel::Attributes::LabelList::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_array(value, length, count));
}
@@ -834,23 +837,25 @@ attribute_t *create_global_scene_control(cluster_t *cluster, bool value)
esp_matter_bool(value));
}
attribute_t *create_on_time(cluster_t *cluster, uint16_t value)
attribute_t *create_on_time(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, OnOff::Attributes::OnTime::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value)
attribute_t *create_off_wait_time(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, OnOff::Attributes::OffWaitTime::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value)
attribute_t *create_start_up_on_off(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, OnOff::Attributes::StartUpOnOff::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_enum8(value));
esp_matter_nullable_enum8(value));
}
} /* attribute */
@@ -859,16 +864,18 @@ attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value)
namespace level_control {
namespace attribute {
attribute_t *create_current_level(cluster_t *cluster, uint8_t value)
attribute_t *create_current_level(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::CurrentLevel::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_on_level(cluster_t *cluster, uint8_t value)
attribute_t *create_on_level(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::OnLevel::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_options(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
@@ -925,29 +932,32 @@ attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value)
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
}
attribute_t *create_on_transition_time(cluster_t* cluster, uint16_t value)
attribute_t *create_on_transition_time(cluster_t* cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::OnTransitionTime::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_off_transition_time(cluster_t* cluster, uint16_t value)
attribute_t *create_off_transition_time(cluster_t* cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::OffTransitionTime::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_default_move_rate(cluster_t* cluster, uint8_t value)
attribute_t *create_default_move_rate(cluster_t* cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::DefaultMoveRate::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_start_up_current_level(cluster_t *cluster, uint8_t value)
attribute_t *create_start_up_current_level(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, LevelControl::Attributes::StartUpCurrentLevel::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_uint8(value));
esp_matter_nullable_uint8(value));
}
} /* attribute */
@@ -1022,10 +1032,11 @@ attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, ui
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, uint16_t value)
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_current_x(cluster_t *cluster, uint16_t value)
@@ -1076,10 +1087,10 @@ attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
attribute_t *create_number_of_primaries(cluster_t *cluster, uint8_t value)
attribute_t *create_number_of_primaries(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, ColorControl::Attributes::NumberOfPrimaries::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
}
attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index)
@@ -1148,32 +1159,32 @@ attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t ind
return NULL;
}
attribute_t *create_primary_n_intensity(cluster_t * cluster, uint8_t value, uint8_t index)
attribute_t *create_primary_n_intensity(cluster_t * cluster, nullable<uint8_t> value, uint8_t index)
{
switch (index) {
case 1:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
case 2:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
case 3:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
case 4:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
case 5:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
case 6:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6Intensity::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break;
default:
break;
@@ -1199,10 +1210,11 @@ attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value)
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
}
attribute_t *create_percent_setting(cluster_t *cluster, uint8_t value)
attribute_t *create_percent_setting(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, FanControl::Attributes::PercentSetting::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_percent_current(cluster_t *cluster, uint8_t value)
@@ -1217,10 +1229,10 @@ attribute_t *create_percent_current(cluster_t *cluster, uint8_t value)
namespace thermostat {
namespace attribute {
attribute_t *create_local_temperature(cluster_t *cluster, int16_t value)
attribute_t *create_local_temperature(cluster_t *cluster, nullable<int16_t> value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::LocalTemperature::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_int16(value));
esp_matter_nullable_int16(value));
}
attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value)
@@ -1268,10 +1280,10 @@ attribute_t *create_system_mode(cluster_t *cluster, uint8_t value, uint8_t min,
namespace door_lock {
namespace attribute {
attribute_t *create_lock_state(cluster_t *cluster, uint8_t value)
attribute_t *create_lock_state(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, DoorLock::Attributes::LockState::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_enum8(value));
esp_matter_nullable_uint8(value));
}
attribute_t *create_lock_type(cluster_t *cluster, uint8_t value)
@@ -1334,16 +1346,18 @@ attribute_t *create_physical_closed_limit_tilt(cluster_t *cluster, uint16_t valu
esp_matter_uint16(value));
}
attribute_t *create_current_position_lift(cluster_t *cluster, uint8_t value)
attribute_t *create_current_position_lift(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLift::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLift::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_current_position_tilt(cluster_t *cluster, uint8_t value)
attribute_t *create_current_position_tilt(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTilt::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTilt::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value)
@@ -1364,34 +1378,36 @@ attribute_t *create_config_status(cluster_t *cluster, uint8_t value)
esp_matter_bitmap8(value));
}
attribute_t *create_current_position_lift_percentage(cluster_t *cluster, uint8_t value)
attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLiftPercentage::Id, ATTRIBUTE_FLAG_NONVOLATILE |
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLiftPercentage::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, uint8_t value)
attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTiltPercentage::Id, ATTRIBUTE_FLAG_NONVOLATILE |
ATTRIBUTE_FLAG_NULLABLE, esp_matter_uint8(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTiltPercentage::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_nullable_uint8(value));
}
attribute_t *create_operational_status(cluster_t *cluster, uint8_t value)
attribute_t *create_operational_status(cluster_t *cluster, nullable<uint8_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::OperationalStatus::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_bitmap8(value));
esp_matter_nullable_uint8(value));
}
attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, uint16_t value)
attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_uint16(value));
esp_matter_nullable_uint16(value));
}
attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, uint16_t value)
attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_uint16(value));
esp_matter_nullable_uint16(value));
}
attribute_t *create_end_product_type(cluster_t *cluster, uint8_t value)
@@ -1400,16 +1416,18 @@ attribute_t *create_end_product_type(cluster_t *cluster, uint8_t value)
esp_matter_enum8(value));
}
attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, uint16_t value)
attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_MASK_NONVOLATILE, esp_matter_uint16(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_MASK_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, uint16_t value)
attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_MASK_NONVOLATILE, esp_matter_uint16(value));
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_MASK_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_installed_open_limit_lift(cluster_t *cluster, uint16_t value)
@@ -1478,22 +1496,22 @@ attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value)
namespace temperature_measurement {
namespace attribute {
attribute_t *create_temperature_measured_value(cluster_t *cluster, int16_t value)
attribute_t *create_temperature_measured_value(cluster_t *cluster, nullable<int16_t> value)
{
return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_int16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
}
attribute_t *create_temperature_min_measured_value(cluster_t *cluster, int16_t value)
attribute_t *create_temperature_min_measured_value(cluster_t *cluster, nullable<int16_t> value)
{
return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MinMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_int16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
}
attribute_t *create_temperature_max_measured_value(cluster_t *cluster, int16_t value)
attribute_t *create_temperature_max_measured_value(cluster_t *cluster, nullable<int16_t> value)
{
return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MaxMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_int16(value));
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
}
} /* attribute */
+53 -53
View File
@@ -76,7 +76,7 @@ attribute_t *create_software_version_string(cluster_t *cluster, char *value, uin
attribute_t *create_capability_minima(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally.
* If the attributes are added in some other cluster, then the value is not maintained internally.
* If the attributes are added in some other cluster, then the value is not maintained internally.
**/
attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length);
attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length);
@@ -100,7 +100,7 @@ namespace attribute {
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_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, nullable<uint8_t> value);
} /* attribute */
} /* ota_requestor */
@@ -121,9 +121,9 @@ attribute_t *create_networks(cluster_t *cluster, uint8_t *value, uint16_t length
attribute_t *create_scan_max_time_seconds(cluster_t *cluster, uint8_t value);
attribute_t *create_connect_max_time_seconds(cluster_t *cluster, uint8_t value);
attribute_t *create_interface_enabled(cluster_t *cluster, bool value);
attribute_t *create_last_networking_status(cluster_t *cluster, uint8_t value);
attribute_t *create_last_networking_status(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length);
attribute_t *create_last_connect_error_value(cluster_t *cluster, int32_t value);
attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable<int32_t> value);
} /* attribute */
} /* network_commissioning */
@@ -166,40 +166,40 @@ attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value
namespace diagnostics_network_wifi {
namespace attribute {
attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length);
attribute_t *create_security_type(cluster_t *cluster, uint8_t value);
attribute_t *create_wifi_version(cluster_t *cluster, uint8_t value);
attribute_t *create_channel_number(cluster_t *cluster, uint16_t value);
attribute_t *create_rssi(cluster_t *cluster, int8_t value);
attribute_t *create_security_type(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_wifi_version(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_channel_number(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_rssi(cluster_t *cluster, nullable<int8_t> value);
/** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally.
* If the attributes are added in some other cluster, then the value is not maintained internally.
* If the attributes are added in some other cluster, then the value is not maintained internally.
**/
attribute_t *create_beacon_lost_count(cluster_t *cluster, uint32_t value);
attribute_t *create_beacon_rx_count(cluster_t *cluster, uint32_t value);
attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, uint32_t value);
attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, uint32_t value);
attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, uint32_t value);
attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, uint32_t value);
attribute_t *create_current_max_rate(cluster_t *cluster, uint64_t value);
attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value);
attribute_t *create_beacon_lost_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_packet_multicast_tx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_packet_unicast_rx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_current_max_rate(cluster_t *cluster, nullable<uint64_t> value);
attribute_t *create_overrun_count(cluster_t *cluster, nullable<uint64_t> value);
} /* attribute */
} /* diagnostics_network_wifi */
namespace diagnostics_network_thread {
namespace attribute {
attribute_t *create_channel(cluster_t *cluster, uint16_t value);
attribute_t *create_routing_role(cluster_t *cluster, uint8_t value);
attribute_t *create_channel(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_routing_role(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length);
attribute_t *create_pan_id(cluster_t *cluster, uint16_t value);
attribute_t *create_extended_pan_id(cluster_t *cluster, uint64_t value);
attribute_t *create_pan_id(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_extended_pan_id(cluster_t *cluster, nullable<uint64_t> value);
attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length);
attribute_t *create_neighbor_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_partition_id(cluster_t *cluster, uint32_t value);
attribute_t *create_weighting(cluster_t *cluster, uint8_t value);
attribute_t *create_data_version(cluster_t *cluster, uint8_t value);
attribute_t *create_stable_data_version(cluster_t *cluster, uint8_t value);
attribute_t *create_leader_router_id(cluster_t *cluster, uint8_t value);
attribute_t *create_partition_id(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_weighting(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_data_version(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_stable_data_version(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_leader_router_id(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_channel_page0_mask(cluster_t *cluster, uint8_t *value, uint16_t length);
attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
@@ -253,16 +253,16 @@ namespace on_off {
namespace attribute {
attribute_t *create_on_off(cluster_t *cluster, bool value);
attribute_t *create_global_scene_control(cluster_t *cluster, bool value);
attribute_t *create_on_time(cluster_t *cluster, uint16_t value);
attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value);
attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value);
attribute_t *create_on_time(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_off_wait_time(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_start_up_on_off(cluster_t *cluster, nullable<uint8_t> value);
} /* attribute */
} /* on_off */
namespace level_control {
namespace attribute {
attribute_t *create_current_level(cluster_t *cluster, uint8_t value);
attribute_t *create_on_level(cluster_t *cluster, uint8_t value);
attribute_t *create_current_level(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_on_level(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_options(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max);
attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value);
attribute_t *create_min_level(cluster_t *cluster, uint8_t value);
@@ -271,10 +271,10 @@ attribute_t *create_current_frequency(cluster_t *cluster, uint16_t value);
attribute_t *create_min_frequency(cluster_t *cluster, uint16_t value);
attribute_t *create_max_frequency(cluster_t *cluster, uint16_t value);
attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value);
attribute_t *create_on_transition_time(cluster_t* cluster, uint16_t value);
attribute_t *create_off_transition_time(cluster_t* cluster, uint16_t value);
attribute_t *create_default_move_rate(cluster_t* cluster, uint8_t value);
attribute_t *create_start_up_current_level(cluster_t *cluster, uint8_t value);
attribute_t *create_on_transition_time(cluster_t* cluster, nullable<uint16_t> value);
attribute_t *create_off_transition_time(cluster_t* cluster, nullable<uint16_t> value);
attribute_t *create_default_move_rate(cluster_t* cluster, nullable<uint8_t> value);
attribute_t *create_start_up_current_level(cluster_t *cluster, nullable<uint8_t> value);
} /* attribute */
} /* level_control */
@@ -291,7 +291,7 @@ attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value)
attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value);
attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value);
attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value);
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, uint16_t value);
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_current_x(cluster_t *cluster, uint16_t value);
attribute_t *create_current_y(cluster_t *cluster, uint16_t value);
attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value);
@@ -300,10 +300,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_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_number_of_primaries(cluster_t *cluster, uint8_t value);
attribute_t *create_number_of_primaries(cluster_t *cluster, nullable<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_t *create_primary_n_intensity(cluster_t * cluster, nullable<uint8_t> value, uint8_t index);
} /* attribute */
} /* color_control */
@@ -311,14 +311,14 @@ namespace fan_control {
namespace attribute {
attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value);
attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value);
attribute_t *create_percent_setting(cluster_t *cluster, uint8_t value);
attribute_t *create_percent_setting(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_percent_current(cluster_t *cluster, uint8_t value);
} /* attribute */
} /* fan_control */
namespace thermostat {
namespace attribute {
attribute_t *create_local_temperature(cluster_t *cluster, int16_t value);
attribute_t *create_local_temperature(cluster_t *cluster, nullable<int16_t> value);
attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, uint16_t value);
attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, uint16_t value);
attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max);
@@ -328,7 +328,7 @@ attribute_t *create_system_mode(cluster_t *cluster, uint8_t value, uint8_t min,
namespace door_lock {
namespace attribute {
attribute_t *create_lock_state(cluster_t *cluster, uint8_t value);
attribute_t *create_lock_state(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_lock_type(cluster_t *cluster, uint8_t value);
attribute_t *create_actuator_enabled(cluster_t *cluster, bool value);
attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value);
@@ -342,19 +342,19 @@ namespace attribute {
attribute_t *create_type(cluster_t *cluster, uint8_t value);
attribute_t *create_physical_closed_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_physical_closed_limit_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_current_position_lift(cluster_t *cluster, uint8_t value);
attribute_t *create_current_position_tilt(cluster_t *cluster, uint8_t value);
attribute_t *create_current_position_lift(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_current_position_tilt(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_config_status(cluster_t *cluster, uint8_t value);
attribute_t *create_current_position_lift_percentage(cluster_t *cluster, uint8_t value);
attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, uint8_t value);
attribute_t *create_operational_status(cluster_t *cluster, uint8_t value);
attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, uint16_t value);
attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, uint16_t value);
attribute_t *create_current_position_lift_percentage(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_current_position_tilt_percentage(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_operational_status(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_target_position_lift_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_end_product_type(cluster_t *cluster, uint8_t value);
attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, uint16_t value);
attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, uint16_t value);
attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_installed_open_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_installed_closed_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_installed_open_limit_tilt(cluster_t *cluster, uint16_t value);
@@ -374,9 +374,9 @@ attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value);
namespace temperature_measurement {
namespace attribute {
attribute_t *create_temperature_measured_value(cluster_t *cluster, int16_t value);
attribute_t *create_temperature_min_measured_value(cluster_t *cluster, int16_t value);
attribute_t *create_temperature_max_measured_value(cluster_t *cluster, int16_t value);
attribute_t *create_temperature_measured_value(cluster_t *cluster, nullable<int16_t> value);
attribute_t *create_temperature_min_measured_value(cluster_t *cluster, nullable<int16_t> value);
attribute_t *create_temperature_max_measured_value(cluster_t *cluster, nullable<int16_t> value);
} /* attribute */
} /* temperature_measurement */
File diff suppressed because it is too large Load Diff
@@ -18,6 +18,8 @@
#include <stdbool.h>
#include <stdint.h>
#include <app/data-model/Nullable.h>
/** Remap attribute values
*
* This can be used to remap attribute values to different ranges.
@@ -33,46 +35,64 @@
*/
#define REMAP_TO_RANGE_INVERSE(value, factor) (factor / value)
/* Nullable base for nullable attribute */
#define ESP_MATTER_VAL_NULLANLE_BASE 0x80
/** ESP Matter Attribute Value type */
typedef enum {
/** Invalid */
ESP_MATTER_VAL_TYPE_INVALID = 0,
/** Boolean */
ESP_MATTER_VAL_TYPE_BOOLEAN,
ESP_MATTER_VAL_TYPE_BOOLEAN = 1,
/** Integer. Mapped to a 32 bit signed integer */
ESP_MATTER_VAL_TYPE_INTEGER,
ESP_MATTER_VAL_TYPE_INTEGER = 2,
/** Floating point number */
ESP_MATTER_VAL_TYPE_FLOAT,
ESP_MATTER_VAL_TYPE_FLOAT = 3,
/** Array Eg. [1,2,3] */
ESP_MATTER_VAL_TYPE_ARRAY,
ESP_MATTER_VAL_TYPE_ARRAY = 4,
/** Char String Eg. "123" */
ESP_MATTER_VAL_TYPE_CHAR_STRING,
ESP_MATTER_VAL_TYPE_CHAR_STRING = 5,
/** Octet String Eg. [0x01, 0x20] */
ESP_MATTER_VAL_TYPE_OCTET_STRING,
ESP_MATTER_VAL_TYPE_OCTET_STRING = 6,
/** 8 bit signed integer */
ESP_MATTER_VAL_TYPE_INT8,
ESP_MATTER_VAL_TYPE_INT8 = 7,
/** 8 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT8,
ESP_MATTER_VAL_TYPE_UINT8 = 8,
/** 16 bit signed integer */
ESP_MATTER_VAL_TYPE_INT16,
ESP_MATTER_VAL_TYPE_INT16 = 9,
/** 16 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT16,
ESP_MATTER_VAL_TYPE_UINT16 = 10,
/** 32 bit signed integer */
ESP_MATTER_VAL_TYPE_INT32,
ESP_MATTER_VAL_TYPE_INT32 = 11,
/** 32 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT32,
ESP_MATTER_VAL_TYPE_UINT32 = 12,
/** 64 bit signed integer */
ESP_MATTER_VAL_TYPE_INT64,
ESP_MATTER_VAL_TYPE_INT64 = 13,
/** 64 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT64,
ESP_MATTER_VAL_TYPE_UINT64 = 14,
/** 8 bit enum */
ESP_MATTER_VAL_TYPE_ENUM8,
ESP_MATTER_VAL_TYPE_ENUM8 = 15,
/** 8 bit bitmap */
ESP_MATTER_VAL_TYPE_BITMAP8,
ESP_MATTER_VAL_TYPE_BITMAP8 = 16,
/** 16 bit bitmap */
ESP_MATTER_VAL_TYPE_BITMAP16,
ESP_MATTER_VAL_TYPE_BITMAP16 = 17,
/** 32 bit bitmap */
ESP_MATTER_VAL_TYPE_BITMAP32,
ESP_MATTER_VAL_TYPE_BITMAP32 = 18,
/** nullable types **/
ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER = ESP_MATTER_VAL_TYPE_INTEGER + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT = ESP_MATTER_VAL_TYPE_FLOAT + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_INT8 = ESP_MATTER_VAL_TYPE_INT8 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_UINT8 = ESP_MATTER_VAL_TYPE_UINT8 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_INT16 = ESP_MATTER_VAL_TYPE_INT16 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_UINT16 = ESP_MATTER_VAL_TYPE_UINT16 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_INT32 = ESP_MATTER_VAL_TYPE_INT32 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_UINT32 = ESP_MATTER_VAL_TYPE_UINT32 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_INT64 = ESP_MATTER_VAL_TYPE_INT64 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_UINT64 = ESP_MATTER_VAL_TYPE_UINT64 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8 = ESP_MATTER_VAL_TYPE_ENUM8 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 = ESP_MATTER_VAL_TYPE_BITMAP8 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16 = ESP_MATTER_VAL_TYPE_BITMAP16 + ESP_MATTER_VAL_NULLANLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32= ESP_MATTER_VAL_TYPE_BITMAP32 + ESP_MATTER_VAL_NULLANLE_BASE,
} esp_matter_val_type_t;
/** ESP Matter Value */
@@ -131,54 +151,110 @@ typedef struct esp_matter_attr_bounds {
/** TODO: Step Value might be needed here later */
} esp_matter_attr_bounds_t;
template <typename T>
class nullable {
public:
nullable(T value)
{
assert(!chip::app::NumericAttributeTraits<T>::IsNullValue(value));
val = value;
}
nullable()
{
chip::app::NumericAttributeTraits<T>::SetNull(val);
}
T value()
{
assert(!is_null());
return val;
}
T value_or(T ret)
{
return is_null() ? ret : val;
}
bool is_null()
{
return chip::app::NumericAttributeTraits<T>::IsNullValue(val);
}
void operator=(T value)
{
assert(!chip::app::NumericAttributeTraits<T>::IsNullValue(value));
this->val = value;
}
void operator=(std::nullptr_t)
{
chip::app::NumericAttributeTraits<T>::SetNull(this->val);
}
private:
T val;
};
/*** Attribute val APIs ***/
/** Invalid */
esp_matter_attr_val_t esp_matter_invalid(void *val);
/** Boolean */
esp_matter_attr_val_t esp_matter_bool(bool val);
/** Integer */
esp_matter_attr_val_t esp_matter_int(int val);
esp_matter_attr_val_t esp_matter_nullable_int(nullable<int> val);
/** Float */
esp_matter_attr_val_t esp_matter_float(float val);
esp_matter_attr_val_t esp_matter_nullable_float(nullable<float> val);
/** 8 bit integer */
esp_matter_attr_val_t esp_matter_int8(int8_t val);
esp_matter_attr_val_t esp_matter_nullable_int8(nullable<int8_t> val);
/** 8 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint8(uint8_t val);
esp_matter_attr_val_t esp_matter_nullable_uint8(nullable<uint8_t> val);
/** 16 bit signed integer */
esp_matter_attr_val_t esp_matter_int16(int16_t val);
esp_matter_attr_val_t esp_matter_nullable_int16(nullable<int16_t> val);
/** 16 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint16(uint16_t val);
esp_matter_attr_val_t esp_matter_nullable_uint16(nullable<uint16_t> val);
/** 32 bit signed integer */
esp_matter_attr_val_t esp_matter_int32(int32_t val);
esp_matter_attr_val_t esp_matter_nullable_int32(nullable<int32_t> val);
/** 32 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint32(uint32_t val);
esp_matter_attr_val_t esp_matter_nullable_uint32(nullable<uint32_t> val);
/** 64 bit signed integer */
esp_matter_attr_val_t esp_matter_int64(int64_t val);
esp_matter_attr_val_t esp_matter_nullable_int64(nullable<int64_t> val);
/** 64 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint64(uint64_t val);
esp_matter_attr_val_t esp_matter_nullable_uint64(nullable<uint64_t> val);
/** 8 bit enum */
esp_matter_attr_val_t esp_matter_enum8(uint8_t val);
esp_matter_attr_val_t esp_matter_nullable_enum8(nullable<uint8_t> val);
/** 8 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap8(uint8_t val);
esp_matter_attr_val_t esp_matter_nullable_bitmap8(nullable<uint8_t> val);
/** 16 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap16(uint16_t val);
esp_matter_attr_val_t esp_matter_nullable_bitmap16(nullable<uint16_t> val);
/** 32 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap32(uint32_t val);
esp_matter_attr_val_t esp_matter_nullable_bitmap32(nullable<uint32_t> val);
/** Character string */
esp_matter_attr_val_t esp_matter_char_str(char *val, uint16_t data_size);
@@ -190,6 +266,7 @@ esp_matter_attr_val_t esp_matter_octet_str(uint8_t *val, uint16_t data_size);
esp_matter_attr_val_t esp_matter_array(uint8_t *val, uint16_t data_size, uint16_t count);
namespace esp_matter {
namespace attribute {
/** Attribute update callback type */
+17 -17
View File
@@ -428,9 +428,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_scan_max_time_seconds(cluster, 0);
attribute::create_connect_max_time_seconds(cluster, 0);
attribute::create_interface_enabled(cluster, 0);
attribute::create_last_networking_status(cluster, 0);
attribute::create_last_networking_status(cluster, nullable<uint8_t>());
attribute::create_last_network_id(cluster, NULL, 0);
attribute::create_last_connect_error_value(cluster, 0);
attribute::create_last_connect_error_value(cluster, nullable<int32_t>());
global::attribute::create_feature_map(cluster, 0);
/* Attributes not managed internally */
@@ -668,10 +668,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0);
attribute::create_bssid(cluster, NULL, 0);
attribute::create_security_type(cluster, 0);
attribute::create_wifi_version(cluster, 0);
attribute::create_channel_number(cluster, 0);
attribute::create_rssi(cluster, 0);
attribute::create_security_type(cluster, nullable<uint8_t>());
attribute::create_wifi_version(cluster, nullable<uint8_t>());
attribute::create_channel_number(cluster, nullable<uint16_t>());
attribute::create_rssi(cluster, nullable<int8_t>());
/* Attributes not managed internally */
if (config) {
@@ -709,19 +709,19 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
if (flags & CLUSTER_FLAG_SERVER) {
/* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0);
attribute::create_channel(cluster, 0);
attribute::create_routing_role(cluster, 0);
attribute::create_channel(cluster, nullable<uint16_t>(0));
attribute::create_routing_role(cluster, nullable<uint8_t>(0));
attribute::create_network_name(cluster, NULL, 0);
attribute::create_pan_id(cluster, 0);
attribute::create_extended_pan_id(cluster, 0);
attribute::create_pan_id(cluster, nullable<uint16_t>(0));
attribute::create_extended_pan_id(cluster, nullable<uint64_t>(0));
attribute::create_mesh_local_prefix(cluster, NULL, 0);
attribute::create_neighbor_table(cluster, NULL, 0, 0);
attribute::create_route_table(cluster, NULL, 0, 0);
attribute::create_partition_id(cluster, 0);
attribute::create_weighting(cluster, 0);
attribute::create_data_version(cluster, 0);
attribute::create_stable_data_version(cluster, 0);
attribute::create_leader_router_id(cluster, 0);
attribute::create_partition_id(cluster, nullable<uint32_t>(0));
attribute::create_weighting(cluster, nullable<uint8_t>(0));
attribute::create_data_version(cluster, nullable<uint8_t>(0));
attribute::create_stable_data_version(cluster, nullable<uint8_t>(0));
attribute::create_leader_router_id(cluster, nullable<uint8_t>(0));
attribute::create_security_policy(cluster, NULL, 0, 0);
attribute::create_channel_page0_mask(cluster, NULL, 0);
attribute::create_operational_dataset_components(cluster, NULL, 0, 0);
@@ -1201,10 +1201,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
/* Attributes managed internally */
attribute::create_remaining_time(cluster, 0);
for (uint8_t idx = 1; idx <= config->number_of_primaries; ++idx) {
for (uint8_t idx = 1; idx <= config->number_of_primaries.value_or(0); ++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);
attribute::create_primary_n_intensity(cluster, nullable<uint8_t>(), idx);
}
}
+22 -22
View File
@@ -85,7 +85,7 @@ typedef struct config {
uint16_t cluster_revision;
bool update_possible;
uint8_t update_state;
uint8_t update_state_progress;
nullable<uint8_t> update_state_progress;
config() : cluster_revision(1), update_possible(1), update_state(0), update_state_progress(0) {}
} config_t;
@@ -247,11 +247,11 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
namespace level_control {
typedef struct config {
uint16_t cluster_revision;
uint8_t current_level;
uint8_t on_level;
nullable<uint8_t> current_level;
nullable<uint8_t> on_level;
uint8_t options;
feature::lighting::config_t lighting;
config() : cluster_revision(5), current_level(0xFF), on_level(0xFF), options(0) {}
config() : cluster_revision(5), current_level(0xFE), on_level(0xFE), options(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
@@ -264,7 +264,7 @@ typedef struct config {
uint8_t color_control_options;
uint8_t enhanced_color_mode;
uint16_t color_capabilities;
uint8_t number_of_primaries;
nullable<uint8_t> number_of_primaries;
feature::hue_saturation::config_t hue_saturation;
feature::color_temperature::config_t color_temperature;
feature::xy::config_t xy;
@@ -282,7 +282,7 @@ typedef struct config {
uint16_t cluster_revision;
uint8_t fan_mode;
uint8_t fan_mode_sequence;
uint8_t percent_setting;
nullable<uint8_t> percent_setting;
uint8_t percent_current;
config() : cluster_revision(2), fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0) {}
} config_t;
@@ -293,10 +293,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace thermostat {
typedef struct config {
uint16_t cluster_revision;
int16_t local_temperature;
nullable<int16_t> local_temperature;
uint8_t control_sequence_of_operation;
uint8_t system_mode;
config() : cluster_revision(5), local_temperature(0xFFFF), control_sequence_of_operation(4), system_mode(1) {}
config() : cluster_revision(5), local_temperature(), control_sequence_of_operation(4), system_mode(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -305,7 +305,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace door_lock {
typedef struct config {
uint16_t cluster_revision;
uint8_t lock_state;
nullable<uint8_t> lock_state;
uint8_t lock_type;
bool actuator_enabled;
uint8_t operating_mode;
@@ -322,19 +322,19 @@ typedef struct config {
uint8_t type;
uint16_t physical_closed_limit_lift;
uint16_t physical_closed_limit_tilt;
uint8_t current_position_lift;
uint8_t current_position_tilt;
nullable<uint16_t> current_position_lift;
nullable<uint16_t> current_position_tilt;
uint16_t number_of_actuations_lift;
uint16_t number_of_actuations_tilt;
uint8_t config_status;
uint8_t current_position_lift_percentage;
uint8_t current_position_tilt_percentage;
uint8_t operational_status;
uint16_t target_position_lift_percent_100ths;
uint16_t target_position_tilt_percent_100ths;
nullable<uint8_t> current_position_lift_percentage;
nullable<uint8_t> current_position_tilt_percentage;
nullable<uint8_t> operational_status;
nullable<uint16_t> target_position_lift_percent_100ths;
nullable<uint16_t> target_position_tilt_percent_100ths;
uint8_t end_product_type;
uint16_t current_position_lift_percent_100ths;
uint16_t current_position_tilt_percent_100ths;
nullable<uint16_t> current_position_lift_percent_100ths;
nullable<uint16_t> current_position_tilt_percent_100ths;
uint16_t installed_open_limit_lift;
uint16_t installed_closed_limit_lift;
uint16_t installed_open_limit_tilt;
@@ -361,10 +361,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace temperature_measurement {
typedef struct config {
uint16_t cluster_revision;
int16_t measured_value;
int16_t min_measured_value;
int16_t max_measured_value;
config() : cluster_revision(4), measured_value(-32768), min_measured_value(-32768), max_measured_value(-32768) {}
nullable<int16_t> measured_value;
nullable<int16_t> min_measured_value;
nullable<int16_t> max_measured_value;
config() : cluster_revision(4), measured_value(), min_measured_value(), max_measured_value() {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
+5 -5
View File
@@ -37,9 +37,9 @@ namespace lighting {
typedef struct config {
bool global_scene_control;
uint16_t on_time;
uint16_t off_wait_time;
uint8_t start_up_on_off;
nullable<uint16_t> on_time;
nullable<uint16_t> off_wait_time;
nullable<uint8_t> start_up_on_off;
config() : global_scene_control(1), on_time(0), off_wait_time(0), start_up_on_off(0) {}
} config_t;
@@ -65,7 +65,7 @@ typedef struct config {
uint16_t remaining_time;
uint8_t min_level;
uint8_t max_level;
uint8_t start_up_current_level;
nullable<uint8_t> start_up_current_level;
config() : remaining_time(0), min_level(1), max_level(254), start_up_current_level(0) {}
} config_t;
@@ -111,7 +111,7 @@ typedef struct config {
uint16_t color_temp_physical_min_mireds;
uint16_t color_temp_physical_max_mireds;
uint16_t couple_color_temp_to_level_min_mireds;
uint16_t startup_color_temperature_mireds;
nullable<uint16_t> startup_color_temperature_mireds;
config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(0),
color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(0),
startup_color_temperature_mireds(0x00fa) {}
+2 -1
View File
@@ -100,10 +100,11 @@ extern "C" void app_main()
color_temperature_light::config_t light_config;
light_config.on_off.on_off = DEFAULT_POWER;
light_config.on_off.lighting.start_up_on_off = DEFAULT_POWER;
light_config.on_off.lighting.start_up_on_off = nullptr;
light_config.level_control.current_level = DEFAULT_BRIGHTNESS;
light_config.level_control.lighting.start_up_current_level = DEFAULT_BRIGHTNESS;
light_config.color_control.color_mode = EMBER_ZCL_COLOR_MODE_COLOR_TEMPERATURE;
light_config.color_control.color_temperature.startup_color_temperature_mireds = nullptr;
endpoint_t *endpoint = color_temperature_light::create(node, &light_config, ENDPOINT_FLAG_NONE, light_handle);
/* These node and endpoint handles can be used to create/add other endpoints and clusters. */