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