Home | History | Annotate | Download | only in pdu
      1 /*
      2  * Copyright (C) 2007 Esmertec AG.
      3  * Copyright (C) 2007 The Android Open Source Project
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package com.android.messaging.mmslib.pdu;
     19 
     20 import com.android.messaging.mmslib.InvalidHeaderValueException;
     21 
     22 public class SendConf extends GenericPdu {
     23     /**
     24      * Empty constructor.
     25      * Since the Pdu corresponding to this class is constructed
     26      * by the Proxy-Relay server, this class is only instantiated
     27      * by the Pdu Parser.
     28      *
     29      * @throws InvalidHeaderValueException if error occurs.
     30      */
     31     public SendConf() throws InvalidHeaderValueException {
     32         super();
     33         setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF);
     34     }
     35 
     36     /**
     37      * Constructor with given headers.
     38      *
     39      * @param headers Headers for this PDU.
     40      */
     41     SendConf(PduHeaders headers) {
     42         super(headers);
     43     }
     44 
     45     /**
     46      * Get Message-ID value.
     47      *
     48      * @return the value
     49      */
     50     public byte[] getMessageId() {
     51         return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
     52     }
     53 
     54     /**
     55      * Set Message-ID value.
     56      *
     57      * @param value the value
     58      * @throws NullPointerException if the value is null.
     59      */
     60     public void setMessageId(byte[] value) {
     61         mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
     62     }
     63 
     64     /**
     65      * Get X-Mms-Response-Status.
     66      *
     67      * @return the value
     68      */
     69     public int getResponseStatus() {
     70         return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS);
     71     }
     72 
     73     /**
     74      * Set X-Mms-Response-Status.
     75      *
     76      * @param value the values
     77      * @throws InvalidHeaderValueException if the value is invalid.
     78      */
     79     public void setResponseStatus(int value) throws InvalidHeaderValueException {
     80         mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS);
     81     }
     82 
     83     /**
     84      * Get X-Mms-Transaction-Id field value.
     85      *
     86      * @return the X-Mms-Report-Allowed value
     87      */
     88     public byte[] getTransactionId() {
     89         return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
     90     }
     91 
     92     /**
     93      * Set X-Mms-Transaction-Id field value.
     94      *
     95      * @param value the value
     96      * @throws NullPointerException if the value is null.
     97      */
     98     public void setTransactionId(byte[] value) {
     99         mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
    100     }
    101 
    102     /*
    103      * Optional, not supported header fields:
    104      *
    105      *    public byte[] getContentLocation() {return null;}
    106      *    public void setContentLocation(byte[] value) {}
    107      *
    108      *    public EncodedStringValue getResponseText() {return null;}
    109      *    public void setResponseText(EncodedStringValue value) {}
    110      *
    111      *    public byte getStoreStatus() {return 0x00;}
    112      *    public void setStoreStatus(byte value) {}
    113      *
    114      *    public byte[] getStoreStatusText() {return null;}
    115      *    public void setStoreStatusText(byte[] value) {}
    116      */
    117 }
    118