hp.opencall.media.sms.tl1
Class PDU

java.lang.Object
  extended byhp.opencall.media.sms.tl.PDU
      extended byhp.opencall.media.sms.tl1.PDU
Direct Known Subclasses:
SMSCommandPDU, SMSDeliverPDU, SMSDeliverReportRPAckPDU, SMSDeliverReportRPErrorPDU, SMSStatusReportPDU, SMSSubmitPDU, SMSSubmitReportRPAckPDU, SMSSubmitReportRPErrorPDU

public class PDU
extends PDU

A protocol 1 PDU is a SMS TL (Short Message Service Transport Layer) byte array message sent or received thanks to a play or record operation on a relevant SMS Resource.

Each PDU is composed of one or severals Parameter

Encoding of an SMS TL PDU requires to :

1. Create the relevant PDU
2. Set all the Parameters value
3. Encode the PDU in order to get the encoded byte array
The resulting byte array can be sent thanks to a play operation

Decoding of a received SMS TL byte array from a record operation requires to :

1. Create the relevant PDU
2. Decode the PDU in order to assign all the parameters value from the byte array
The resulting PDU object can be acceded in order to get all the Parameters value
Code snippet about how using the PDU encoding&decoding
    try{

        SMSDeliverPDU pdu = new SMSDeliverPDU();

        pdu.setTpMtiValue(TpMtiByteValue);
        pdu.setTpMmsValue(TpMmsByteValue);
        pdu.setTpRpValue(TpRpByteValue);
        pdu.setTpUdhiValue(TpUdhiByteValue);
        pdu.setTpSriValue(TpSriByteValue);
        pdu.setTpOaValue(TpOaAssignedByteArray);
        pdu.setTpPidValue(TpPidByteValue);
        pdu.setTpDcsValue(TpDcsByteValue);
        pdu.setTpSctsValue(TpSctsAssignedByteArray);
        pdu.setTpUdlValue(TpUdlByteValue);
        pdu.setTpUdValue(TpUdAssignedByteArray);
        SMSDeliveryPDU pdu = new SMSDeliveryPDU();
         
        // Encoding 
        encodedPdu = pdu.encodedPDU();

        // dump (only during debug in order to avoid to alter performance)
        System.out.println("sentPdu "+pdu);

        SMSDeliverPDU receivedPdu = new SMSDeliverPDU(); 
        receivedPdu.decodePDU(encodedPdu);

        // dump (only during debug in order to avoid to alter performance)
        System.out.println("receivedPdu "+receivedPdu);

        byte _TpRpValue = receivedPdu.getTpRpValue();
        byte[] _TpOaValue = receivedPdu.getTpOaValue();
        ...
         
     } catch(Exception e){
        // exception processing etc.
        e.printStackTrace();
    }    

 


Constructor Summary
PDU(String aName, int aParameterNumber)
           
 
Method Summary
 void decodePDU(byte[] encodedPDU)
          Decode a PDU and assigns all the involving Parameters This method should be used when receiving a SMS TL PDU and the Oclet need to get the Parameters values.
 byte[] encodedPDU()
          Encode a PDU thanks to the previous Parameters assignment.
 
Methods inherited from class hp.opencall.media.sms.tl.PDU
getSizeInByte, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDU

public PDU(String aName,
           int aParameterNumber)
Method Detail

encodedPDU

public byte[] encodedPDU()
                  throws PDUException
Encode a PDU thanks to the previous Parameters assignment.

This method should be used to build a SMS TL PDU to be sent thanks to a play operation.

This method throws a PDUException if the encoding can be proceded completly.

Overrides:
encodedPDU in class PDU
Returns:
the encoded byte array PDU.
Throws:
PDUException - if requested operation fails
See Also:
Player.play(java.lang.String[], int, hp.telephony.media.RTC[], java.util.Dictionary)

decodePDU

public void decodePDU(byte[] encodedPDU)
               throws PDUException
Decode a PDU and assigns all the involving Parameters

This method should be used when receiving a SMS TL PDU and the Oclet need to get the Parameters values.

This method throws an DecodingException if the decoding can be proceded completly.

Overrides:
decodePDU in class PDU
Parameters:
encodedPDU - is the encoded byte array PDU to decode.
Throws:
PDUException - if requested operation fails
See Also:
Recorder.record(java.lang.String, hp.telephony.media.RTC[], java.util.Dictionary)