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.example.android.mmslib.pdu; 19 20 import com.example.android.mmslib.InvalidHeaderValueException; 21 22 /** 23 * M-NofifyResp.ind PDU. 24 */ 25 public class NotifyRespInd extends GenericPdu { 26 /** 27 * Constructor, used when composing a M-NotifyResp.ind pdu. 28 * 29 * @param mmsVersion current version of mms 30 * @param transactionId the transaction-id value 31 * @param status the status value 32 * @throws InvalidHeaderValueException if parameters are invalid. 33 * NullPointerException if transactionId is null. 34 * RuntimeException if an undeclared error occurs. 35 */ NotifyRespInd(int mmsVersion, byte[] transactionId, int status)36 public NotifyRespInd(int mmsVersion, 37 byte[] transactionId, 38 int status) throws InvalidHeaderValueException { 39 super(); 40 setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND); 41 setMmsVersion(mmsVersion); 42 setTransactionId(transactionId); 43 setStatus(status); 44 } 45 46 /** 47 * Constructor with given headers. 48 * 49 * @param headers Headers for this PDU. 50 */ NotifyRespInd(PduHeaders headers)51 NotifyRespInd(PduHeaders headers) { 52 super(headers); 53 } 54 55 /** 56 * Get X-Mms-Report-Allowed field value. 57 * 58 * @return the X-Mms-Report-Allowed value 59 */ getReportAllowed()60 public int getReportAllowed() { 61 return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED); 62 } 63 64 /** 65 * Set X-Mms-Report-Allowed field value. 66 * 67 * @param value the value 68 * @throws InvalidHeaderValueException if the value is invalid. 69 * RuntimeException if an undeclared error occurs. 70 */ setReportAllowed(int value)71 public void setReportAllowed(int value) throws InvalidHeaderValueException { 72 mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED); 73 } 74 75 /** 76 * Set X-Mms-Status field value. 77 * 78 * @param value the value 79 * @throws InvalidHeaderValueException if the value is invalid. 80 * RuntimeException if an undeclared error occurs. 81 */ setStatus(int value)82 public void setStatus(int value) throws InvalidHeaderValueException { 83 mPduHeaders.setOctet(value, PduHeaders.STATUS); 84 } 85 86 /** 87 * GetX-Mms-Status field value. 88 * 89 * @return the X-Mms-Status value 90 */ getStatus()91 public int getStatus() { 92 return mPduHeaders.getOctet(PduHeaders.STATUS); 93 } 94 95 /** 96 * Get X-Mms-Transaction-Id field value. 97 * 98 * @return the X-Mms-Report-Allowed value 99 */ getTransactionId()100 public byte[] getTransactionId() { 101 return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); 102 } 103 104 /** 105 * Set X-Mms-Transaction-Id field value. 106 * 107 * @param value the value 108 * @throws NullPointerException if the value is null. 109 * RuntimeException if an undeclared error occurs. 110 */ setTransactionId(byte[] value)111 public void setTransactionId(byte[] value) { 112 mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); 113 } 114 } 115