blob: ca4615c2e9fe0251aee8ac9ed1228d719690b5d7 [file] [log] [blame]
Amit Mahajan82f245f2019-09-10 13:19:05 -07001/*
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
18package com.google.android.mms.pdu;
19
Artur Satayev53ada2a2019-12-10 17:47:56 +000020import android.compat.annotation.UnsupportedAppUsage;
Amit Mahajan82f245f2019-09-10 13:19:05 -070021
22import com.google.android.mms.InvalidHeaderValueException;
23
24/**
25 * M-Notification.ind PDU.
26 */
27public class NotificationInd 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 * RuntimeException if an undeclared error occurs.
36 */
37 @UnsupportedAppUsage
38 public NotificationInd() throws InvalidHeaderValueException {
39 super();
40 setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND);
41 }
42
43 /**
44 * Constructor with given headers.
45 *
46 * @param headers Headers for this PDU.
47 */
48 @UnsupportedAppUsage
49 NotificationInd(PduHeaders headers) {
50 super(headers);
51 }
52
53 /**
54 * Get X-Mms-Content-Class Value.
55 *
56 * @return the value
57 */
58 @UnsupportedAppUsage
59 public int getContentClass() {
60 return mPduHeaders.getOctet(PduHeaders.CONTENT_CLASS);
61 }
62
63 /**
64 * Set X-Mms-Content-Class Value.
65 *
66 * @param value the value
67 * @throws InvalidHeaderValueException if the value is invalid.
68 * RuntimeException if an undeclared error occurs.
69 */
70 @UnsupportedAppUsage
71 public void setContentClass(int value) throws InvalidHeaderValueException {
72 mPduHeaders.setOctet(value, PduHeaders.CONTENT_CLASS);
73 }
74
75 /**
76 * Get X-Mms-Content-Location value.
77 * When used in a PDU other than M-Mbox-Delete.conf and M-Delete.conf:
78 * Content-location-value = Uri-value
79 *
80 * @return the value
81 */
82 @UnsupportedAppUsage
83 public byte[] getContentLocation() {
84 return mPduHeaders.getTextString(PduHeaders.CONTENT_LOCATION);
85 }
86
87 /**
88 * Set X-Mms-Content-Location value.
89 *
90 * @param value the value
91 * @throws NullPointerException if the value is null.
92 * RuntimeException if an undeclared error occurs.
93 */
94 @UnsupportedAppUsage
95 public void setContentLocation(byte[] value) {
96 mPduHeaders.setTextString(value, PduHeaders.CONTENT_LOCATION);
97 }
98
99 /**
100 * Get X-Mms-Expiry value.
101 *
102 * Expiry-value = Value-length
103 * (Absolute-token Date-value | Relative-token Delta-seconds-value)
104 *
105 * @return the value
106 */
107 @UnsupportedAppUsage
108 public long getExpiry() {
109 return mPduHeaders.getLongInteger(PduHeaders.EXPIRY);
110 }
111
112 /**
113 * Set X-Mms-Expiry value.
114 *
115 * @param value the value
116 * @throws RuntimeException if an undeclared error occurs.
117 */
118 @UnsupportedAppUsage
119 public void setExpiry(long value) {
120 mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY);
121 }
122
123 /**
124 * Get From value.
125 * From-value = Value-length
126 * (Address-present-token Encoded-string-value | Insert-address-token)
127 *
128 * @return the value
129 */
130 @UnsupportedAppUsage
131 public EncodedStringValue getFrom() {
132 return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
133 }
134
135 /**
136 * Set From value.
137 *
138 * @param value the value
139 * @throws NullPointerException if the value is null.
140 * RuntimeException if an undeclared error occurs.
141 */
142 @UnsupportedAppUsage
143 public void setFrom(EncodedStringValue value) {
144 mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
145 }
146
147 /**
148 * Get X-Mms-Message-Class value.
149 * Message-class-value = Class-identifier | Token-text
150 * Class-identifier = Personal | Advertisement | Informational | Auto
151 *
152 * @return the value
153 */
154 @UnsupportedAppUsage
155 public byte[] getMessageClass() {
156 return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
157 }
158
159 /**
160 * Set X-Mms-Message-Class value.
161 *
162 * @param value the value
163 * @throws NullPointerException if the value is null.
164 * RuntimeException if an undeclared error occurs.
165 */
166 @UnsupportedAppUsage
167 public void setMessageClass(byte[] value) {
168 mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
169 }
170
171 /**
172 * Get X-Mms-Message-Size value.
173 * Message-size-value = Long-integer
174 *
175 * @return the value
176 */
177 @UnsupportedAppUsage
178 public long getMessageSize() {
179 return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE);
180 }
181
182 /**
183 * Set X-Mms-Message-Size value.
184 *
185 * @param value the value
186 * @throws RuntimeException if an undeclared error occurs.
187 */
188 @UnsupportedAppUsage
189 public void setMessageSize(long value) {
190 mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE);
191 }
192
193 /**
194 * Get subject.
195 *
196 * @return the value
197 */
198 @UnsupportedAppUsage
199 public EncodedStringValue getSubject() {
200 return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT);
201 }
202
203 /**
204 * Set subject.
205 *
206 * @param value the value
207 * @throws NullPointerException if the value is null.
208 * RuntimeException if an undeclared error occurs.
209 */
210 @UnsupportedAppUsage
211 public void setSubject(EncodedStringValue value) {
212 mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT);
213 }
214
215 /**
216 * Get X-Mms-Transaction-Id.
217 *
218 * @return the value
219 */
220 @UnsupportedAppUsage
221 public byte[] getTransactionId() {
222 return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
223 }
224
225 /**
226 * Set X-Mms-Transaction-Id.
227 *
228 * @param value the value
229 * @throws NullPointerException if the value is null.
230 * RuntimeException if an undeclared error occurs.
231 */
232 @UnsupportedAppUsage
233 public void setTransactionId(byte[] value) {
234 mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
235 }
236
237 /**
238 * Get X-Mms-Delivery-Report Value.
239 *
240 * @return the value
241 */
242 @UnsupportedAppUsage
243 public int getDeliveryReport() {
244 return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
245 }
246
247 /**
248 * Set X-Mms-Delivery-Report Value.
249 *
250 * @param value the value
251 * @throws InvalidHeaderValueException if the value is invalid.
252 * RuntimeException if an undeclared error occurs.
253 */
254 @UnsupportedAppUsage
255 public void setDeliveryReport(int value) throws InvalidHeaderValueException {
256 mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
257 }
258
259 /*
260 * Optional, not supported header fields:
261 *
262 * public byte[] getApplicId() {return null;}
263 * public void setApplicId(byte[] value) {}
264 *
265 * public byte[] getAuxApplicId() {return null;}
266 * public void getAuxApplicId(byte[] value) {}
267 *
268 * public byte getDrmContent() {return 0x00;}
269 * public void setDrmContent(byte value) {}
270 *
271 * public byte getDistributionIndicator() {return 0x00;}
272 * public void setDistributionIndicator(byte value) {}
273 *
274 * public ElementDescriptorValue getElementDescriptor() {return null;}
275 * public void getElementDescriptor(ElementDescriptorValue value) {}
276 *
277 * public byte getPriority() {return 0x00;}
278 * public void setPriority(byte value) {}
279 *
280 * public byte getRecommendedRetrievalMode() {return 0x00;}
281 * public void setRecommendedRetrievalMode(byte value) {}
282 *
283 * public byte getRecommendedRetrievalModeText() {return 0x00;}
284 * public void setRecommendedRetrievalModeText(byte value) {}
285 *
286 * public byte[] getReplaceId() {return 0x00;}
287 * public void setReplaceId(byte[] value) {}
288 *
289 * public byte[] getReplyApplicId() {return 0x00;}
290 * public void setReplyApplicId(byte[] value) {}
291 *
292 * public byte getReplyCharging() {return 0x00;}
293 * public void setReplyCharging(byte value) {}
294 *
295 * public byte getReplyChargingDeadline() {return 0x00;}
296 * public void setReplyChargingDeadline(byte value) {}
297 *
298 * public byte[] getReplyChargingId() {return 0x00;}
299 * public void setReplyChargingId(byte[] value) {}
300 *
301 * public long getReplyChargingSize() {return 0;}
302 * public void setReplyChargingSize(long value) {}
303 *
304 * public byte getStored() {return 0x00;}
305 * public void setStored(byte value) {}
306 */
307}