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