Adapter non-volatile memory instrumentation. This class provides interface to interact with ZNP adapter's NV memory. Provided functionality covers basic operations from reading, writing and deleting keys to extended table manipulation.

Constructors

Properties

memoryAlignment?: StructMemoryAlignment

Methods

  • Reads a legacy NV table at defined index into raw Buffer object array. Providing maximum length is necessary in order to prevent invalid memory access.

    Parameters

    • mode: "legacy"

      Only legacy mode is supported with this signature.

    • id: NvItemsIds

      The item index at which the table starts.

    • maxLength: number

      Maximum number of items the table may contain.

    Returns Promise<Buffer[]>

  • Reads a legacy table at defined index into a table structure covering struct entries. Providing maximum length is necessary in order to prevent invalid memory access.

    Type Parameters

    Parameters

    • mode: "legacy"

      Only legacy mode is supported with this signature.

    • id: NvItemsIds

      The item index at which the table starts.

    • maxLength: number

      Maximum number of items the table may contain.

    • OptionaluseTable: MemoryObjectFactory<T>

      Table factory to spawn a table and populate with retrieved data.

    Returns Promise<T>

  • Reads an extended (Z-Stack 3.x.0+) table into raw Buffer object array. Maximum length is optional since the table boundary can be detected automatically.

    Parameters

    • mode: "extended"

      Only extended mode is supported with this signature.

    • sysId: ZSTACK

      SimpleLink system identifier.

    • id: NvItemsIds

      Extended table NV index.

    • OptionalmaxLength: number

      Maximum number of entries to load from the table.

    Returns Promise<Buffer[]>

  • Reads an extended (Z-Stack 3.x.0+) table into a table structure covering struct entries. Maximum length is optional since the table boundary can be detected automatically.

    Type Parameters

    Parameters

    • mode: "extended"

      Only extended mode is supported with this signature.

    • sysId: ZSTACK

      SimpleLink system identifier.

    • id: NvItemsIds

      Extended table NV index.

    • OptionalmaxLength: number

      Maximum number of entries to load from the table.

    • OptionaluseTable: MemoryObjectFactory<T>

      Table factory to spawn a table and populate with retrieved data.

    Returns Promise<T>

  • Determines whether NV item is different from provided data and updates if necessary.

    Parameters

    • id: NvItemsIds

      NV item identifier.

    • data: Buffer

      Desired NV item value.

    • autoInit: boolean = true

      Whether NV item should be automatically initialized if not present.

    Returns Promise<void>

  • Writes extended table entry (user by Z-Stack 3.x+). NV tables within newer Z-Stack releases include 16-bit subId identifying table tnreis.

    Parameters

    • sysId: ZSTACK

      SimpleLink system identifier.

    • id: NvItemsIds

      NV item identifier.

    • subId: number

      Entry index.

    • data: Buffer

      Data to write to the table.

    • Optionaloffset: number

      Offset to write at.

    • autoInit: boolean = true

      Whether non-existent entry should be automatically initialized.

    Returns Promise<void>

  • Writes data to adapter NV memory. Method fails if write fails.

    Parameters

    • id: NvItemsIds

      NV item identifier.

    • data: Buffer | SerializableMemoryObject

      Data to be written.

    • offset: number = 0

      Offset within NV item to write the data.

    • autoInit: boolean = true

      Whether NV item should be automatically initialized if not present.

    Returns Promise<void>