The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Tom Taylor | 5e342fa | 2010-01-28 15:54:15 -0800 | [diff] [blame^] | 18 | package com.android.mmscommon.mms.pdu; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 19 | |
Tom Taylor | 5e342fa | 2010-01-28 15:54:15 -0800 | [diff] [blame^] | 20 | import com.android.mmscommon.EncodedStringValue; |
| 21 | import com.android.mmscommon.InvalidHeaderValueException; |
| 22 | import com.android.mmscommon.PduHeaders; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * M-Retrive.conf Pdu. |
| 26 | */ |
| 27 | public class RetrieveConf extends MultimediaMessagePdu { |
| 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 | */ |
| 36 | public RetrieveConf() throws InvalidHeaderValueException { |
| 37 | super(); |
| 38 | setMessageType(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Constructor with given headers. |
| 43 | * |
| 44 | * @param headers Headers for this PDU. |
| 45 | */ |
| 46 | RetrieveConf(PduHeaders headers) { |
| 47 | super(headers); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Constructor with given headers and body |
| 52 | * |
| 53 | * @param headers Headers for this PDU. |
| 54 | * @param body Body of this PDu. |
| 55 | */ |
| 56 | RetrieveConf(PduHeaders headers, PduBody body) { |
| 57 | super(headers, body); |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Get CC value. |
| 62 | * |
| 63 | * @return the value |
| 64 | */ |
| 65 | public EncodedStringValue[] getCc() { |
| 66 | return mPduHeaders.getEncodedStringValues(PduHeaders.CC); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Add a "CC" value. |
| 71 | * |
| 72 | * @param value the value |
| 73 | * @throws NullPointerException if the value is null. |
| 74 | */ |
| 75 | public void addCc(EncodedStringValue value) { |
| 76 | mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Get Content-type value. |
| 81 | * |
| 82 | * @return the value |
| 83 | */ |
| 84 | public byte[] getContentType() { |
| 85 | return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Set Content-type value. |
| 90 | * |
| 91 | * @param value the value |
| 92 | * @throws NullPointerException if the value is null. |
| 93 | */ |
| 94 | public void setContentType(byte[] value) { |
| 95 | mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Get X-Mms-Delivery-Report value. |
| 100 | * |
| 101 | * @return the value |
| 102 | */ |
| 103 | public int getDeliveryReport() { |
| 104 | return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Set X-Mms-Delivery-Report value. |
| 109 | * |
| 110 | * @param value the value |
| 111 | * @throws InvalidHeaderValueException if the value is invalid. |
| 112 | */ |
| 113 | public void setDeliveryReport(int value) throws InvalidHeaderValueException { |
| 114 | mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Get From value. |
| 119 | * From-value = Value-length |
| 120 | * (Address-present-token Encoded-string-value | Insert-address-token) |
| 121 | * |
| 122 | * @return the value |
| 123 | */ |
| 124 | public EncodedStringValue getFrom() { |
| 125 | return mPduHeaders.getEncodedStringValue(PduHeaders.FROM); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Set From value. |
| 130 | * |
| 131 | * @param value the value |
| 132 | * @throws NullPointerException if the value is null. |
| 133 | */ |
| 134 | public void setFrom(EncodedStringValue value) { |
| 135 | mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Get X-Mms-Message-Class value. |
| 140 | * Message-class-value = Class-identifier | Token-text |
| 141 | * Class-identifier = Personal | Advertisement | Informational | Auto |
| 142 | * |
| 143 | * @return the value |
| 144 | */ |
| 145 | public byte[] getMessageClass() { |
| 146 | return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Set X-Mms-Message-Class value. |
| 151 | * |
| 152 | * @param value the value |
| 153 | * @throws NullPointerException if the value is null. |
| 154 | */ |
| 155 | public void setMessageClass(byte[] value) { |
| 156 | mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS); |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Get Message-ID value. |
| 161 | * |
| 162 | * @return the value |
| 163 | */ |
| 164 | public byte[] getMessageId() { |
| 165 | return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Set Message-ID value. |
| 170 | * |
| 171 | * @param value the value |
| 172 | * @throws NullPointerException if the value is null. |
| 173 | */ |
| 174 | public void setMessageId(byte[] value) { |
| 175 | mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Get X-Mms-Read-Report value. |
| 180 | * |
| 181 | * @return the value |
| 182 | */ |
| 183 | public int getReadReport() { |
| 184 | return mPduHeaders.getOctet(PduHeaders.READ_REPORT); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Set X-Mms-Read-Report value. |
| 189 | * |
| 190 | * @param value the value |
| 191 | * @throws InvalidHeaderValueException if the value is invalid. |
| 192 | */ |
| 193 | public void setReadReport(int value) throws InvalidHeaderValueException { |
| 194 | mPduHeaders.setOctet(value, PduHeaders.READ_REPORT); |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Get X-Mms-Retrieve-Status value. |
| 199 | * |
| 200 | * @return the value |
| 201 | */ |
| 202 | public int getRetrieveStatus() { |
| 203 | return mPduHeaders.getOctet(PduHeaders.RETRIEVE_STATUS); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Set X-Mms-Retrieve-Status value. |
| 208 | * |
| 209 | * @param value the value |
| 210 | * @throws InvalidHeaderValueException if the value is invalid. |
| 211 | */ |
| 212 | public void setRetrieveStatus(int value) throws InvalidHeaderValueException { |
| 213 | mPduHeaders.setOctet(value, PduHeaders.RETRIEVE_STATUS); |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Get X-Mms-Retrieve-Text value. |
| 218 | * |
| 219 | * @return the value |
| 220 | */ |
| 221 | public EncodedStringValue getRetrieveText() { |
| 222 | return mPduHeaders.getEncodedStringValue(PduHeaders.RETRIEVE_TEXT); |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Set X-Mms-Retrieve-Text value. |
| 227 | * |
| 228 | * @param value the value |
| 229 | * @throws NullPointerException if the value is null. |
| 230 | */ |
| 231 | public void setRetrieveText(EncodedStringValue value) { |
| 232 | mPduHeaders.setEncodedStringValue(value, PduHeaders.RETRIEVE_TEXT); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Get X-Mms-Transaction-Id. |
| 237 | * |
| 238 | * @return the value |
| 239 | */ |
| 240 | public byte[] getTransactionId() { |
| 241 | return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID); |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Set X-Mms-Transaction-Id. |
| 246 | * |
| 247 | * @param value the value |
| 248 | * @throws NullPointerException if the value is null. |
| 249 | */ |
| 250 | public void setTransactionId(byte[] value) { |
| 251 | mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID); |
| 252 | } |
| 253 | |
| 254 | /* |
| 255 | * Optional, not supported header fields: |
| 256 | * |
| 257 | * public byte[] getApplicId() {return null;} |
| 258 | * public void setApplicId(byte[] value) {} |
| 259 | * |
| 260 | * public byte[] getAuxApplicId() {return null;} |
| 261 | * public void getAuxApplicId(byte[] value) {} |
| 262 | * |
| 263 | * public byte getContentClass() {return 0x00;} |
| 264 | * public void setApplicId(byte value) {} |
| 265 | * |
| 266 | * public byte getDrmContent() {return 0x00;} |
| 267 | * public void setDrmContent(byte value) {} |
| 268 | * |
| 269 | * public byte getDistributionIndicator() {return 0x00;} |
| 270 | * public void setDistributionIndicator(byte value) {} |
| 271 | * |
| 272 | * public PreviouslySentByValue getPreviouslySentBy() {return null;} |
| 273 | * public void setPreviouslySentBy(PreviouslySentByValue value) {} |
| 274 | * |
| 275 | * public PreviouslySentDateValue getPreviouslySentDate() {} |
| 276 | * public void setPreviouslySentDate(PreviouslySentDateValue value) {} |
| 277 | * |
| 278 | * public MmFlagsValue getMmFlags() {return null;} |
| 279 | * public void setMmFlags(MmFlagsValue value) {} |
| 280 | * |
| 281 | * public MmStateValue getMmState() {return null;} |
| 282 | * public void getMmState(MmStateValue value) {} |
| 283 | * |
| 284 | * public byte[] getReplaceId() {return 0x00;} |
| 285 | * public void setReplaceId(byte[] value) {} |
| 286 | * |
| 287 | * public byte[] getReplyApplicId() {return 0x00;} |
| 288 | * public void setReplyApplicId(byte[] value) {} |
| 289 | * |
| 290 | * public byte getReplyCharging() {return 0x00;} |
| 291 | * public void setReplyCharging(byte value) {} |
| 292 | * |
| 293 | * public byte getReplyChargingDeadline() {return 0x00;} |
| 294 | * public void setReplyChargingDeadline(byte value) {} |
| 295 | * |
| 296 | * public byte[] getReplyChargingId() {return 0x00;} |
| 297 | * public void setReplyChargingId(byte[] value) {} |
| 298 | * |
| 299 | * public long getReplyChargingSize() {return 0;} |
| 300 | * public void setReplyChargingSize(long value) {} |
| 301 | */ |
| 302 | } |