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