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 android.support.v7.mms.pdu;
     19 
     20 /**
     21  * M-Acknowledge.ind PDU.
     22  */
     23 public class AcknowledgeInd extends GenericPdu {
     24     /**
     25      * Constructor, used when composing a M-Acknowledge.ind pdu.
     26      *
     27      * @param mmsVersion current viersion of mms
     28      * @param transactionId the transaction-id value
     29      * @throws InvalidHeaderValueException if parameters are invalid.
     30      *         NullPointerException if transactionId is null.
     31      */
     32     public AcknowledgeInd(int mmsVersion, byte[] transactionId)
     33             throws InvalidHeaderValueException {
     34         super();
     35 
     36         setMessageType(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND);
     37         setMmsVersion(mmsVersion);
     38         setTransactionId(transactionId);
     39     }
     40 
     41     /**
     42      * Constructor with given headers.
     43      *
     44      * @param headers Headers for this PDU.
     45      */
     46     AcknowledgeInd(PduHeaders headers) {
     47         super(headers);
     48     }
     49 
     50     /**
     51      * Get X-Mms-Report-Allowed field value.
     52      *
     53      * @return the X-Mms-Report-Allowed value
     54      */
     55     public int getReportAllowed() {
     56         return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
     57     }
     58 
     59     /**
     60      * Set X-Mms-Report-Allowed field value.
     61      *
     62      * @param value the value
     63      * @throws InvalidHeaderValueException if the value is invalid.
     64      */
     65     public void setReportAllowed(int value) throws InvalidHeaderValueException {
     66         mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
     67     }
     68 
     69     /**
     70      * Get X-Mms-Transaction-Id field value.
     71      *
     72      * @return the X-Mms-Report-Allowed value
     73      */
     74     public byte[] getTransactionId() {
     75         return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
     76     }
     77 
     78     /**
     79      * Set X-Mms-Transaction-Id field value.
     80      *
     81      * @param value the value
     82      * @throws NullPointerException if the value is null.
     83      */
     84     public void setTransactionId(byte[] value) {
     85         mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
     86     }
     87 }
     88