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