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