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