Documentation

Mistake on this page? Email us

Represents a TLV parser compliant to OMA LWM2M 1.0.2 specs.

Hierarchy

  • TlvParser

Index

Constructors

constructor

  • Creates a new parser for the specified data.

    Parameters

    • data: TlvPacketIndirect

      Array to parse or a function to obtain it. The function is not evaluated once but each time you call parse() method. Data can be a plain JavaScript array, an iterable object (such as a typed array like Uint8Array) or a string (which is decoded as base64 to a byte array). Value stream is iterated then it does not need to be all available when parsing starts.

    • Optional info: LwM2MResourceInfo

      The object which describes atributes for resources.

    Returns TlvParser

Methods

parse

  • Parses the input data stream.

    Returns IterableIterator<TlvValue>

    An iterable object of hierarchical TlvNode objects.

parseData

  • Parses the specified data stream.

    Parameters

    • data: TlvPacketIndirect

      Array to parse or a function to obtain it. The function is not evaluated once but each time you call parse() method. Data can be a plain JavaScript array, an iterable object (such as a typed array like Uint8Array) or a string (which is decoded as base64 to a byte array). Value stream is iterated then it does not need to be all available when parsing starts.

    • Optional info: LwM2MResourceInfo

      The object which describes atributes for resources.

    Returns IterableIterator<TlvValue>

    An iterable object of hierarchical TlvNode objects.

parseDataAndConvertToJson

  • Parses the specified data stream and returns its representation as a simple JSON object.

    Parameters

    • data: TlvPacketIndirect

      Array to parse or a function to obtain it. The function is not evaluated once but each time you call parse() method. Data can be a plain JavaScript array, an iterable object (such as a typed array like Uint8Array) or a string (which is decoded as base64 to a byte array). Value stream is iterated then it does not need to be all available when parsing starts.

    • Optional info: LwM2MResourceInfo

      The object which describes atributes for resources.

    Returns any[]

    A simple JSON representation of the whole TlvValue hierarchy.

parseDataAndConvertToString

  • Parses the specified data stream and returns its string representation.

    Parameters

    • data: TlvPacketIndirect

      Array to parse or a function to obtain it. The function is not evaluated once but each time you call parse() method. Data can be a plain JavaScript array, an iterable object (such as a typed array like Uint8Array) or a string (which is decoded as base64 to a byte array). Value stream is iterated then it does not need to be all available when parsing starts.

    • Optional info: LwM2MResourceInfo

      The object which describes atributes for resources.

    • Optional customValueFormatter: TlvCustomValueFormatter

      Optional formatter used to convert a TlvValue to its string representation.

    Returns string

    The string representation of the specified TLV packet.