Attribute server class that handled fixed attribute values that never change and is the base class for other Attribute server types.

Type Parameters

  • T

Hierarchy (view full)

Constructors

  • Type Parameters

    • T

    Parameters

    • id: AttributeId
    • name: string
    • readAcl: undefined | AccessLevel
    • writeAcl: undefined | AccessLevel
    • schema: TlvSchema<T>
    • isWritable: boolean
    • isSubscribable: boolean
    • requiresTimedInteraction: boolean
    • initValue: T
    • defaultValue: undefined | T
    • datasource: ClusterDatasource<any>
    • Optionalgetter: ((session?: Session, endpoint?: EndpointInterface, isFabricFiltered?: boolean, message?: Message) => T)

      Optional getter function to handle special requirements or the data are stored in different places.

        • (session?, endpoint?, isFabricFiltered?, message?): T
        • Parameters

          • Optionalsession: Session

            the session that is requesting the value (if any)

          • Optionalendpoint: EndpointInterface

            the endpoint the cluster server of this attribute is assigned to

          • OptionalisFabricFiltered: boolean

            whether the read request is fabric scoped or not

          • Optionalmessage: Message

            the wire message that initiated the request (if any)

          Returns T

    Returns FixedAttributeServer<T>

Properties

datasource: ClusterDatasource<any>
defaultValue: T
getter: ((session?: Session, endpoint?: EndpointInterface, isFabricFiltered?: boolean, message?: Message) => T)
isFixed: boolean
isSubscribable: boolean
isWritable: boolean
name: string
requiresTimedInteraction: boolean
schema: TlvSchema<T>
value: undefined | T

The value is undefined when getter/setter are used. But we still handle the version number here.

Accessors

  • get hasFabricSensitiveData(): boolean
  • Returns boolean

  • get readAcl(): AccessLevel
  • Returns AccessLevel

  • get writeAcl(): AccessLevel
  • Returns AccessLevel

Methods

  • Add an internal listener that is called when the value of the attribute changes. The listener is called with the new value and the version number.

    Parameters

    • _listener: ((value: T, version: number) => void)
        • (value, version): void
        • Parameters

          • value: T
          • version: number

          Returns void

    Returns void

  • Add an external listener that is called when the value of the attribute changes. The listener is called with the new value and the old value.

    Parameters

    • _listener: ((newValue: T, oldValue: T) => void)
        • (newValue, oldValue): void
        • Parameters

          • newValue: T
          • oldValue: T

          Returns void

    Returns void

  • Get the value of the attribute. This method is used by the Interaction model to read the value of the attribute and includes the ACL check. It should not be used locally in the code!

    If a getter is defined the value is determined by that getter method.

    Parameters

    Returns T

  • Get the value of the attribute locally. This method should be used locally in the code and does not include the ACL check. If a getter is defined the value is determined by that getter method.

    Returns T

  • Get the value of the attribute including the version number. This method is used by the Interaction model to read the value of the attribute and includes the ACL check. It should not be used locally in the code!

    If a getter is defined the value is determined by that getter method. The version number is always 0 for fixed attributes.

    Parameters

    Returns {
        value: T;
        version: number;
    }

    • value: T
    • version: number
  • Initialize the value of the attribute, used when a persisted value is set initially or when values needs to be adjusted before the Device gets announced. Do not use this method to change values when the device is in use! If a getter or setter is defined the value must be undefined The version number must also be undefined.

    Parameters

    • value: undefined | T

    Returns void

  • Remove an internal listener.

    Parameters

    • _listener: ((value: T, version: number) => void)
        • (value, version): void
        • Parameters

          • value: T
          • version: number

          Returns void

    Returns void

  • Remove an external listener.

    Parameters

    • _listener: ((newValue: T, oldValue: T) => void)
        • (newValue, oldValue): void
        • Parameters

          • newValue: T
          • oldValue: T

          Returns void

    Returns void

  • Add an external listener that is called when the value of the attribute changes. The listener is called with the new value and the old value. This method is a convenient alias for addValueSetListener.

    Parameters

    • _listener: ((newValue: T, oldValue: T) => void)
        • (newValue, oldValue): void
        • Parameters

          • newValue: T
          • oldValue: T

          Returns void

    Returns void

  • Parameters

    • value: T

    Returns void