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