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 = undefined
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 = undefined

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

Methods

  • 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 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
  • 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

  • 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