node-pdu
    Preparing search index...

    Class Data

    Represents the data content of an SMS message.

    Holds the actual message content, whether text or binary data. It is central to the purpose of SMS, conveying the intended information from sender to recipient.

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    HEADER_SIZE: 7

    Accessors

    • get data(): string

      Gets the raw data of the SMS message.

      This property holds the actual content of the message, which could be text or binary data, depending on how the message was encoded.

      Returns string

      The raw data as a string

    • get isUnicode(): boolean

      Indicates whether the message data is encoded using Unicode.

      This property is true if the message content includes characters that require Unicode encoding (e.g., non-Latin characters). Otherwise, it's false.

      Returns boolean

      A boolean indicating if the message data is Unicode.

    • get parts(): Part[]

      Provides access to the individual parts of the message.

      For longer messages that are split into multiple parts (segments), this getter allows access to each part. Each part contains a portion of the message data along with metadata.

      Returns Part[]

      An array of Part instances, each representing a segment of the message

    • get size(): number

      Retrieves the size of the message data.

      The size is determined based on the encoding and content of the message. It reflects the number of characters or bytes.

      Returns number

      The size of the data

    Methods

    • Appends the parts from another PDU to this data instance.

      This method is used to combine the parts of another message (Deliver or Submit) into this one, effectively concatenating the messages. It ensures parts are added only once and sorts them.

      Parameters

      • pdu: Submit | Deliver

        The PDU instance (Deliver or Submit) whose parts are to be appended

      Returns void

    • Retrieves the textual content of the SMS message.

      This method decodes the raw data into a readable text format, considering the encoding scheme (e.g., GSM 7-bit, UCS-2) used for the message.

      Returns string

      The decoded text of the message

    • Sets the data for the SMS message.

      This method encodes the provided data string according to the specified PDU type (Deliver or Submit) and updates the message parts accordingly. It handles encoding, part splitting, and header preparation.

      Parameters

      • data: string

        The new message data as a string

      • pdu: Submit | Deliver

        The PDU instance (Deliver or Submit) associated with this data

      Returns Data

      The instance of this Data, allowing for method chaining