Version

Pdu Class

public abstract class Pdu
extends java.lang.Object
Pdu is the root abstract class for all SMPP messages in the Mobius SMPP API. It encapsulates the structure and behavior common to both request and response PDUs, including the PDU header, command identification, sequence tracking, and support for optional parameters (TLVs). All concrete SMPP commands ultimately inherit from this class, either directly or via PduRequest and PduResponse.

Constructor:

public Pdu(CommandType commandId,
           String name,
           boolean isRequest)

    commandId: Identifies the type of SMPP command.
    name: Human-readable name of the PDU (e.g., "submit_sm").
    isRequest: Flag indicating whether this PDU is a request (true) or a response (false).
Initializes a new PDU with a specific command ID, name, and request type.

Methods:

Metadata and Identity

string getName() Returns the command name.
boolean isRequest() Indicates if the PDU is a request.
boolean isResponse() Indicates if the PDU is a response.

Command Header Handling

boolean hasCommandLengthCalculated() Checks if the PDU length has already been calculated.
void removeCommandLength() Clears the stored command length.
void setCommandLength(int value) Sets the command length explicitly.
int getCommandLength() Returns the current command length.
int calculateAndSetCommandLength() Calculates and assigns the correct command length.
public CommandType getCommandId() Returns the command identifier.
void setCommandStatus(MessageStatus value) Sets the status for a response PDU.
public MessageStatus getCommandStatus() Retrieves the current command status.

Sequence Number Management

boolean hasSequenceNumberAssigned() Checks if a sequence number has been assigned.
void removeSequenceNumber() Clears the sequence number.
void setSequenceNumber(int value) Sets a specific sequence number.
int getSequenceNumber() Gets the current sequence number.

Optional Parameters (TLVs)

int getOptionalParameterCount() Returns the count of attached TLVs.
ArrayList<Tlv> getOptionalParameters() Retrieves the list of optional parameters.
void addOptionalParameter(Tlv tlv) Appends a TLV to the PDU.
Tlv removeOptionalParameter(short tag) Removes a TLV by tag.
Tlv setOptionalParameter(Tlv tlv) Adds or replaces a TLV by tag.
boolean hasOptionalParameter(short tag) Checks for the presence of a tag.
Tlv getOptionalParameter(short tag) Fetches a TLV by tag.

Reference Object

void setReferenceObject(Object value) Attaches an arbitrary reference object.
public Object getReferenceObject() Retrieves the reference object.

Body Processing (Abstract). These must be implemented by subclasses:

void readBody(ByteBuf buffer) Reads the PDU body from the buffer.
void writeBody(ByteBuf buffer) Writes the PDU body to the buffer.

Optional Parameter Encoding

void readOptionalParameters(ByteBuf buffer) Reads TLVs from the buffer.
void writeOptionalParameters(ByteBuf buffer) Writes TLVs into the buffer.

Utility

public String toString() Returns a string representation of the PDU, including key state and values.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait.

Start innovating with Mobius

What's next? Let's talk!

Mobius Software

As a company you'll get:

  • Get started quickly

  • Support any business model

  • Join millions of businesses

Questions? websupport@mobius.com