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-Delivery.Ind Pdu. 26 */ 27 public class DeliveryInd extends GenericPdu { 28 /** 29 * Empty constructor. 30 * Since the Pdu corresponding to this class is constructed 31 * by the Proxy-Relay server, this class is only instantiated 32 * by the Pdu Parser. 33 * 34 * @throws InvalidHeaderValueException if error occurs. 35 */ DeliveryInd()36 public DeliveryInd() throws InvalidHeaderValueException { 37 super(); 38 setMessageType(PduHeaders.MESSAGE_TYPE_DELIVERY_IND); 39 } 40 41 /** 42 * Constructor with given headers. 43 * 44 * @param headers Headers for this PDU. 45 */ 46 @UnsupportedAppUsage DeliveryInd(PduHeaders headers)47 DeliveryInd(PduHeaders headers) { 48 super(headers); 49 } 50 51 /** 52 * Get Date value. 53 * 54 * @return the value 55 */ 56 @UnsupportedAppUsage getDate()57 public long getDate() { 58 return mPduHeaders.getLongInteger(PduHeaders.DATE); 59 } 60 61 /** 62 * Set Date value. 63 * 64 * @param value the value 65 */ setDate(long value)66 public void setDate(long value) { 67 mPduHeaders.setLongInteger(value, PduHeaders.DATE); 68 } 69 70 /** 71 * Get Message-ID value. 72 * 73 * @return the value 74 */ 75 @UnsupportedAppUsage getMessageId()76 public byte[] getMessageId() { 77 return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); 78 } 79 80 /** 81 * Set Message-ID value. 82 * 83 * @param value the value, should not be null 84 * @throws NullPointerException if the value is null. 85 */ setMessageId(byte[] value)86 public void setMessageId(byte[] value) { 87 mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); 88 } 89 90 /** 91 * Get Status value. 92 * 93 * @return the value 94 */ 95 @UnsupportedAppUsage getStatus()96 public int getStatus() { 97 return mPduHeaders.getOctet(PduHeaders.STATUS); 98 } 99 100 /** 101 * Set Status value. 102 * 103 * @param value the value 104 * @throws InvalidHeaderValueException if the value is invalid. 105 */ setStatus(int value)106 public void setStatus(int value) throws InvalidHeaderValueException { 107 mPduHeaders.setOctet(value, PduHeaders.STATUS); 108 } 109 110 /** 111 * Get To value. 112 * 113 * @return the value 114 */ 115 @UnsupportedAppUsage getTo()116 public EncodedStringValue[] getTo() { 117 return mPduHeaders.getEncodedStringValues(PduHeaders.TO); 118 } 119 120 /** 121 * set To value. 122 * 123 * @param value the value 124 * @throws NullPointerException if the value is null. 125 */ setTo(EncodedStringValue[] value)126 public void setTo(EncodedStringValue[] value) { 127 mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); 128 } 129 130 /* 131 * Optional, not supported header fields: 132 * 133 * public byte[] getApplicId() {return null;} 134 * public void setApplicId(byte[] value) {} 135 * 136 * public byte[] getAuxApplicId() {return null;} 137 * public void getAuxApplicId(byte[] value) {} 138 * 139 * public byte[] getReplyApplicId() {return 0x00;} 140 * public void setReplyApplicId(byte[] value) {} 141 * 142 * public EncodedStringValue getStatusText() {return null;} 143 * public void setStatusText(EncodedStringValue value) {} 144 */ 145 } 146