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