Skip to content

Commit 25d34b0

Browse files
committed
Merge branch 'update_door_lock_cluster' into 'main'
update door lock cluster See merge request app-frameworks/esp-matter!697
2 parents b831d10 + 36b1ccf commit 25d34b0

6 files changed

+1091
-2
lines changed

components/esp_matter/esp_matter_attribute.cpp

+203-1
Original file line numberDiff line numberDiff line change
@@ -3033,12 +3033,130 @@ attribute_t *create_actuator_enabled(cluster_t *cluster, bool value)
30333033
esp_matter_bool(value));
30343034
}
30353035

3036+
attribute_t *create_door_state(cluster_t *cluster, nullable<uint8_t> value)
3037+
{
3038+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::DoorState::Id, ATTRIBUTE_FLAG_NONE,
3039+
esp_matter_nullable_enum8(value));
3040+
}
3041+
3042+
attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value)
3043+
{
3044+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::DoorOpenEvents::Id, ATTRIBUTE_FLAG_WRITABLE,
3045+
esp_matter_uint32(value));
3046+
}
3047+
3048+
attribute_t *create_door_close_events(cluster_t *cluster, uint32_t value)
3049+
{
3050+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::DoorClosedEvents::Id, ATTRIBUTE_FLAG_WRITABLE,
3051+
esp_matter_uint32(value));
3052+
}
3053+
3054+
attribute_t *create_open_period(cluster_t *cluster, uint16_t value)
3055+
{
3056+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::OpenPeriod::Id, ATTRIBUTE_FLAG_WRITABLE,
3057+
esp_matter_uint16(value));
3058+
}
3059+
3060+
attribute_t *create_number_of_total_users_supported(cluster_t *cluster, const uint16_t value)
3061+
{
3062+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfTotalUsersSupported::Id, ATTRIBUTE_FLAG_NONE,
3063+
esp_matter_uint16(value));
3064+
}
3065+
3066+
attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, const uint16_t value)
3067+
{
3068+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfPINUsersSupported::Id, ATTRIBUTE_FLAG_NONE,
3069+
esp_matter_uint16(value));
3070+
}
3071+
3072+
attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, const uint16_t value)
3073+
{
3074+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfRFIDUsersSupported::Id, ATTRIBUTE_FLAG_NONE,
3075+
esp_matter_uint16(value));
3076+
}
3077+
3078+
attribute_t *create_number_of_weekday_schedules_supported_per_user(cluster_t *cluster, const uint8_t value)
3079+
{
3080+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE,
3081+
esp_matter_uint8(value));
3082+
}
3083+
3084+
attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, const uint8_t value)
3085+
{
3086+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE,
3087+
esp_matter_uint8(value));
3088+
}
3089+
3090+
attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, const uint8_t value)
3091+
{
3092+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id, ATTRIBUTE_FLAG_NONE,
3093+
esp_matter_uint8(value));
3094+
}
3095+
3096+
attribute_t *create_max_pin_code_length(cluster_t *cluster, const uint8_t value)
3097+
{
3098+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::MaxPINCodeLength::Id, ATTRIBUTE_FLAG_NONE,
3099+
esp_matter_uint8(value));
3100+
}
3101+
3102+
attribute_t *create_min_pin_code_length(cluster_t *cluster, const uint8_t value)
3103+
{
3104+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::MinPINCodeLength::Id, ATTRIBUTE_FLAG_NONE,
3105+
esp_matter_uint8(value));
3106+
}
3107+
3108+
attribute_t *create_max_rfid_code_length(cluster_t *cluster, const uint8_t value)
3109+
{
3110+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::MaxRFIDCodeLength::Id, ATTRIBUTE_FLAG_NONE,
3111+
esp_matter_uint8(value));
3112+
}
3113+
3114+
attribute_t *create_min_rfid_code_length(cluster_t *cluster, const uint8_t value)
3115+
{
3116+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::MinRFIDCodeLength::Id, ATTRIBUTE_FLAG_NONE,
3117+
esp_matter_uint8(value));
3118+
}
3119+
3120+
attribute_t *create_credential_rules_support(cluster_t *cluster, const uint8_t value)
3121+
{
3122+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::CredentialRulesSupport::Id, ATTRIBUTE_FLAG_NONE,
3123+
esp_matter_bitmap8(value));
3124+
}
3125+
3126+
attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, const uint8_t value)
3127+
{
3128+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Id, ATTRIBUTE_FLAG_NONE,
3129+
esp_matter_uint8(value));
3130+
}
3131+
3132+
attribute_t *create_language(cluster_t *cluster, const char * value, uint16_t length)
3133+
{
3134+
if (length > k_max_language_length) {
3135+
ESP_LOGE(TAG, "Could not create attribute, string size out of bound");
3136+
return NULL;
3137+
}
3138+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::Language::Id, ATTRIBUTE_FLAG_WRITABLE,
3139+
esp_matter_char_str((char *)value, length), k_max_language_length);
3140+
}
3141+
3142+
attribute_t *create_led_settings(cluster_t *cluster, uint8_t value)
3143+
{
3144+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::LEDSettings::Id, ATTRIBUTE_FLAG_WRITABLE,
3145+
esp_matter_enum8(value));
3146+
}
3147+
30363148
attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value)
30373149
{
30383150
return esp_matter::attribute::create(cluster, DoorLock::Attributes::AutoRelockTime::Id, ATTRIBUTE_FLAG_WRITABLE,
30393151
esp_matter_uint32(value));
30403152
}
30413153

3154+
attribute_t *create_sound_valume(cluster_t *cluster, uint8_t value)
3155+
{
3156+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::SoundVolume::Id, ATTRIBUTE_FLAG_WRITABLE,
3157+
esp_matter_enum8(value));
3158+
}
3159+
30423160
attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
30433161
{
30443162
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::OperatingMode::Id,
@@ -3051,12 +3169,96 @@ attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t mi
30513169
return attribute;
30523170
}
30533171

3054-
attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value)
3172+
attribute_t *create_supported_operating_modes(cluster_t *cluster, const uint16_t value)
30553173
{
30563174
return esp_matter::attribute::create(cluster, DoorLock::Attributes::SupportedOperatingModes::Id,
30573175
ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value));
30583176
}
30593177

3178+
attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value)
3179+
{
3180+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::DefaultConfigurationRegister::Id,
3181+
ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value));
3182+
}
3183+
3184+
attribute_t *create_enable_local_programming(cluster_t *cluster, bool value)
3185+
{
3186+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::EnableLocalProgramming::Id,
3187+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3188+
}
3189+
3190+
attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value)
3191+
{
3192+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::EnableOneTouchLocking::Id,
3193+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3194+
}
3195+
3196+
attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value)
3197+
{
3198+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::EnableInsideStatusLED::Id,
3199+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3200+
}
3201+
3202+
attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value)
3203+
{
3204+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::EnablePrivacyModeButton::Id,
3205+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3206+
}
3207+
3208+
attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value)
3209+
{
3210+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::LocalProgrammingFeatures::Id,
3211+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value));
3212+
}
3213+
3214+
attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value)
3215+
{
3216+
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::WrongCodeEntryLimit::Id,
3217+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
3218+
if (!attribute) {
3219+
ESP_LOGE(TAG, "Could not create attribute");
3220+
return NULL;
3221+
}
3222+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255));
3223+
return attribute;
3224+
}
3225+
3226+
attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value)
3227+
{
3228+
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::UserCodeTemporaryDisableTime::Id,
3229+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
3230+
if (!attribute) {
3231+
ESP_LOGE(TAG, "Could not create attribute");
3232+
return NULL;
3233+
}
3234+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255));
3235+
return attribute;
3236+
}
3237+
3238+
attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value)
3239+
{
3240+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::SendPINOverTheAir::Id,
3241+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3242+
}
3243+
3244+
attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value)
3245+
{
3246+
return esp_matter::attribute::create(cluster, DoorLock::Attributes::RequirePINforRemoteOperation::Id,
3247+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bool(value));
3248+
}
3249+
3250+
attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value)
3251+
{
3252+
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::ExpiringUserTimeout::Id,
3253+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
3254+
if (!attribute) {
3255+
ESP_LOGE(TAG, "Could not create attribute");
3256+
return NULL;
3257+
}
3258+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(2880));
3259+
return attribute;
3260+
}
3261+
30603262
} /* attribute */
30613263
} /* door_lock */
30623264

components/esp_matter/esp_matter_attribute.h

+33-1
Original file line numberDiff line numberDiff line change
@@ -652,13 +652,45 @@ attribute_t *create_operational_error(cluster_t *cluster, uint8_t value);
652652
} /* operational_state */
653653

654654
namespace door_lock {
655+
constexpr uint8_t k_max_language_length = 3;
656+
655657
namespace attribute {
656658
attribute_t *create_lock_state(cluster_t *cluster, nullable<uint8_t> value);
657659
attribute_t *create_lock_type(cluster_t *cluster, uint8_t value);
658660
attribute_t *create_actuator_enabled(cluster_t *cluster, bool value);
661+
attribute_t *create_door_state(cluster_t *cluster, uint8_t value);
662+
attribute_t *create_door_open_events(cluster_t *cluster, uint32_t value);
663+
attribute_t *create_door_close_events(cluster_t *cluster, uint32_t value);
664+
attribute_t *create_open_period(cluster_t *cluster, uint16_t value);
665+
attribute_t *create_number_of_total_users_supported(cluster_t *cluster, const uint16_t value);
666+
attribute_t *create_number_of_pin_users_supported(cluster_t *cluster, const uint16_t value);
667+
attribute_t *create_number_of_rfid_users_supported(cluster_t *cluster, const uint16_t value);
668+
attribute_t *create_number_of_weekday_schedules_supported_per_user(cluster_t *cluster, const uint8_t value);
669+
attribute_t *create_number_of_year_day_schedules_supported_per_user(cluster_t *cluster, const uint8_t value);
670+
attribute_t *create_number_of_holiday_schedules_supported(cluster_t *cluster, const uint8_t value);
671+
attribute_t *create_max_pin_code_length(cluster_t *cluster, const uint8_t value);
672+
attribute_t *create_min_pin_code_length(cluster_t *cluster, const uint8_t value);
673+
attribute_t *create_max_rfid_code_length(cluster_t *cluster, const uint8_t value);
674+
attribute_t *create_min_rfid_code_length(cluster_t *cluster, const uint8_t value);
675+
attribute_t *create_credential_rules_support(cluster_t *cluster, const uint8_t value);
676+
attribute_t *create_number_of_credentials_supported_per_user(cluster_t *cluster, const uint8_t value);
677+
attribute_t *create_language(cluster_t *cluster, const char * value, uint16_t length);
678+
attribute_t *create_led_settings(cluster_t *cluster, uint8_t value);
659679
attribute_t *create_auto_relock_time(cluster_t *cluster, uint32_t value);
680+
attribute_t *create_sound_valume(cluster_t *cluster, uint8_t value);
660681
attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max);
661-
attribute_t *create_supported_operating_modes(cluster_t *cluster, uint16_t value);
682+
attribute_t *create_supported_operating_modes(cluster_t *cluster, const uint16_t value);
683+
attribute_t *create_default_configuration_register(cluster_t *cluster, uint16_t value);
684+
attribute_t *create_enable_local_programming(cluster_t *cluster, bool value);
685+
attribute_t *create_enable_one_touch_locking(cluster_t *cluster, bool value);
686+
attribute_t *create_enable_inside_status_led(cluster_t *cluster, bool value);
687+
attribute_t *create_enable_privacy_mode_button(cluster_t *cluster, bool value);
688+
attribute_t *create_local_programming_features(cluster_t *cluster, uint8_t value);
689+
attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value);
690+
attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t value);
691+
attribute_t *create_send_pin_over_the_air(cluster_t *cluster, bool value);
692+
attribute_t *create_require_pin_for_remote_operation(cluster_t *cluster, bool value);
693+
attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value);
662694
} /* attribute */
663695
} /* door_lock */
664696

0 commit comments

Comments
 (0)