#![allow(unused_imports)]
use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
use crate::dm::meta::{EventPriority, Reporting};
use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
use crate::error::Result;
use crate::im::{AttributeId, ClusterId, CommandId, EventId};
use crate::tlv::{
ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
};
pub const ID: ClusterId = 0x0101;
pub const REVISION: u16 = 10;
pub const PICS: &str = "DRLK";
pub mod feature {
pub const PIN_CREDENTIAL: u32 = 1 << 0;
pub const RFID_CREDENTIAL: u32 = 1 << 1;
pub const FINGER_CREDENTIALS: u32 = 1 << 2;
pub const WEEK_DAY_ACCESS_SCHEDULES: u32 = 1 << 4;
pub const DOOR_POSITION_SENSOR: u32 = 1 << 5;
pub const FACE_CREDENTIALS: u32 = 1 << 6;
pub const CREDENTIAL_OVER_THE_AIR_ACCESS: u32 = 1 << 7;
pub const USER: u32 = 1 << 8;
pub const YEAR_DAY_ACCESS_SCHEDULES: u32 = 1 << 10;
pub const HOLIDAY_SCHEDULES: u32 = 1 << 11;
pub const UNBOLTING: u32 = 1 << 12;
pub const ALIRO_PROVISIONING: u32 = 1 << 13;
pub const ALIRO_BLEUWB: u32 = 1 << 14;
}
pub const FEATURES: &[Feature] = &[
Feature {
bit: 0,
code: "PIN",
name: "PINCredential",
conform: Conform::OPTIONAL,
},
Feature {
bit: 1,
code: "RID",
name: "RFIDCredential",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 2,
code: "FGP",
name: "FingerCredentials",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 4,
code: "WDSCH",
name: "WeekDayAccessSchedules",
conform: Conform::OPTIONAL,
},
Feature {
bit: 5,
code: "DPS",
name: "DoorPositionSensor",
conform: Conform::OPTIONAL,
},
Feature {
bit: 6,
code: "FACE",
name: "FaceCredentials",
conform: Conform {
clauses: &[
Clause {
verdict: Conformance::Provisional,
when: Condition::Always,
},
Clause {
verdict: Conformance::Optional,
when: Condition::Always,
},
],
},
},
Feature {
bit: 7,
code: "COTA",
name: "CredentialOverTheAirAccess",
conform: Conform::OPTIONAL,
},
Feature {
bit: 8,
code: "USR",
name: "User",
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Any(&[
Condition::Feature(0),
Condition::Feature(1),
Condition::Feature(2),
Condition::Feature(6),
Condition::Feature(13),
]),
}],
},
},
Feature {
bit: 10,
code: "YDSCH",
name: "YearDayAccessSchedules",
conform: Conform::OPTIONAL,
},
Feature {
bit: 11,
code: "HDSCH",
name: "HolidaySchedules",
conform: Conform::OPTIONAL,
},
Feature {
bit: 12,
code: "UBOLT",
name: "Unbolting",
conform: Conform::OPTIONAL,
},
Feature {
bit: 13,
code: "ALIRO",
name: "AliroProvisioning",
conform: Conform::OPTIONAL,
},
Feature {
bit: 14,
code: "ALBU",
name: "AliroBLEUWB",
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(13),
}],
},
},
];
pub mod attribute {
use crate::im::AttributeId;
pub const LOCK_STATE: AttributeId = 0x00;
pub const LOCK_TYPE: AttributeId = 0x01;
pub const ACTUATOR_ENABLED: AttributeId = 0x02;
pub const DOOR_STATE: AttributeId = 0x03;
pub const DOOR_OPEN_EVENTS: AttributeId = 0x04;
pub const DOOR_CLOSED_EVENTS: AttributeId = 0x05;
pub const OPEN_PERIOD: AttributeId = 0x06;
pub const NUMBER_OF_TOTAL_USERS_SUPPORTED: AttributeId = 0x11;
pub const NUMBER_OF_PIN_USERS_SUPPORTED: AttributeId = 0x12;
pub const NUMBER_OF_RFID_USERS_SUPPORTED: AttributeId = 0x13;
pub const NUMBER_OF_WEEK_DAY_SCHEDULES_SUPPORTED_PER_USER: AttributeId = 0x14;
pub const NUMBER_OF_YEAR_DAY_SCHEDULES_SUPPORTED_PER_USER: AttributeId = 0x15;
pub const NUMBER_OF_HOLIDAY_SCHEDULES_SUPPORTED: AttributeId = 0x16;
pub const MAX_PIN_CODE_LENGTH: AttributeId = 0x17;
pub const MIN_PIN_CODE_LENGTH: AttributeId = 0x18;
pub const MAX_RFID_CODE_LENGTH: AttributeId = 0x19;
pub const MIN_RFID_CODE_LENGTH: AttributeId = 0x1A;
pub const CREDENTIAL_RULES_SUPPORT: AttributeId = 0x1B;
pub const NUMBER_OF_CREDENTIALS_SUPPORTED_PER_USER: AttributeId = 0x1C;
pub const LANGUAGE: AttributeId = 0x21;
pub const LED_SETTINGS: AttributeId = 0x22;
pub const AUTO_RELOCK_TIME: AttributeId = 0x23;
pub const SOUND_VOLUME: AttributeId = 0x24;
pub const OPERATING_MODE: AttributeId = 0x25;
pub const SUPPORTED_OPERATING_MODES: AttributeId = 0x26;
pub const DEFAULT_CONFIGURATION_REGISTER: AttributeId = 0x27;
pub const ENABLE_LOCAL_PROGRAMMING: AttributeId = 0x28;
pub const ENABLE_ONE_TOUCH_LOCKING: AttributeId = 0x29;
pub const ENABLE_INSIDE_STATUS_LED: AttributeId = 0x2A;
pub const ENABLE_PRIVACY_MODE_BUTTON: AttributeId = 0x2B;
pub const LOCAL_PROGRAMMING_FEATURES: AttributeId = 0x2C;
pub const WRONG_CODE_ENTRY_LIMIT: AttributeId = 0x30;
pub const USER_CODE_TEMPORARY_DISABLE_TIME: AttributeId = 0x31;
pub const SEND_PIN_OVER_THE_AIR: AttributeId = 0x32;
pub const REQUIRE_PI_NFOR_REMOTE_OPERATION: AttributeId = 0x33;
pub const SECURITY_LEVEL: AttributeId = 0x34;
pub const EXPIRING_USER_TIMEOUT: AttributeId = 0x35;
pub const ALIRO_READER_VERIFICATION_KEY: AttributeId = 0x80;
pub const ALIRO_READER_GROUP_IDENTIFIER: AttributeId = 0x81;
pub const ALIRO_READER_GROUP_SUB_IDENTIFIER: AttributeId = 0x82;
pub const ALIRO_EXPEDITED_TRANSACTION_SUPPORTED_PROTOCOL_VERSIONS: AttributeId = 0x83;
pub const ALIRO_GROUP_RESOLVING_KEY: AttributeId = 0x84;
pub const ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS: AttributeId = 0x85;
pub const ALIRO_BLE_ADVERTISING_VERSION: AttributeId = 0x86;
pub const NUMBER_OF_ALIRO_CREDENTIAL_ISSUER_KEYS_SUPPORTED: AttributeId = 0x87;
pub const NUMBER_OF_ALIRO_ENDPOINT_KEYS_SUPPORTED: AttributeId = 0x88;
}
pub mod command {
use crate::im::CommandId;
pub const LOCK_DOOR: CommandId = 0x00;
pub const UNLOCK_DOOR: CommandId = 0x01;
pub const TOGGLE: CommandId = 0x02;
pub const UNLOCK_WITH_TIMEOUT: CommandId = 0x03;
pub const SET_WEEK_DAY_SCHEDULE: CommandId = 0x0B;
pub const GET_WEEK_DAY_SCHEDULE: CommandId = 0x0C;
pub const GET_WEEK_DAY_SCHEDULE_RESPONSE: CommandId = 0x0C;
pub const CLEAR_WEEK_DAY_SCHEDULE: CommandId = 0x0D;
pub const SET_YEAR_DAY_SCHEDULE: CommandId = 0x0E;
pub const GET_YEAR_DAY_SCHEDULE: CommandId = 0x0F;
pub const GET_YEAR_DAY_SCHEDULE_RESPONSE: CommandId = 0x0F;
pub const CLEAR_YEAR_DAY_SCHEDULE: CommandId = 0x10;
pub const SET_HOLIDAY_SCHEDULE: CommandId = 0x11;
pub const GET_HOLIDAY_SCHEDULE: CommandId = 0x12;
pub const GET_HOLIDAY_SCHEDULE_RESPONSE: CommandId = 0x12;
pub const CLEAR_HOLIDAY_SCHEDULE: CommandId = 0x13;
pub const SET_USER: CommandId = 0x1A;
pub const GET_USER: CommandId = 0x1B;
pub const GET_USER_RESPONSE: CommandId = 0x1C;
pub const CLEAR_USER: CommandId = 0x1D;
pub const SET_CREDENTIAL: CommandId = 0x22;
pub const SET_CREDENTIAL_RESPONSE: CommandId = 0x23;
pub const GET_CREDENTIAL_STATUS: CommandId = 0x24;
pub const GET_CREDENTIAL_STATUS_RESPONSE: CommandId = 0x25;
pub const CLEAR_CREDENTIAL: CommandId = 0x26;
pub const UNBOLT_DOOR: CommandId = 0x27;
pub const SET_ALIRO_READER_CONFIG: CommandId = 0x28;
pub const CLEAR_ALIRO_READER_CONFIG: CommandId = 0x29;
}
pub mod event {
use crate::im::EventId;
pub const DOOR_LOCK_ALARM: EventId = 0x00;
pub const DOOR_STATE_CHANGE: EventId = 0x01;
pub const LOCK_OPERATION: EventId = 0x02;
pub const LOCK_OPERATION_ERROR: EventId = 0x03;
pub const LOCK_USER_CHANGE: EventId = 0x04;
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum AlarmCodeEnum {
LockJammed = 0,
LockFactoryReset = 1,
LockRadioPowerCycled = 3,
WrongCodeEntryLimit = 4,
FrontEsceutcheonRemoved = 5,
DoorForcedOpen = 6,
DoorAjar = 7,
ForcedUser = 8,
}
impl AlarmCodeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::LockJammed),
1 => Some(Self::LockFactoryReset),
3 => Some(Self::LockRadioPowerCycled),
4 => Some(Self::WrongCodeEntryLimit),
5 => Some(Self::FrontEsceutcheonRemoved),
6 => Some(Self::DoorForcedOpen),
7 => Some(Self::DoorAjar),
8 => Some(Self::ForcedUser),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for AlarmCodeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for AlarmCodeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum CredentialRuleEnum {
Single = 0,
Dual = 1,
Tri = 2,
}
impl CredentialRuleEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Single),
1 => Some(Self::Dual),
2 => Some(Self::Tri),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for CredentialRuleEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for CredentialRuleEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum CredentialTypeEnum {
ProgrammingPIN = 0,
PIN = 1,
RFID = 2,
Fingerprint = 3,
FingerVein = 4,
Face = 5,
AliroCredentialIssuerKey = 6,
AliroEvictableEndpointKey = 7,
AliroNonEvictableEndpointKey = 8,
}
impl CredentialTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::ProgrammingPIN),
1 => Some(Self::PIN),
2 => Some(Self::RFID),
3 => Some(Self::Fingerprint),
4 => Some(Self::FingerVein),
5 => Some(Self::Face),
6 => Some(Self::AliroCredentialIssuerKey),
7 => Some(Self::AliroEvictableEndpointKey),
8 => Some(Self::AliroNonEvictableEndpointKey),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for CredentialTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for CredentialTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum DataOperationTypeEnum {
Add = 0,
Clear = 1,
Modify = 2,
}
impl DataOperationTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Add),
1 => Some(Self::Clear),
2 => Some(Self::Modify),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for DataOperationTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for DataOperationTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum DoorStateEnum {
DoorOpen = 0,
DoorClosed = 1,
DoorJammed = 2,
DoorForcedOpen = 3,
DoorUnspecifiedError = 4,
DoorAjar = 5,
}
impl DoorStateEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::DoorOpen),
1 => Some(Self::DoorClosed),
2 => Some(Self::DoorJammed),
3 => Some(Self::DoorForcedOpen),
4 => Some(Self::DoorUnspecifiedError),
5 => Some(Self::DoorAjar),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for DoorStateEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for DoorStateEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum EventTypeEnum {
Operation = 0,
Programming = 1,
Alarm = 2,
}
impl EventTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Operation),
1 => Some(Self::Programming),
2 => Some(Self::Alarm),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for EventTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for EventTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum LEDSettingEnum {
NoLEDSignal = 0,
NoLEDSignalAccessAllowed = 1,
LEDSignalAll = 2,
}
impl LEDSettingEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::NoLEDSignal),
1 => Some(Self::NoLEDSignalAccessAllowed),
2 => Some(Self::LEDSignalAll),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for LEDSettingEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LEDSettingEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum LockDataTypeEnum {
Unspecified = 0,
ProgrammingCode = 1,
UserIndex = 2,
WeekDaySchedule = 3,
YearDaySchedule = 4,
HolidaySchedule = 5,
PIN = 6,
RFID = 7,
Fingerprint = 8,
FingerVein = 9,
Face = 10,
AliroCredentialIssuerKey = 11,
AliroEvictableEndpointKey = 12,
AliroNonEvictableEndpointKey = 13,
}
impl LockDataTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unspecified),
1 => Some(Self::ProgrammingCode),
2 => Some(Self::UserIndex),
3 => Some(Self::WeekDaySchedule),
4 => Some(Self::YearDaySchedule),
5 => Some(Self::HolidaySchedule),
6 => Some(Self::PIN),
7 => Some(Self::RFID),
8 => Some(Self::Fingerprint),
9 => Some(Self::FingerVein),
10 => Some(Self::Face),
11 => Some(Self::AliroCredentialIssuerKey),
12 => Some(Self::AliroEvictableEndpointKey),
13 => Some(Self::AliroNonEvictableEndpointKey),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for LockDataTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LockDataTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum LockOperationTypeEnum {
Lock = 0,
Unlock = 1,
NonAccessUserEvent = 2,
ForcedUserEvent = 3,
Unlatch = 4,
}
impl LockOperationTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Lock),
1 => Some(Self::Unlock),
2 => Some(Self::NonAccessUserEvent),
3 => Some(Self::ForcedUserEvent),
4 => Some(Self::Unlatch),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for LockOperationTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LockOperationTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum LockStateEnum {
NotFullyLocked = 0,
Locked = 1,
Unlocked = 2,
Unlatched = 3,
}
impl LockStateEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::NotFullyLocked),
1 => Some(Self::Locked),
2 => Some(Self::Unlocked),
3 => Some(Self::Unlatched),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for LockStateEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LockStateEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum LockTypeEnum {
DeadBolt = 0,
Magnetic = 1,
Other = 2,
Mortise = 3,
Rim = 4,
LatchBolt = 5,
CylindricalLock = 6,
TubularLock = 7,
InterconnectedLock = 8,
DeadLatch = 9,
DoorFurniture = 10,
Eurocylinder = 11,
}
impl LockTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::DeadBolt),
1 => Some(Self::Magnetic),
2 => Some(Self::Other),
3 => Some(Self::Mortise),
4 => Some(Self::Rim),
5 => Some(Self::LatchBolt),
6 => Some(Self::CylindricalLock),
7 => Some(Self::TubularLock),
8 => Some(Self::InterconnectedLock),
9 => Some(Self::DeadLatch),
10 => Some(Self::DoorFurniture),
11 => Some(Self::Eurocylinder),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for LockTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LockTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum OperatingModeEnum {
Normal = 0,
Vacation = 1,
Privacy = 2,
NoRemoteLockUnlock = 3,
Passage = 4,
}
impl OperatingModeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Normal),
1 => Some(Self::Vacation),
2 => Some(Self::Privacy),
3 => Some(Self::NoRemoteLockUnlock),
4 => Some(Self::Passage),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for OperatingModeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OperatingModeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum OperationErrorEnum {
Unspecified = 0,
InvalidCredential = 1,
DisabledUserDenied = 2,
Restricted = 3,
InsufficientBattery = 4,
}
impl OperationErrorEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unspecified),
1 => Some(Self::InvalidCredential),
2 => Some(Self::DisabledUserDenied),
3 => Some(Self::Restricted),
4 => Some(Self::InsufficientBattery),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for OperationErrorEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OperationErrorEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum OperationSourceEnum {
Unspecified = 0,
Manual = 1,
ProprietaryRemote = 2,
Keypad = 3,
Auto = 4,
Button = 5,
Schedule = 6,
Remote = 7,
RFID = 8,
Biometric = 9,
Aliro = 10,
}
impl OperationSourceEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Unspecified),
1 => Some(Self::Manual),
2 => Some(Self::ProprietaryRemote),
3 => Some(Self::Keypad),
4 => Some(Self::Auto),
5 => Some(Self::Button),
6 => Some(Self::Schedule),
7 => Some(Self::Remote),
8 => Some(Self::RFID),
9 => Some(Self::Biometric),
10 => Some(Self::Aliro),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for OperationSourceEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OperationSourceEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum SoundVolumeEnum {
Silent = 0,
Low = 1,
High = 2,
Medium = 3,
}
impl SoundVolumeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Silent),
1 => Some(Self::Low),
2 => Some(Self::High),
3 => Some(Self::Medium),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for SoundVolumeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for SoundVolumeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum StatusCodeEnum {
DUPLICATE = 2,
OCCUPIED = 3,
}
impl StatusCodeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
2 => Some(Self::DUPLICATE),
3 => Some(Self::OCCUPIED),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for StatusCodeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for StatusCodeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum UserStatusEnum {
Available = 0,
OccupiedEnabled = 1,
OccupiedDisabled = 3,
}
impl UserStatusEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Available),
1 => Some(Self::OccupiedEnabled),
3 => Some(Self::OccupiedDisabled),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for UserStatusEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for UserStatusEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum UserTypeEnum {
UnrestrictedUser = 0,
YearDayScheduleUser = 1,
WeekDayScheduleUser = 2,
ProgrammingUser = 3,
NonAccessUser = 4,
ForcedUser = 5,
DisposableUser = 6,
ExpiringUser = 7,
ScheduleRestrictedUser = 8,
RemoteOnlyUser = 9,
}
impl UserTypeEnum {
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::UnrestrictedUser),
1 => Some(Self::YearDayScheduleUser),
2 => Some(Self::WeekDayScheduleUser),
3 => Some(Self::ProgrammingUser),
4 => Some(Self::NonAccessUser),
5 => Some(Self::ForcedUser),
6 => Some(Self::DisposableUser),
7 => Some(Self::ExpiringUser),
8 => Some(Self::ScheduleRestrictedUser),
9 => Some(Self::RemoteOnlyUser),
_ => None,
}
}
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for UserTypeEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for UserTypeEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct AlarmMaskBitmap: u8 {
const LOCK_JAMMED = 1 << 0;
const LOCK_FACTORY_RESET = 1 << 1;
const LOCK_RADIO_POWER_CYCLED = 1 << 3;
const WRONG_CODE_ENTRY_LIMIT = 1 << 4;
const FRONT_ESCUTCHEON_REMOVED = 1 << 5;
const DOOR_FORCED_OPEN = 1 << 6;
}
}
impl ToTlv for AlarmMaskBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for AlarmMaskBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct ConfigurationRegisterBitmap: u8 {
const LOCAL_PROGRAMMING = 1 << 0;
const KEYPAD_INTERFACE = 1 << 1;
const REMOTE_INTERFACE = 1 << 2;
const SOUND_VOLUME = 1 << 5;
const AUTO_RELOCK_TIME = 1 << 6;
const LED_SETTINGS = 1 << 7;
}
}
impl ToTlv for ConfigurationRegisterBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ConfigurationRegisterBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct CredentialRulesBitmap: u8 {
const SINGLE = 1 << 0;
const DUAL = 1 << 1;
const TRI = 1 << 2;
}
}
impl ToTlv for CredentialRulesBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for CredentialRulesBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct DaysMaskBitmap: u8 {
const SUNDAY = 1 << 0;
const MONDAY = 1 << 1;
const TUESDAY = 1 << 2;
const WEDNESDAY = 1 << 3;
const THURSDAY = 1 << 4;
const FRIDAY = 1 << 5;
const SATURDAY = 1 << 6;
}
}
impl ToTlv for DaysMaskBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for DaysMaskBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct LocalProgrammingFeaturesBitmap: u8 {
const ADD_USERS_CREDENTIALS_SCHEDULES = 1 << 0;
const MODIFY_USERS_CREDENTIALS_SCHEDULES = 1 << 1;
const CLEAR_USERS_CREDENTIALS_SCHEDULES = 1 << 2;
const ADJUST_SETTINGS = 1 << 3;
}
}
impl ToTlv for LocalProgrammingFeaturesBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for LocalProgrammingFeaturesBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
bitflags::bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub struct OperatingModesBitmap: u8 {
const NORMAL = 1 << 0;
const VACATION = 1 << 1;
const PRIVACY = 1 << 2;
const NO_REMOTE_LOCK_UNLOCK = 1 << 3;
const PASSAGE = 1 << 4;
}
}
impl ToTlv for OperatingModesBitmap {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.bits().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OperatingModesBitmap {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct CredentialStruct {
pub credential_type: CredentialTypeEnum,
pub credential_index: u16,
}
impl ToTlv for CredentialStruct {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.credential_type.to_tlv(w, Tag::Context(0))?;
self.credential_index.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for CredentialStruct {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut credential_type = None;
let mut credential_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => credential_type = Some(<CredentialTypeEnum>::from_tlv(reader, &field)?),
Some(1) => credential_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
credential_type: credential_type
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credential_index: credential_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct LockDoorFields<'a> {
pub pin_code: Option<&'a [u8]>,
}
impl<'a> ToTlv for LockDoorFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
if let Some(value) = &self.pin_code {
value.to_tlv(w, Tag::Context(0))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for LockDoorFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut pin_code = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => pin_code = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self { pin_code })
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct UnlockDoorFields<'a> {
pub pin_code: Option<&'a [u8]>,
}
impl<'a> ToTlv for UnlockDoorFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
if let Some(value) = &self.pin_code {
value.to_tlv(w, Tag::Context(0))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for UnlockDoorFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut pin_code = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => pin_code = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self { pin_code })
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct UnlockWithTimeoutFields<'a> {
pub timeout: u16,
pub pin_code: Option<&'a [u8]>,
}
impl<'a> ToTlv for UnlockWithTimeoutFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.timeout.to_tlv(w, Tag::Context(0))?;
if let Some(value) = &self.pin_code {
value.to_tlv(w, Tag::Context(1))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for UnlockWithTimeoutFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut timeout = None;
let mut pin_code = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => timeout = Some(<u16>::from_tlv(reader, &field)?),
Some(1) => pin_code = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
timeout: timeout.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
pin_code,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetWeekDayScheduleFields {
pub week_day_index: u8,
pub user_index: u16,
pub days_mask: DaysMaskBitmap,
pub start_hour: u8,
pub start_minute: u8,
pub end_hour: u8,
pub end_minute: u8,
}
impl ToTlv for SetWeekDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.week_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.days_mask.to_tlv(w, Tag::Context(2))?;
self.start_hour.to_tlv(w, Tag::Context(3))?;
self.start_minute.to_tlv(w, Tag::Context(4))?;
self.end_hour.to_tlv(w, Tag::Context(5))?;
self.end_minute.to_tlv(w, Tag::Context(6))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetWeekDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut week_day_index = None;
let mut user_index = None;
let mut days_mask = None;
let mut start_hour = None;
let mut start_minute = None;
let mut end_hour = None;
let mut end_minute = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => week_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => days_mask = Some(<DaysMaskBitmap>::from_tlv(reader, &field)?),
Some(3) => start_hour = Some(<u8>::from_tlv(reader, &field)?),
Some(4) => start_minute = Some(<u8>::from_tlv(reader, &field)?),
Some(5) => end_hour = Some(<u8>::from_tlv(reader, &field)?),
Some(6) => end_minute = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
week_day_index: week_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
days_mask: days_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
start_hour: start_hour.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
start_minute: start_minute.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
end_hour: end_hour.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
end_minute: end_minute.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetWeekDayScheduleFields {
pub week_day_index: u8,
pub user_index: u16,
}
impl ToTlv for GetWeekDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.week_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetWeekDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut week_day_index = None;
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => week_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
week_day_index: week_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetWeekDayScheduleResponseFields {
pub week_day_index: u8,
pub user_index: u16,
pub status: u8,
pub days_mask: Option<DaysMaskBitmap>,
pub start_hour: Option<u8>,
pub start_minute: Option<u8>,
pub end_hour: Option<u8>,
pub end_minute: Option<u8>,
}
impl ToTlv for GetWeekDayScheduleResponseFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.week_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.status.to_tlv(w, Tag::Context(2))?;
if let Some(value) = &self.days_mask {
value.to_tlv(w, Tag::Context(3))?;
}
if let Some(value) = &self.start_hour {
value.to_tlv(w, Tag::Context(4))?;
}
if let Some(value) = &self.start_minute {
value.to_tlv(w, Tag::Context(5))?;
}
if let Some(value) = &self.end_hour {
value.to_tlv(w, Tag::Context(6))?;
}
if let Some(value) = &self.end_minute {
value.to_tlv(w, Tag::Context(7))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetWeekDayScheduleResponseFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut week_day_index = None;
let mut user_index = None;
let mut status = None;
let mut days_mask = None;
let mut start_hour = None;
let mut start_minute = None;
let mut end_hour = None;
let mut end_minute = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => week_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => status = Some(<u8>::from_tlv(reader, &field)?),
Some(3) => days_mask = Some(<DaysMaskBitmap>::from_tlv(reader, &field)?),
Some(4) => start_hour = Some(<u8>::from_tlv(reader, &field)?),
Some(5) => start_minute = Some(<u8>::from_tlv(reader, &field)?),
Some(6) => end_hour = Some(<u8>::from_tlv(reader, &field)?),
Some(7) => end_minute = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
week_day_index: week_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
days_mask,
start_hour,
start_minute,
end_hour,
end_minute,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ClearWeekDayScheduleFields {
pub week_day_index: u8,
pub user_index: u16,
}
impl ToTlv for ClearWeekDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.week_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ClearWeekDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut week_day_index = None;
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => week_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
week_day_index: week_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetYearDayScheduleFields {
pub year_day_index: u8,
pub user_index: u16,
pub local_start_time: u32,
pub local_end_time: u32,
}
impl ToTlv for SetYearDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.year_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.local_start_time.to_tlv(w, Tag::Context(2))?;
self.local_end_time.to_tlv(w, Tag::Context(3))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetYearDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut year_day_index = None;
let mut user_index = None;
let mut local_start_time = None;
let mut local_end_time = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => year_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => local_start_time = Some(<u32>::from_tlv(reader, &field)?),
Some(3) => local_end_time = Some(<u32>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
year_day_index: year_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_start_time: local_start_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_end_time: local_end_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetYearDayScheduleFields {
pub year_day_index: u8,
pub user_index: u16,
}
impl ToTlv for GetYearDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.year_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetYearDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut year_day_index = None;
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => year_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
year_day_index: year_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetYearDayScheduleResponseFields {
pub year_day_index: u8,
pub user_index: u16,
pub status: u8,
pub local_start_time: Option<u32>,
pub local_end_time: Option<u32>,
}
impl ToTlv for GetYearDayScheduleResponseFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.year_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.status.to_tlv(w, Tag::Context(2))?;
if let Some(value) = &self.local_start_time {
value.to_tlv(w, Tag::Context(3))?;
}
if let Some(value) = &self.local_end_time {
value.to_tlv(w, Tag::Context(4))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetYearDayScheduleResponseFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut year_day_index = None;
let mut user_index = None;
let mut status = None;
let mut local_start_time = None;
let mut local_end_time = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => year_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => status = Some(<u8>::from_tlv(reader, &field)?),
Some(3) => local_start_time = Some(<u32>::from_tlv(reader, &field)?),
Some(4) => local_end_time = Some(<u32>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
year_day_index: year_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_start_time,
local_end_time,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ClearYearDayScheduleFields {
pub year_day_index: u8,
pub user_index: u16,
}
impl ToTlv for ClearYearDayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.year_day_index.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ClearYearDayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut year_day_index = None;
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => year_day_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
year_day_index: year_day_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetHolidayScheduleFields {
pub holiday_index: u8,
pub local_start_time: u32,
pub local_end_time: u32,
pub operating_mode: OperatingModeEnum,
}
impl ToTlv for SetHolidayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.holiday_index.to_tlv(w, Tag::Context(0))?;
self.local_start_time.to_tlv(w, Tag::Context(1))?;
self.local_end_time.to_tlv(w, Tag::Context(2))?;
self.operating_mode.to_tlv(w, Tag::Context(3))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetHolidayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut holiday_index = None;
let mut local_start_time = None;
let mut local_end_time = None;
let mut operating_mode = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => holiday_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => local_start_time = Some(<u32>::from_tlv(reader, &field)?),
Some(2) => local_end_time = Some(<u32>::from_tlv(reader, &field)?),
Some(3) => operating_mode = Some(<OperatingModeEnum>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
holiday_index: holiday_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_start_time: local_start_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_end_time: local_end_time
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
operating_mode: operating_mode
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetHolidayScheduleFields {
pub holiday_index: u8,
}
impl ToTlv for GetHolidayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.holiday_index.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetHolidayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut holiday_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => holiday_index = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
holiday_index: holiday_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetHolidayScheduleResponseFields {
pub holiday_index: u8,
pub status: u8,
pub local_start_time: Option<Nullable<u32>>,
pub local_end_time: Option<Nullable<u32>>,
pub operating_mode: Option<Nullable<OperatingModeEnum>>,
}
impl ToTlv for GetHolidayScheduleResponseFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.holiday_index.to_tlv(w, Tag::Context(0))?;
self.status.to_tlv(w, Tag::Context(1))?;
if let Some(value) = &self.local_start_time {
value.to_tlv(w, Tag::Context(2))?;
}
if let Some(value) = &self.local_end_time {
value.to_tlv(w, Tag::Context(3))?;
}
if let Some(value) = &self.operating_mode {
value.to_tlv(w, Tag::Context(4))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetHolidayScheduleResponseFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut holiday_index = None;
let mut status = None;
let mut local_start_time = None;
let mut local_end_time = None;
let mut operating_mode = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => holiday_index = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => status = Some(<u8>::from_tlv(reader, &field)?),
Some(2) => local_start_time = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
Some(3) => local_end_time = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
Some(4) => {
operating_mode = Some(<Nullable<OperatingModeEnum>>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
holiday_index: holiday_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
local_start_time,
local_end_time,
operating_mode,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ClearHolidayScheduleFields {
pub holiday_index: u8,
}
impl ToTlv for ClearHolidayScheduleFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.holiday_index.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ClearHolidayScheduleFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut holiday_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => holiday_index = Some(<u8>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
holiday_index: holiday_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetUserFields<'a> {
pub operation_type: DataOperationTypeEnum,
pub user_index: u16,
pub user_name: Nullable<&'a str>,
pub user_unique_id: Nullable<u32>,
pub user_status: Nullable<UserStatusEnum>,
pub user_type: Nullable<UserTypeEnum>,
pub credential_rule: Nullable<CredentialRuleEnum>,
}
impl<'a> ToTlv for SetUserFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.operation_type.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.user_name.to_tlv(w, Tag::Context(2))?;
self.user_unique_id.to_tlv(w, Tag::Context(3))?;
self.user_status.to_tlv(w, Tag::Context(4))?;
self.user_type.to_tlv(w, Tag::Context(5))?;
self.credential_rule.to_tlv(w, Tag::Context(6))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetUserFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut operation_type = None;
let mut user_index = None;
let mut user_name = None;
let mut user_unique_id = None;
let mut user_status = None;
let mut user_type = None;
let mut credential_rule = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => {
operation_type = Some(<DataOperationTypeEnum>::from_tlv(reader, &field)?)
}
Some(1) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(2) => user_name = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
Some(3) => user_unique_id = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
Some(4) => {
user_status = Some(<Nullable<UserStatusEnum>>::from_tlv(reader, &field)?)
}
Some(5) => user_type = Some(<Nullable<UserTypeEnum>>::from_tlv(reader, &field)?),
Some(6) => {
credential_rule =
Some(<Nullable<CredentialRuleEnum>>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
operation_type: operation_type
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_name: user_name.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_unique_id: user_unique_id
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_status: user_status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_type: user_type.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credential_rule: credential_rule
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetUserFields {
pub user_index: u16,
}
impl ToTlv for GetUserFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.user_index.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetUserFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetUserResponseFields<'a> {
pub user_index: u16,
pub user_name: Nullable<&'a str>,
pub user_unique_id: Nullable<u32>,
pub user_status: Nullable<UserStatusEnum>,
pub user_type: Nullable<UserTypeEnum>,
pub credential_rule: Nullable<CredentialRuleEnum>,
pub credentials: Nullable<TlvList<'a, CredentialStruct>>,
pub creator_fabric_index: Nullable<crate::msg::FabricIndex>,
pub last_modified_fabric_index: Nullable<crate::msg::FabricIndex>,
pub next_user_index: Nullable<u16>,
}
impl<'a> ToTlv for GetUserResponseFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.user_index.to_tlv(w, Tag::Context(0))?;
self.user_name.to_tlv(w, Tag::Context(1))?;
self.user_unique_id.to_tlv(w, Tag::Context(2))?;
self.user_status.to_tlv(w, Tag::Context(3))?;
self.user_type.to_tlv(w, Tag::Context(4))?;
self.credential_rule.to_tlv(w, Tag::Context(5))?;
self.credentials.to_tlv(w, Tag::Context(6))?;
self.creator_fabric_index.to_tlv(w, Tag::Context(7))?;
self.last_modified_fabric_index.to_tlv(w, Tag::Context(8))?;
self.next_user_index.to_tlv(w, Tag::Context(9))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetUserResponseFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut user_index = None;
let mut user_name = None;
let mut user_unique_id = None;
let mut user_status = None;
let mut user_type = None;
let mut credential_rule = None;
let mut credentials = None;
let mut creator_fabric_index = None;
let mut last_modified_fabric_index = None;
let mut next_user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => user_index = Some(<u16>::from_tlv(reader, &field)?),
Some(1) => user_name = Some(<Nullable<&'a str>>::from_tlv(reader, &field)?),
Some(2) => user_unique_id = Some(<Nullable<u32>>::from_tlv(reader, &field)?),
Some(3) => {
user_status = Some(<Nullable<UserStatusEnum>>::from_tlv(reader, &field)?)
}
Some(4) => user_type = Some(<Nullable<UserTypeEnum>>::from_tlv(reader, &field)?),
Some(5) => {
credential_rule =
Some(<Nullable<CredentialRuleEnum>>::from_tlv(reader, &field)?)
}
Some(6) => {
credentials = Some(<Nullable<TlvList<'a, CredentialStruct>>>::from_tlv(
reader, &field,
)?)
}
Some(7) => {
creator_fabric_index = Some(<Nullable<crate::msg::FabricIndex>>::from_tlv(
reader, &field,
)?)
}
Some(8) => {
last_modified_fabric_index = Some(
<Nullable<crate::msg::FabricIndex>>::from_tlv(reader, &field)?,
)
}
Some(9) => next_user_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_name: user_name.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_unique_id: user_unique_id
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_status: user_status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_type: user_type.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credential_rule: credential_rule
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credentials: credentials.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
creator_fabric_index: creator_fabric_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
last_modified_fabric_index: last_modified_fabric_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
next_user_index: next_user_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ClearUserFields {
pub user_index: u16,
}
impl ToTlv for ClearUserFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.user_index.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ClearUserFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut user_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => user_index = Some(<u16>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetCredentialFields<'a> {
pub operation_type: DataOperationTypeEnum,
pub credential: CredentialStruct,
pub credential_data: &'a [u8],
pub user_index: Nullable<u16>,
pub user_status: Nullable<UserStatusEnum>,
pub user_type: Nullable<UserTypeEnum>,
}
impl<'a> ToTlv for SetCredentialFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.operation_type.to_tlv(w, Tag::Context(0))?;
self.credential.to_tlv(w, Tag::Context(1))?;
self.credential_data.to_tlv(w, Tag::Context(2))?;
self.user_index.to_tlv(w, Tag::Context(3))?;
self.user_status.to_tlv(w, Tag::Context(4))?;
self.user_type.to_tlv(w, Tag::Context(5))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetCredentialFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut operation_type = None;
let mut credential = None;
let mut credential_data = None;
let mut user_index = None;
let mut user_status = None;
let mut user_type = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => {
operation_type = Some(<DataOperationTypeEnum>::from_tlv(reader, &field)?)
}
Some(1) => credential = Some(<CredentialStruct>::from_tlv(reader, &field)?),
Some(2) => credential_data = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(3) => user_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
Some(4) => {
user_status = Some(<Nullable<UserStatusEnum>>::from_tlv(reader, &field)?)
}
Some(5) => user_type = Some(<Nullable<UserTypeEnum>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
operation_type: operation_type
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credential: credential.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
credential_data: credential_data
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_status: user_status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_type: user_type.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetCredentialResponseFields {
pub status: u8,
pub user_index: Nullable<u16>,
pub next_credential_index: Option<Nullable<u16>>,
}
impl ToTlv for SetCredentialResponseFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.status.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
if let Some(value) = &self.next_credential_index {
value.to_tlv(w, Tag::Context(2))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetCredentialResponseFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut status = None;
let mut user_index = None;
let mut next_credential_index = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => status = Some(<u8>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
Some(2) => next_credential_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
next_credential_index,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetCredentialStatusFields {
pub credential: CredentialStruct,
}
impl ToTlv for GetCredentialStatusFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.credential.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetCredentialStatusFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut credential = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => credential = Some(<CredentialStruct>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
credential: credential.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GetCredentialStatusResponseFields<'a> {
pub credential_exists: bool,
pub user_index: Nullable<u16>,
pub creator_fabric_index: Nullable<crate::msg::FabricIndex>,
pub last_modified_fabric_index: Nullable<crate::msg::FabricIndex>,
pub next_credential_index: Option<Nullable<u16>>,
pub credential_data: Option<Nullable<&'a [u8]>>,
}
impl<'a> ToTlv for GetCredentialStatusResponseFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.credential_exists.to_tlv(w, Tag::Context(0))?;
self.user_index.to_tlv(w, Tag::Context(1))?;
self.creator_fabric_index.to_tlv(w, Tag::Context(2))?;
self.last_modified_fabric_index.to_tlv(w, Tag::Context(3))?;
if let Some(value) = &self.next_credential_index {
value.to_tlv(w, Tag::Context(4))?;
}
if let Some(value) = &self.credential_data {
value.to_tlv(w, Tag::Context(5))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for GetCredentialStatusResponseFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut credential_exists = None;
let mut user_index = None;
let mut creator_fabric_index = None;
let mut last_modified_fabric_index = None;
let mut next_credential_index = None;
let mut credential_data = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => credential_exists = Some(<bool>::from_tlv(reader, &field)?),
Some(1) => user_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
Some(2) => {
creator_fabric_index = Some(<Nullable<crate::msg::FabricIndex>>::from_tlv(
reader, &field,
)?)
}
Some(3) => {
last_modified_fabric_index = Some(
<Nullable<crate::msg::FabricIndex>>::from_tlv(reader, &field)?,
)
}
Some(4) => next_credential_index = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
Some(5) => credential_data = Some(<Nullable<&'a [u8]>>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
credential_exists: credential_exists
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
user_index: user_index.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
creator_fabric_index: creator_fabric_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
last_modified_fabric_index: last_modified_fabric_index
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
next_credential_index,
credential_data,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ClearCredentialFields {
pub credential: Nullable<CredentialStruct>,
}
impl ToTlv for ClearCredentialFields {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.credential.to_tlv(w, Tag::Context(0))?;
w.end_container()
}
}
impl<'a> FromTlv<'a> for ClearCredentialFields {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut credential = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => {
credential = Some(<Nullable<CredentialStruct>>::from_tlv(reader, &field)?)
}
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
credential: credential.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
})
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct UnboltDoorFields<'a> {
pub pin_code: Option<&'a [u8]>,
}
impl<'a> ToTlv for UnboltDoorFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
if let Some(value) = &self.pin_code {
value.to_tlv(w, Tag::Context(0))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for UnboltDoorFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut pin_code = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => pin_code = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self { pin_code })
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct SetAliroReaderConfigFields<'a> {
pub signing_key: &'a [u8],
pub verification_key: &'a [u8],
pub group_identifier: &'a [u8],
pub group_resolving_key: Option<&'a [u8]>,
}
impl<'a> ToTlv for SetAliroReaderConfigFields<'a> {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
w.start_structure(tag)?;
self.signing_key.to_tlv(w, Tag::Context(0))?;
self.verification_key.to_tlv(w, Tag::Context(1))?;
self.group_identifier.to_tlv(w, Tag::Context(2))?;
if let Some(value) = &self.group_resolving_key {
value.to_tlv(w, Tag::Context(3))?;
}
w.end_container()
}
}
impl<'a> FromTlv<'a> for SetAliroReaderConfigFields<'a> {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
if element.value.container() != Some(ContainerKind::Structure) {
return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
}
let mut signing_key = None;
let mut verification_key = None;
let mut group_identifier = None;
let mut group_resolving_key = None;
loop {
let Some(field) = reader.next_element()? else {
return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
};
if field.value == Value::EndOfContainer {
break;
}
match field.tag.context() {
Some(0) => signing_key = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(1) => verification_key = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(2) => group_identifier = Some(<&'a [u8]>::from_tlv(reader, &field)?),
Some(3) => group_resolving_key = Some(<&'a [u8]>::from_tlv(reader, &field)?),
_ => reader.skip_value(&field)?,
}
}
Ok(Self {
signing_key: signing_key.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
verification_key: verification_key
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
group_identifier: group_identifier
.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
group_resolving_key,
})
}
}
pub const ATTRIBUTES: &[Attribute] = &[
Attribute {
id: 0x0000,
name: "LockState",
kind: "LockStateEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0001,
name: "LockType",
kind: "LockTypeEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0002,
name: "ActuatorEnabled",
kind: "bool",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0003,
name: "DoorState",
kind: "DoorStateEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(5),
}],
},
},
Attribute {
id: 0x0004,
name: "DoorOpenEvents",
kind: "uint32",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(5),
}],
},
},
Attribute {
id: 0x0005,
name: "DoorClosedEvents",
kind: "uint32",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(5),
}],
},
},
Attribute {
id: 0x0006,
name: "OpenPeriod",
kind: "uint16",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(5),
}],
},
},
Attribute {
id: 0x0011,
name: "NumberOfTotalUsersSupported",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x0012,
name: "NumberOfPINUsersSupported",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0013,
name: "NumberOfRFIDUsersSupported",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x0014,
name: "NumberOfWeekDaySchedulesSupportedPerUser",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(4),
}],
},
},
Attribute {
id: 0x0015,
name: "NumberOfYearDaySchedulesSupportedPerUser",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Attribute {
id: 0x0016,
name: "NumberOfHolidaySchedulesSupported",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(11),
}],
},
},
Attribute {
id: 0x0017,
name: "MaxPINCodeLength",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0018,
name: "MinPINCodeLength",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(0),
}],
},
},
Attribute {
id: 0x0019,
name: "MaxRFIDCodeLength",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x001A,
name: "MinRFIDCodeLength",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(1),
}],
},
},
Attribute {
id: 0x001B,
name: "CredentialRulesSupport",
kind: "CredentialRulesBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x001C,
name: "NumberOfCredentialsSupportedPerUser",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x0021,
name: "Language",
kind: "string",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0022,
name: "LEDSettings",
kind: "LEDSettingEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0023,
name: "AutoRelockTime",
kind: "uint32",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0024,
name: "SoundVolume",
kind: "SoundVolumeEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0025,
name: "OperatingMode",
kind: "OperatingModeEnum",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0026,
name: "SupportedOperatingModes",
kind: "OperatingModesBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform::MANDATORY,
},
Attribute {
id: 0x0027,
name: "DefaultConfigurationRegister",
kind: "ConfigurationRegisterBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0028,
name: "EnableLocalProgramming",
kind: "bool",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0029,
name: "EnableOneTouchLocking",
kind: "bool",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x002A,
name: "EnableInsideStatusLED",
kind: "bool",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x002B,
name: "EnablePrivacyModeButton",
kind: "bool",
access: Access::read_write_with(Privilege::View, Privilege::Manage),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x002C,
name: "LocalProgrammingFeatures",
kind: "LocalProgrammingFeaturesBitmap",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform::OPTIONAL,
},
Attribute {
id: 0x0030,
name: "WrongCodeEntryLimit",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Any(&[Condition::Feature(0), Condition::Feature(1)]),
}],
},
},
Attribute {
id: 0x0031,
name: "UserCodeTemporaryDisableTime",
kind: "uint8",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Any(&[Condition::Feature(0), Condition::Feature(1)]),
}],
},
},
Attribute {
id: 0x0032,
name: "SendPINOverTheAir",
kind: "bool",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::All(&[
Condition::Not(&Condition::Feature(8)),
Condition::Feature(0),
]),
}],
},
},
Attribute {
id: 0x0033,
name: "RequirePINforRemoteOperation",
kind: "bool",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::All(&[Condition::Feature(7), Condition::Feature(0)]),
}],
},
},
Attribute {
id: 0x0034,
name: "SecurityLevel",
kind: "",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause::always(Conformance::Deprecated)],
},
},
Attribute {
id: 0x0035,
name: "ExpiringUserTimeout",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::empty(),
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Optional,
when: Condition::Feature(8),
}],
},
},
Attribute {
id: 0x0080,
name: "AliroReaderVerificationKey",
kind: "octstr",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Attribute {
id: 0x0081,
name: "AliroReaderGroupIdentifier",
kind: "octstr",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Attribute {
id: 0x0082,
name: "AliroReaderGroupSubIdentifier",
kind: "octstr",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Attribute {
id: 0x0083,
name: "AliroExpeditedTransactionSupportedProtocolVersions",
kind: "list[octstr]",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Attribute {
id: 0x0084,
name: "AliroGroupResolvingKey",
kind: "octstr",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::NULLABLE,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(14),
}],
},
},
Attribute {
id: 0x0085,
name: "AliroSupportedBLEUWBProtocolVersions",
kind: "list[octstr]",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(14),
}],
},
},
Attribute {
id: 0x0086,
name: "AliroBLEAdvertisingVersion",
kind: "uint8",
access: Access::read_only(Privilege::Administer),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(14),
}],
},
},
Attribute {
id: 0x0087,
name: "NumberOfAliroCredentialIssuerKeysSupported",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Attribute {
id: 0x0088,
name: "NumberOfAliroEndpointKeysSupported",
kind: "uint16",
access: Access::read_only(Privilege::View),
qualities: AttributeQualities::FIXED,
reporting: Reporting::OnChange,
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
];
pub const COMMANDS: &[Command] = &[
Command {
id: 0x00,
name: "LockDoor",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
conform: Conform::MANDATORY,
},
Command {
id: 0x01,
name: "UnlockDoor",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
conform: Conform::MANDATORY,
},
Command {
id: 0x02,
name: "Toggle",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
conform: Conform::DISALLOWED,
},
Command {
id: 0x03,
name: "UnlockWithTimeout",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
conform: Conform::OPTIONAL,
},
Command {
id: 0x0B,
name: "SetWeekDaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(4),
}],
},
},
Command {
id: 0x0C,
name: "GetWeekDaySchedule",
to_server: true,
response: Some(0x0C),
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(4),
}],
},
},
Command {
id: 0x0C,
name: "GetWeekDayScheduleResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(4),
}],
},
},
Command {
id: 0x0D,
name: "ClearWeekDaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(4),
}],
},
},
Command {
id: 0x0E,
name: "SetYearDaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x0F,
name: "GetYearDaySchedule",
to_server: true,
response: Some(0x0F),
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x0F,
name: "GetYearDayScheduleResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x10,
name: "ClearYearDaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(10),
}],
},
},
Command {
id: 0x11,
name: "SetHolidaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(11),
}],
},
},
Command {
id: 0x12,
name: "GetHolidaySchedule",
to_server: true,
response: Some(0x12),
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(11),
}],
},
},
Command {
id: 0x12,
name: "GetHolidayScheduleResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(11),
}],
},
},
Command {
id: 0x13,
name: "ClearHolidaySchedule",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(11),
}],
},
},
Command {
id: 0x1A,
name: "SetUser",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x1B,
name: "GetUser",
to_server: true,
response: Some(0x1C),
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x1C,
name: "GetUserResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x1D,
name: "ClearUser",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x22,
name: "SetCredential",
to_server: true,
response: Some(0x23),
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x23,
name: "SetCredentialResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x24,
name: "GetCredentialStatus",
to_server: true,
response: Some(0x25),
access: Access::invoke(Privilege::Administer),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x25,
name: "GetCredentialStatusResponse",
to_server: false,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x26,
name: "ClearCredential",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
Command {
id: 0x27,
name: "UnboltDoor",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(12),
}],
},
},
Command {
id: 0x28,
name: "SetAliroReaderConfig",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
Command {
id: 0x29,
name: "ClearAliroReaderConfig",
to_server: true,
response: None,
access: Access::invoke(Privilege::Administer).with_qualities(AccessQualities::TIMED),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(13),
}],
},
},
];
pub const EVENTS: &[Event] = &[
Event {
id: 0x00,
name: "DoorLockAlarm",
priority: EventPriority::Critical,
access: Access::read_only(Privilege::View),
conform: Conform::MANDATORY,
},
Event {
id: 0x01,
name: "DoorStateChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(5),
}],
},
},
Event {
id: 0x02,
name: "LockOperation",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform::MANDATORY,
},
Event {
id: 0x03,
name: "LockOperationError",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform::MANDATORY,
},
Event {
id: 0x04,
name: "LockUserChange",
priority: EventPriority::Info,
access: Access::read_only(Privilege::View),
conform: Conform {
clauses: &[Clause {
verdict: Conformance::Mandatory,
when: Condition::Feature(8),
}],
},
},
];
pub const CLUSTER: Cluster = Cluster {
id: ID,
name: "Door Lock",
revision: REVISION,
pics: "DRLK",
derived_from: None,
features: FEATURES,
attributes: ATTRIBUTES,
commands: COMMANDS,
events: EVENTS,
};