Teltonika SDK Typescript
    Preparing search index...

    Class TeltonikaBaseParser<T>Abstract

    Base abstract parser class for Teltonika device packets. Provides utility methods to identify and parse IMEI data and device packets. Subclasses must implement parsePacket to handle specific codec formats.

    TeltonikaBaseParser

    class TeltonikaCodec8Parser extends TeltonikaBaseParser<TeltonikaCodec8AVLPacket> {
    static codec = TeltonikaDataCodec.Codec8;

    parsePacket(data: Buffer) {
    // implement parsing logic for Codec 8
    }
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Checks if the buffer contains a complete Teltonika packet. It compares the length specified in the packet header with the actual payload size.

      Parameters

      • data: Buffer

        The raw buffer from the device.

      Returns boolean

      True if the buffer contains a complete packet.

    • Checks if the buffer contains an IMEI message. IMEI packets are 17 bytes long and start with 0x00 0x0F.

      Parameters

      • data: Buffer

        The raw buffer from the device.

      Returns boolean

      True if the buffer contains an IMEI message.

    • Checks if the buffer contains the start of a Teltonika data packet. Standard packets begin with 4 bytes 0x00 0x00 0x00 0x00.

      Parameters

      • data: Buffer

        The raw buffer from the device.

      Returns boolean

      True if the buffer is a packet.

    • Parses the IMEI string from an IMEI buffer.

      Parameters

      • data: Buffer

        The buffer containing the IMEI.

      Returns string

      The IMEI extracted from the buffer.

    • Abstract method to parse a buffer into a typed Teltonika packet. Must be implemented by subclasses for specific codecs.

      Parameters

      • data: Buffer

        The raw packet buffer.

      Returns T

      Parsed packet of type T.

    Properties

    The Teltonika codec associated with this parser. Must be defined in subclasses.