Attribute server which is getting and setting the value for a defined fabric. The values are automatically persisted on fabric level if no custom getter or setter is defined.

Type Parameters

  • T

Hierarchy (view full)

Constructors

Properties

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

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

valueChangeListeners: ((value: T, version: number) => void)[]
valueSetListeners: ((newValue: T, oldValue: T) => void)[]

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 locally for a special Fabric. This method should be used locally in the code and does not include the ACL check. If a getter is defined this method returns an error and the value should be retrieved directly internally.

    Parameters

    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
  • Helper Method to handle needed version increases and trigger the relevant listeners. This method is used internally.

    Parameters

    • value: T
    • oldValue: undefined | T
    • considerVersionChanged: boolean

    Returns void

  • Initialize the attribute with a value. Because the value is stored on fabric level this method only initializes the version number.

    Parameters

    • value: undefined | T

    Returns void

  • Helper Method to process the set of a value in a generic way. This method is used internally.

    Parameters

    • value: T
    • Optionalsession: Session
    • Optionalmessage: Message
    • OptionaldelayChangeEvents: boolean

    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

  • Sanitize the value of the attribute by removing fabric sensitive fields that do not belong to the associated fabric

    Parameters

    • value: T
    • OptionalassociatedFabric: Fabric

    Returns any[] | T

  • Fabric scoped enhancement of set to allow setting special fabricindex locally.

    Parameters

    • value: T
    • session: Session
    • message: Message
    • OptionaldelayChangeEvents: boolean
    • OptionalpreserveFabricIndex: boolean

    Returns void

  • Set Local is not allowed for fabric scoped attributes. Use setLocalForFabric instead.

    Parameters

    • _value: T

    Returns void

  • Set the value of the attribute locally for a fabric. This method should be used locally in the code and does not include the ACL check. If a setter is defined this method cannot be used! If a validator is defined the value is validated before it is stored. Listeners are called when the value changes (internal listeners) or in any case (external listeners).

    Parameters

    Returns void

  • Method that contains the logic to set a value "from remote" (e.g. from a client). For Fabric scoped attributes we need to inject the fabric index into the value.

    Parameters

    • value: T
    • session: Session
    • message: Message
    • OptionaldelayChangeEvents: boolean
    • OptionalpreserveFabricIndex: boolean

    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

  • When the value is handled by getter or setter methods and is changed by other processes this method can be used to notify the attribute server that the value has changed. This will increase the version number and trigger the listeners.

    ACL checks needs to be performed before calling this method.

    Parameters

    Returns void

  • When the value is handled by getter or setter methods and is changed by other processes and no session from the originating process is known this method can be used to notify the attribute server that the value has changed. This will increase the version number and trigger the listeners.

    ACL checks needs to be performed before calling this method.

    Returns void

  • When the value is handled by getter or setter methods and is changed by other processes and no session from the originating process is known this method can be used to notify the attribute server that the value has changed. This will increase the version number and trigger the listeners. ACL checks needs to be performed before calling this method.

    Parameters

    Returns void

  • Parameters

    • value: T

    Returns void