esp_matter: Add support for nullable attribute setting and getting

This commit is contained in:
WanqQixiang
2022-10-20 21:06:21 +08:00
committed by liyashuai
parent dbc6a9c064
commit ca747595be
7 changed files with 1291 additions and 412 deletions
+174 -135
View File
@@ -237,7 +237,8 @@ namespace attribute {
attribute_t *create_binding(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) 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)); esp_matter_array(value, length, count));
} }
@@ -250,7 +251,8 @@ namespace attribute {
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::Id, return esp_matter::attribute::create(cluster, OtaSoftwareUpdateRequestor::Attributes::DefaultOtaProviders::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_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) attribute_t *create_update_possible(cluster_t *cluster, bool value)
@@ -265,10 +267,10 @@ attribute_t *create_update_state(cluster_t *cluster, uint8_t value)
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(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, 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 */ } /* attribute */
@@ -343,10 +345,10 @@ attribute_t *create_interface_enabled(cluster_t *cluster, bool value)
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value)); ATTRIBUTE_FLAG_WRITABLE, 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, return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastNetworkingStatus::Id,
ATTRIBUTE_FLAG_NONE, 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) attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -355,10 +357,10 @@ attribute_t *create_last_network_id(cluster_t *cluster, uint8_t *value, uint16_t
ATTRIBUTE_FLAG_NONE, esp_matter_octet_str(value, length)); ATTRIBUTE_FLAG_NONE, esp_matter_octet_str(value, length));
} }
attribute_t *create_last_connect_error_value(cluster_t *cluster, uint32_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, return esp_matter::attribute::create(cluster, NetworkCommissioning::Attributes::LastConnectErrorValue::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int32(value));
} }
} /* attribute */ } /* attribute */
@@ -493,76 +495,76 @@ attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length)
esp_matter_octet_str(value, length)); 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::SecurityType::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id,
ATTRIBUTE_FLAG_NONE, 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_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, WiFiNetworkDiagnostics::Attributes::OverrunCount::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint64(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint64(value));
} }
} /* attribute */ } /* attribute */
@@ -571,16 +573,16 @@ attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value)
namespace diagnostics_network_thread { namespace diagnostics_network_thread {
namespace attribute { 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Channel::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::RoutingRole::Id,
ATTRIBUTE_FLAG_NONE, 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) attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t length)
@@ -589,16 +591,16 @@ attribute_t *create_network_name(cluster_t *cluster, char *value, uint16_t lengt
ATTRIBUTE_FLAG_NONE, esp_matter_char_str(value, length)); ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PanId::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id,
ATTRIBUTE_FLAG_NONE, 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) attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -619,34 +621,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_FLAG_NONE, esp_matter_array(value, length, count));
} }
attribute_t *create_extended_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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::PartitionId::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::Weighting::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::DataVersion::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id,
ATTRIBUTE_FLAG_NONE, 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) attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -677,6 +679,51 @@ attribute_t *create_active_network_faults(cluster_t *cluster, uint8_t *value, ui
} /* attribute */ } /* attribute */
} /* diagnostics_network_thread */ } /* diagnostics_network_thread */
namespace bridged_device_basic {
namespace attribute {
attribute_t *create_bridged_device_basic_node_label(cluster_t *cluster, char *value, uint16_t length)
{
return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::NodeLabel::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE,
esp_matter_char_str(value, length));
}
attribute_t *create_reachable(cluster_t *cluster, bool value)
{
return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::Reachable::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_bool(value));
}
} /* attribute */
} /* bridged_device_basic */
namespace user_label {
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 | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_array(value, length, count));
}
} /* attribute */
} /* user_label */
namespace fixed_label {
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, FixedLabel::Attributes::LabelList::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count));
}
} /* attribute */
} /* fixed_label */
namespace identify { namespace identify {
namespace attribute { namespace attribute {
@@ -764,23 +811,25 @@ attribute_t *create_global_scene_control(cluster_t *cluster, bool value)
esp_matter_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, return esp_matter::attribute::create(cluster, OnOff::Attributes::OnTime::Id,
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, return esp_matter::attribute::create(cluster, OnOff::Attributes::OffWaitTime::Id,
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, return esp_matter::attribute::create(cluster, OnOff::Attributes::StartUpOnOff::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_NULLABLE,
esp_matter_enum8(value)); esp_matter_nullable_enum8(value));
} }
} /* attribute */ } /* attribute */
@@ -789,16 +838,18 @@ attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value)
namespace level_control { namespace level_control {
namespace attribute { 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_NONE, return esp_matter::attribute::create(cluster, LevelControl::Attributes::CurrentLevel::Id,
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, return esp_matter::attribute::create(cluster, LevelControl::Attributes::OnLevel::Id,
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) attribute_t *create_options(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
@@ -855,28 +906,32 @@ attribute_t *create_on_off_transition_time(cluster_t *cluster, uint16_t value)
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(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, 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, 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, return esp_matter::attribute::create(cluster, LevelControl::Attributes::DefaultMoveRate::Id,
ATTRIBUTE_FLAG_WRITABLE, 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, return esp_matter::attribute::create(cluster, LevelControl::Attributes::StartUpCurrentLevel::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint8(value));
} }
} /* attribute */ } /* attribute */
@@ -951,10 +1006,11 @@ attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, ui
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); 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, return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id,
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) attribute_t *create_current_x(cluster_t *cluster, uint16_t value)
@@ -1005,10 +1061,10 @@ attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
} }
attribute_t *create_number_of_primaries(cluster_t *cluster, uint8_t value) 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_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::NumberOfPrimaries::Id,
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) attribute_t *create_primary_n_x(cluster_t * cluster, uint16_t value, uint8_t index)
@@ -1077,32 +1133,32 @@ attribute_t *create_primary_n_y(cluster_t * cluster, uint16_t value, uint8_t ind
return NULL; 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) { switch (index) {
case 1: case 1:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
case 2: case 2:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
case 3: case 3:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary3Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
case 4: case 4:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary4Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
case 5: case 5:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary5Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
case 6: case 6:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6Intensity::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary6Intensity::Id,
esp_matter_uint8(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
break; break;
default: default:
break; break;
@@ -1124,8 +1180,21 @@ 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_fan_mode_sequence(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, FanControl::Attributes::FanModeSequence::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, FanControl::Attributes::FanModeSequence::Id,
esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(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_nullable_uint8(value));
}
attribute_t *create_percent_current(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, FanControl::Attributes::PercentSetting::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_uint8(value));
} }
} /* attribute */ } /* attribute */
@@ -1134,10 +1203,10 @@ attribute_t *create_fan_mode_sequence(cluster_t *cluster, uint8_t value)
namespace thermostat { namespace thermostat {
namespace attribute { namespace attribute {
attribute_t *create_local_temperature(cluster_t *cluster, uint16_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_NONE, return esp_matter::attribute::create(cluster, Thermostat::Attributes::LocalTemperature::Id, ATTRIBUTE_FLAG_NULLABLE,
esp_matter_uint16(value)); esp_matter_nullable_int16(value));
} }
attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, uint16_t value) attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, uint16_t value)
@@ -1183,10 +1252,10 @@ attribute_t *create_system_mode(cluster_t *cluster, uint8_t value, uint8_t min,
namespace door_lock { namespace door_lock {
namespace attribute { 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_NONE, 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) attribute_t *create_lock_type(cluster_t *cluster, uint8_t value)
@@ -1228,36 +1297,6 @@ attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value
} /* attribute */ } /* attribute */
} /* door_lock */ } /* door_lock */
namespace bridged_device_basic {
namespace attribute {
attribute_t *create_bridged_device_basic_node_label(cluster_t *cluster, char *value, uint16_t length)
{
return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::NodeLabel::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_char_str(value, length));
}
attribute_t *create_reachable(cluster_t *cluster, bool value)
{
return esp_matter::attribute::create(cluster, BridgedDeviceBasic::Attributes::Reachable::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_bool(value));
}
} /* attribute */
} /* bridged_device_basic */
namespace fixed_label {
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, FixedLabel::Attributes::LabelList::Id, ATTRIBUTE_FLAG_WRITABLE,
esp_matter_array(value, length, count));
}
} /* attribute */
} /* fixed_label */
namespace switch_cluster { namespace switch_cluster {
namespace attribute { namespace attribute {
@@ -1285,22 +1324,22 @@ attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value)
namespace temperature_measurement { namespace temperature_measurement {
namespace attribute { 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, return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MeasuredValue::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MinMeasuredValue::Id,
ATTRIBUTE_FLAG_NONE, 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, return esp_matter::attribute::create(cluster, TemperatureMeasurement::Attributes::MaxMeasuredValue::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_int16(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
} }
} /* attribute */ } /* attribute */
+51 -41
View File
@@ -66,6 +66,10 @@ attribute_t *create_hardware_version_string(cluster_t *cluster, char *value, uin
attribute_t *create_software_version(cluster_t *cluster, uint32_t value); attribute_t *create_software_version(cluster_t *cluster, uint32_t value);
attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length); attribute_t *create_software_version_string(cluster_t *cluster, char *value, uint16_t length);
attribute_t *create_capability_minima(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); 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.
**/
attribute_t *create_manufacturing_date(cluster_t *cluster, char *value, uint16_t length); 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); attribute_t *create_part_number(cluster_t *cluster, char *value, uint16_t length);
attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length); attribute_t *create_product_url(cluster_t *cluster, char *value, uint16_t length);
@@ -88,7 +92,7 @@ namespace attribute {
attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); attribute_t *create_default_ota_providers(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_update_possible(cluster_t *cluster, bool value); attribute_t *create_update_possible(cluster_t *cluster, bool value);
attribute_t *create_update_state(cluster_t *cluster, uint8_t value); attribute_t *create_update_state(cluster_t *cluster, uint8_t value);
attribute_t *create_update_state_progress(cluster_t *cluster, uint8_t value); attribute_t *create_update_state_progress(cluster_t *cluster, nullable<uint8_t> value);
} /* attribute */ } /* attribute */
} /* ota_requestor */ } /* ota_requestor */
@@ -109,9 +113,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_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_connect_max_time_seconds(cluster_t *cluster, uint8_t value);
attribute_t *create_interface_enabled(cluster_t *cluster, bool 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_network_id(cluster_t *cluster, uint8_t *value, uint16_t length);
attribute_t *create_last_connect_error_value(cluster_t *cluster, uint32_t value); attribute_t *create_last_connect_error_value(cluster_t *cluster, nullable<int32_t> value);
} /* attribute */ } /* attribute */
} /* network_commissioning */ } /* network_commissioning */
@@ -154,36 +158,40 @@ attribute_t *create_max_group_keys_per_fabric(cluster_t *cluster, uint16_t value
namespace diagnostics_network_wifi { namespace diagnostics_network_wifi {
namespace attribute { namespace attribute {
attribute_t *create_bssid(cluster_t *cluster, uint8_t *value, uint16_t length); 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_security_type(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_wifi_version(cluster_t *cluster, uint8_t value); attribute_t *create_wifi_version(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_channel_number(cluster_t *cluster, uint16_t value); attribute_t *create_channel_number(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_rssi(cluster_t *cluster, int8_t value); attribute_t *create_rssi(cluster_t *cluster, nullable<int8_t> value);
attribute_t *create_beacon_lost_count(cluster_t *cluster, uint32_t value);
attribute_t *create_beacon_rx_count(cluster_t *cluster, uint32_t value); /** These attributes are optional for the cluster, but when added to this cluster, the value is maintained internally.
attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, uint32_t value); * If the attributes are added in some other cluster, then the value is not maintained internally.
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_beacon_lost_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_packet_unicast_tx_count(cluster_t *cluster, uint32_t value); attribute_t *create_beacon_rx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_current_max_rate(cluster_t *cluster, uint64_t value); attribute_t *create_packet_multicast_rx_count(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_overrun_count(cluster_t *cluster, uint64_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 */ } /* attribute */
} /* diagnostics_network_wifi */ } /* diagnostics_network_wifi */
namespace diagnostics_network_thread { namespace diagnostics_network_thread {
namespace attribute { namespace attribute {
attribute_t *create_channel(cluster_t *cluster, uint16_t value); attribute_t *create_channel(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_routing_role(cluster_t *cluster, uint8_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_network_name(cluster_t *cluster, char *value, uint16_t length);
attribute_t *create_pan_id(cluster_t *cluster, uint16_t value); attribute_t *create_pan_id(cluster_t *cluster, nullable<uint16_t> 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);
attribute_t *create_mesh_local_prefix(cluster_t *cluster, uint8_t *value, uint16_t length); 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_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_route_table(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
attribute_t *create_extended_partition_id(cluster_t *cluster, uint32_t value); attribute_t *create_extended_partition_id(cluster_t *cluster, nullable<uint32_t> value);
attribute_t *create_weighting(cluster_t *cluster, uint8_t value); attribute_t *create_weighting(cluster_t *cluster, nullable<uint8_t> value);
attribute_t *create_data_version(cluster_t *cluster, uint8_t value); attribute_t *create_data_version(cluster_t *cluster, nullable<uint8_t> 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);
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);
attribute_t *create_security_policy(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count); 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_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); attribute_t *create_operational_dataset_components(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count);
@@ -218,16 +226,16 @@ namespace on_off {
namespace attribute { namespace attribute {
attribute_t *create_on_off(cluster_t *cluster, bool value); attribute_t *create_on_off(cluster_t *cluster, bool value);
attribute_t *create_global_scene_control(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_on_time(cluster_t *cluster, nullable<uint16_t> 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);
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);
} /* attribute */ } /* attribute */
} /* on_off */ } /* on_off */
namespace level_control { namespace level_control {
namespace attribute { 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);
attribute_t *create_on_level(cluster_t *cluster, 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_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_remaining_time(cluster_t *cluster, uint16_t value);
attribute_t *create_min_level(cluster_t *cluster, uint8_t value); attribute_t *create_min_level(cluster_t *cluster, uint8_t value);
@@ -236,10 +244,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_min_frequency(cluster_t *cluster, uint16_t value);
attribute_t *create_max_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_off_transition_time(cluster_t *cluster, uint16_t 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);
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);
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);
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);
} /* attribute */ } /* attribute */
} /* level_control */ } /* level_control */
@@ -256,7 +264,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_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_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_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_x(cluster_t *cluster, uint16_t value);
attribute_t *create_current_y(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); attribute_t *create_enhanced_current_hue(cluster_t *cluster, uint16_t value);
@@ -265,10 +273,10 @@ attribute_t *create_color_loop_direction(cluster_t *cluster, uint8_t value);
attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value); attribute_t *create_color_loop_time(cluster_t *cluster, uint16_t value);
attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value); attribute_t *create_color_loop_start_enhanced_hue(cluster_t *cluster, uint16_t value);
attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value); attribute_t *create_color_loop_stored_enhanced_hue(cluster_t *cluster, uint16_t value);
attribute_t *create_number_of_primaries(cluster_t *cluster, uint8_t value); attribute_t *create_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_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_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 */ } /* attribute */
} /* color_control */ } /* color_control */
@@ -276,12 +284,14 @@ namespace fan_control {
namespace attribute { namespace attribute {
attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value); 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_fan_mode_sequence(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 */ } /* attribute */
} /* fan_control */ } /* fan_control */
namespace thermostat { namespace thermostat {
namespace attribute { namespace attribute {
attribute_t *create_local_temperature(cluster_t *cluster, uint16_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_cooling_setpoint(cluster_t *cluster, uint16_t value);
attribute_t *create_occupied_heating_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); attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max);
@@ -291,7 +301,7 @@ attribute_t *create_system_mode(cluster_t *cluster, uint8_t value, uint8_t min,
namespace door_lock { namespace door_lock {
namespace attribute { 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_lock_type(cluster_t *cluster, uint8_t value);
attribute_t *create_actuator_enabled(cluster_t *cluster, bool value); attribute_t *create_actuator_enabled(cluster_t *cluster, bool value);
attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value); attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value);
@@ -323,9 +333,9 @@ attribute_t *create_multi_press_max(cluster_t *cluster, uint8_t value);
namespace temperature_measurement { namespace temperature_measurement {
namespace attribute { 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);
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);
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);
} /* attribute */ } /* attribute */
} /* temperature_measurement */ } /* temperature_measurement */
File diff suppressed because it is too large Load Diff
@@ -18,6 +18,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <app/data-model/Nullable.h>
/** Remap attribute values /** Remap attribute values
* *
* This can be used to remap attribute values to different ranges. * This can be used to remap attribute values to different ranges.
@@ -33,42 +35,64 @@
*/ */
#define REMAP_TO_RANGE_INVERSE(value, factor) (factor / value) #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 */ /** ESP Matter Attribute Value type */
typedef enum { typedef enum {
/** Invalid */ /** Invalid */
ESP_MATTER_VAL_TYPE_INVALID = 0, ESP_MATTER_VAL_TYPE_INVALID = 0,
/** Boolean */ /** Boolean */
ESP_MATTER_VAL_TYPE_BOOLEAN, ESP_MATTER_VAL_TYPE_BOOLEAN = 1,
/** Integer. Mapped to a 32 bit signed integer */ /** Integer. Mapped to a 32 bit signed integer */
ESP_MATTER_VAL_TYPE_INTEGER, ESP_MATTER_VAL_TYPE_INTEGER = 2,
/** Floating point number */ /** Floating point number */
ESP_MATTER_VAL_TYPE_FLOAT, ESP_MATTER_VAL_TYPE_FLOAT = 3,
/** Array Eg. [1,2,3] */ /** Array Eg. [1,2,3] */
ESP_MATTER_VAL_TYPE_ARRAY, ESP_MATTER_VAL_TYPE_ARRAY = 4,
/** Char String Eg. "123" */ /** Char String Eg. "123" */
ESP_MATTER_VAL_TYPE_CHAR_STRING, ESP_MATTER_VAL_TYPE_CHAR_STRING = 5,
/** Octet String Eg. [0x01, 0x20] */ /** Octet String Eg. [0x01, 0x20] */
ESP_MATTER_VAL_TYPE_OCTET_STRING, ESP_MATTER_VAL_TYPE_OCTET_STRING = 6,
/** 8 bit signed integer */ /** 8 bit signed integer */
ESP_MATTER_VAL_TYPE_INT8, ESP_MATTER_VAL_TYPE_INT8 = 7,
/** 8 bit unsigned integer */ /** 8 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT8, ESP_MATTER_VAL_TYPE_UINT8 = 8,
/** 16 bit signed integer */ /** 16 bit signed integer */
ESP_MATTER_VAL_TYPE_INT16, ESP_MATTER_VAL_TYPE_INT16 = 9,
/** 16 bit unsigned integer */ /** 16 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT16, ESP_MATTER_VAL_TYPE_UINT16 = 10,
/** 32 bit signed integer */
ESP_MATTER_VAL_TYPE_INT32 = 11,
/** 32 bit unsigned integer */ /** 32 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT32, ESP_MATTER_VAL_TYPE_UINT32 = 12,
/** 64 bit signed integer */
ESP_MATTER_VAL_TYPE_INT64 = 13,
/** 64 bit unsigned integer */ /** 64 bit unsigned integer */
ESP_MATTER_VAL_TYPE_UINT64, ESP_MATTER_VAL_TYPE_UINT64 = 14,
/** 8 bit enum */ /** 8 bit enum */
ESP_MATTER_VAL_TYPE_ENUM8, ESP_MATTER_VAL_TYPE_ENUM8 = 15,
/** 8 bit bitmap */ /** 8 bit bitmap */
ESP_MATTER_VAL_TYPE_BITMAP8, ESP_MATTER_VAL_TYPE_BITMAP8 = 16,
/** 16 bit bitmap */ /** 16 bit bitmap */
ESP_MATTER_VAL_TYPE_BITMAP16, ESP_MATTER_VAL_TYPE_BITMAP16 = 17,
/** 32 bit bitmap */ /** 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_val_type_t;
/** ESP Matter Value */ /** ESP Matter Value */
@@ -87,8 +111,12 @@ typedef union {
int16_t i16; int16_t i16;
/** 16 bit unsigned integer */ /** 16 bit unsigned integer */
uint16_t u16; uint16_t u16;
/** 32 bit signed integer */
int32_t i32;
/** 32 bit unsigned integer */ /** 32 bit unsigned integer */
uint32_t u32; uint32_t u32;
/** 64 bit signed integer */
int64_t i64;
/** 64 bit unsigned integer */ /** 64 bit unsigned integer */
uint64_t u64; uint64_t u64;
/** Array */ /** Array */
@@ -123,48 +151,110 @@ typedef struct esp_matter_attr_bounds {
/** TODO: Step Value might be needed here later */ /** TODO: Step Value might be needed here later */
} esp_matter_attr_bounds_t; } 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 ***/ /*** Attribute val APIs ***/
/** Invalid */ /** Invalid */
esp_matter_attr_val_t esp_matter_invalid(void *val); esp_matter_attr_val_t esp_matter_invalid(void *val);
/** Boolean */ /** Boolean */
esp_matter_attr_val_t esp_matter_bool(bool val); esp_matter_attr_val_t esp_matter_bool(bool val);
/** Integer */ /** Integer */
esp_matter_attr_val_t esp_matter_int(int val); esp_matter_attr_val_t esp_matter_int(int val);
esp_matter_attr_val_t esp_matter_nullable_int(nullable<int> val);
/** Float */ /** Float */
esp_matter_attr_val_t esp_matter_float(float val); 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 */ /** 8 bit integer */
esp_matter_attr_val_t esp_matter_int8(int8_t val); 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 */ /** 8 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint8(uint8_t val); 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 */ /** 16 bit signed integer */
esp_matter_attr_val_t esp_matter_int16(int16_t val); 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 */ /** 16 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint16(uint16_t val); 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 */ /** 32 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint32(uint32_t val); 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 */ /** 64 bit unsigned integer */
esp_matter_attr_val_t esp_matter_uint64(uint64_t val); 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 */ /** 8 bit enum */
esp_matter_attr_val_t esp_matter_enum8(uint8_t val); 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 */ /** 8 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap8(uint8_t val); 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 */ /** 16 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap16(uint16_t val); 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 */ /** 32 bit bitmap */
esp_matter_attr_val_t esp_matter_bitmap32(uint32_t val); 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 */ /** Character string */
esp_matter_attr_val_t esp_matter_char_str(char *val, uint16_t data_size); esp_matter_attr_val_t esp_matter_char_str(char *val, uint16_t data_size);
@@ -176,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); esp_matter_attr_val_t esp_matter_array(uint8_t *val, uint16_t data_size, uint16_t count);
namespace esp_matter { namespace esp_matter {
namespace attribute { namespace attribute {
/** Attribute update callback type */ /** Attribute update callback type */
+18 -18
View File
@@ -249,7 +249,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
if (flags & CLUSTER_FLAG_SERVER) { if (flags & CLUSTER_FLAG_SERVER) {
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
/* Attributes not managed internally */ /* Attributes not managed internally */
if (config) { if (config) {
global::attribute::create_cluster_revision(cluster, config->cluster_revision); global::attribute::create_cluster_revision(cluster, config->cluster_revision);
@@ -391,9 +391,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_scan_max_time_seconds(cluster, 0); attribute::create_scan_max_time_seconds(cluster, 0);
attribute::create_connect_max_time_seconds(cluster, 0); attribute::create_connect_max_time_seconds(cluster, 0);
attribute::create_interface_enabled(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_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); global::attribute::create_feature_map(cluster, 0);
/* Attributes not managed internally */ /* Attributes not managed internally */
@@ -631,10 +631,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
attribute::create_bssid(cluster, NULL, 0); attribute::create_bssid(cluster, NULL, 0);
attribute::create_security_type(cluster, 0); attribute::create_security_type(cluster, nullable<uint8_t>());
attribute::create_wifi_version(cluster, 0); attribute::create_wifi_version(cluster, nullable<uint8_t>());
attribute::create_channel_number(cluster, 0); attribute::create_channel_number(cluster, nullable<uint16_t>());
attribute::create_rssi(cluster, 0); attribute::create_rssi(cluster, nullable<int8_t>());
/* Attributes not managed internally */ /* Attributes not managed internally */
if (config) { if (config) {
@@ -672,19 +672,19 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
if (flags & CLUSTER_FLAG_SERVER) { if (flags & CLUSTER_FLAG_SERVER) {
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
attribute::create_channel(cluster, 0); attribute::create_channel(cluster, nullable<uint16_t>(0));
attribute::create_routing_role(cluster, 0); attribute::create_routing_role(cluster, nullable<uint8_t>(0));
attribute::create_network_name(cluster, NULL, 0); attribute::create_network_name(cluster, NULL, 0);
attribute::create_pan_id(cluster, 0); attribute::create_pan_id(cluster, nullable<uint16_t>(0));
attribute::create_extended_pan_id(cluster, 0); attribute::create_extended_pan_id(cluster, nullable<uint64_t>(0));
attribute::create_mesh_local_prefix(cluster, NULL, 0); attribute::create_mesh_local_prefix(cluster, NULL, 0);
attribute::create_neighbor_table(cluster, NULL, 0, 0); attribute::create_neighbor_table(cluster, NULL, 0, 0);
attribute::create_route_table(cluster, NULL, 0, 0); attribute::create_route_table(cluster, NULL, 0, 0);
attribute::create_extended_partition_id(cluster, 0); attribute::create_extended_partition_id(cluster, nullable<uint32_t>(0));
attribute::create_weighting(cluster, 0); attribute::create_weighting(cluster, nullable<uint8_t>(0));
attribute::create_data_version(cluster, 0); attribute::create_data_version(cluster, nullable<uint8_t>(0));
attribute::create_stable_data_version(cluster, 0); attribute::create_stable_data_version(cluster, nullable<uint8_t>(0));
attribute::create_leader_router_id(cluster, 0); attribute::create_leader_router_id(cluster, nullable<uint8_t>(0));
attribute::create_security_policy(cluster, NULL, 0, 0); attribute::create_security_policy(cluster, NULL, 0, 0);
attribute::create_channel_page0_mask(cluster, NULL, 0); attribute::create_channel_page0_mask(cluster, NULL, 0);
attribute::create_operational_dataset_components(cluster, NULL, 0, 0); attribute::create_operational_dataset_components(cluster, NULL, 0, 0);
@@ -1017,10 +1017,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
/* Attributes managed internally */ /* Attributes managed internally */
attribute::create_remaining_time(cluster, 0); attribute::create_remaining_time(cluster, 0);
for (uint8_t idx = 1; idx <= config->number_of_primaries; ++idx) { 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_x(cluster, 0, idx);
attribute::create_primary_n_y(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);
} }
} }
+12 -14
View File
@@ -81,7 +81,7 @@ typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
bool update_possible; bool update_possible;
uint8_t update_state; 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() : cluster_revision(1), update_possible(1), update_state(0), update_state_progress(0) {}
} config_t; } config_t;
@@ -206,8 +206,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
namespace level_control { namespace level_control {
typedef struct config { typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
uint8_t current_level; nullable<uint8_t> current_level;
uint8_t on_level; nullable<uint8_t> on_level;
uint8_t options; uint8_t options;
feature::lighting::config_t lighting; feature::lighting::config_t lighting;
config() : cluster_revision(5), current_level(0), on_level(1), options(0) {} config() : cluster_revision(5), current_level(0), on_level(1), options(0) {}
@@ -223,7 +223,7 @@ typedef struct config {
uint8_t color_control_options; uint8_t color_control_options;
uint8_t enhanced_color_mode; uint8_t enhanced_color_mode;
uint16_t color_capabilities; uint16_t color_capabilities;
uint8_t number_of_primaries; nullable<uint8_t> number_of_primaries;
feature::hue_saturation::config_t hue_saturation; feature::hue_saturation::config_t hue_saturation;
feature::color_temperature::config_t color_temperature; feature::color_temperature::config_t color_temperature;
feature::xy::config_t xy; feature::xy::config_t xy;
@@ -241,10 +241,8 @@ typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
uint8_t fan_mode; uint8_t fan_mode;
uint8_t fan_mode_sequence; uint8_t fan_mode_sequence;
/* Not implemented nullable<uint8_t> percent_setting;
uint8_t percent_setting;
uint8_t percent_current; uint8_t percent_current;
*/
config() : cluster_revision(2), fan_mode(5), fan_mode_sequence(2) {} config() : cluster_revision(2), fan_mode(5), fan_mode_sequence(2) {}
} config_t; } config_t;
@@ -254,12 +252,12 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace thermostat { namespace thermostat {
typedef struct config { typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
int16_t local_temperature; nullable<int16_t> local_temperature;
int16_t occupied_cooling_setpoint; int16_t occupied_cooling_setpoint;
int16_t occupied_heating_setpoint; int16_t occupied_heating_setpoint;
uint8_t control_sequence_of_operation; uint8_t control_sequence_of_operation;
uint8_t system_mode; uint8_t system_mode;
config() : cluster_revision(5), local_temperature(0), occupied_cooling_setpoint(0x0A28), config() : cluster_revision(5), local_temperature(), occupied_cooling_setpoint(0x0A28),
occupied_heating_setpoint(0x07D0), control_sequence_of_operation(4), system_mode(1) {} occupied_heating_setpoint(0x07D0), control_sequence_of_operation(4), system_mode(1) {}
} config_t; } config_t;
@@ -269,7 +267,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace door_lock { namespace door_lock {
typedef struct config { typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
uint8_t lock_state; nullable<uint8_t> lock_state;
uint8_t lock_type; uint8_t lock_type;
bool actuator_enabled; bool actuator_enabled;
uint32_t auto_relock_time; uint32_t auto_relock_time;
@@ -326,10 +324,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
namespace temperature_measurement { namespace temperature_measurement {
typedef struct config { typedef struct config {
uint16_t cluster_revision; uint16_t cluster_revision;
int16_t measured_value; nullable<int16_t> measured_value;
int16_t min_measured_value; nullable<int16_t> min_measured_value;
int16_t max_measured_value; nullable<int16_t> max_measured_value;
config() : cluster_revision(4), measured_value(-32768), min_measured_value(-32768), max_measured_value(-32768) {} config() : cluster_revision(4), measured_value(), min_measured_value(), max_measured_value() {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
+6 -6
View File
@@ -37,9 +37,9 @@ namespace lighting {
typedef struct config { typedef struct config {
bool global_scene_control; bool global_scene_control;
uint16_t on_time; nullable<uint16_t> on_time;
uint16_t off_wait_time; nullable<uint16_t> off_wait_time;
uint8_t start_up_on_off; 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() : global_scene_control(1), on_time(0), off_wait_time(0), start_up_on_off(0) {}
} config_t; } config_t;
@@ -65,7 +65,7 @@ typedef struct config {
uint16_t remaining_time; uint16_t remaining_time;
uint8_t min_level; uint8_t min_level;
uint8_t max_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() : remaining_time(0), min_level(1), max_level(254), start_up_current_level(0) {}
} config_t; } config_t;
@@ -111,8 +111,8 @@ typedef struct config {
uint16_t color_temp_physical_min_mireds; uint16_t color_temp_physical_min_mireds;
uint16_t color_temp_physical_max_mireds; uint16_t color_temp_physical_max_mireds;
uint16_t couple_color_temp_to_level_min_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(1), 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), color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(0),
startup_color_temperature_mireds(0x00fa) {} startup_color_temperature_mireds(0x00fa) {}
} config_t; } config_t;