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-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 | */ |
| 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 | DeliveryInd(PduHeaders headers) { |
| 47 | super(headers); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Get Date value. |
| 52 | * |
| 53 | * @return the value |
| 54 | */ |
| 55 | public long getDate() { |
| 56 | return mPduHeaders.getLongInteger(PduHeaders.DATE); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Set Date value. |
| 61 | * |
| 62 | * @param value the value |
| 63 | */ |
| 64 | public void setDate(long value) { |
| 65 | mPduHeaders.setLongInteger(value, PduHeaders.DATE); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Get Message-ID value. |
| 70 | * |
| 71 | * @return the value |
| 72 | */ |
| 73 | public byte[] getMessageId() { |
| 74 | return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Set Message-ID value. |
| 79 | * |
| 80 | * @param value the value, should not be null |
| 81 | * @throws NullPointerException if the value is null. |
| 82 | */ |
| 83 | public void setMessageId(byte[] value) { |
| 84 | mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Get Status value. |
| 89 | * |
| 90 | * @return the value |
| 91 | */ |
| 92 | public int getStatus() { |
| 93 | return mPduHeaders.getOctet(PduHeaders.STATUS); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Set Status value. |
| 98 | * |
| 99 | * @param value the value |
| 100 | * @throws InvalidHeaderValueException if the value is invalid. |
| 101 | */ |
| 102 | public void setStatus(int value) throws InvalidHeaderValueException { |
| 103 | mPduHeaders.setOctet(value, PduHeaders.STATUS); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Get To value. |
| 108 | * |
| 109 | * @return the value |
| 110 | */ |
| 111 | public EncodedStringValue[] getTo() { |
| 112 | return mPduHeaders.getEncodedStringValues(PduHeaders.TO); |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * set To value. |
| 117 | * |
| 118 | * @param value the value |
| 119 | * @throws NullPointerException if the value is null. |
| 120 | */ |
| 121 | public void setTo(EncodedStringValue[] value) { |
| 122 | mPduHeaders.setEncodedStringValues(value, PduHeaders.TO); |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | * Optional, not supported header fields: |
| 127 | * |
| 128 | * public byte[] getApplicId() {return null;} |
| 129 | * public void setApplicId(byte[] value) {} |
| 130 | * |
| 131 | * public byte[] getAuxApplicId() {return null;} |
| 132 | * public void getAuxApplicId(byte[] value) {} |
| 133 | * |
| 134 | * public byte[] getReplyApplicId() {return 0x00;} |
| 135 | * public void setReplyApplicId(byte[] value) {} |
| 136 | * |
| 137 | * public EncodedStringValue getStatusText() {return null;} |
| 138 | * public void setStatusText(EncodedStringValue value) {} |
| 139 | */ |
| 140 | } |