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 public class SendConf extends GenericPdu {
25     /**
26      * Empty constructor.
27      * Since the Pdu corresponding to this class is constructed
28      * by the Proxy-Relay server, this class is only instantiated
29      * by the Pdu Parser.
30      *
31      * @throws InvalidHeaderValueException if error occurs.
32      */
33     @UnsupportedAppUsage
SendConf()34     public SendConf() throws InvalidHeaderValueException {
35         super();
36         setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF);
37     }
38 
39     /**
40      * Constructor with given headers.
41      *
42      * @param headers Headers for this PDU.
43      */
44     @UnsupportedAppUsage
SendConf(PduHeaders headers)45     SendConf(PduHeaders headers) {
46         super(headers);
47     }
48 
49     /**
50      * Get Message-ID value.
51      *
52      * @return the value
53      */
54     @UnsupportedAppUsage
getMessageId()55     public byte[] getMessageId() {
56         return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
57     }
58 
59     /**
60      * Set Message-ID value.
61      *
62      * @param value the value
63      * @throws NullPointerException if the value is null.
64      */
setMessageId(byte[] value)65     public void setMessageId(byte[] value) {
66         mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
67     }
68 
69     /**
70      * Get X-Mms-Response-Status.
71      *
72      * @return the value
73      */
74     @UnsupportedAppUsage
getResponseStatus()75     public int getResponseStatus() {
76         return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS);
77     }
78 
79     /**
80      * Set X-Mms-Response-Status.
81      *
82      * @param value the values
83      * @throws InvalidHeaderValueException if the value is invalid.
84      */
setResponseStatus(int value)85     public void setResponseStatus(int value) throws InvalidHeaderValueException {
86         mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS);
87     }
88 
89     /**
90      * Get X-Mms-Transaction-Id field value.
91      *
92      * @return the X-Mms-Report-Allowed value
93      */
94     @UnsupportedAppUsage
getTransactionId()95     public byte[] getTransactionId() {
96         return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
97     }
98 
99     /**
100      * Set X-Mms-Transaction-Id field value.
101      *
102      * @param value the value
103      * @throws NullPointerException if the value is null.
104      */
setTransactionId(byte[] value)105     public void setTransactionId(byte[] value) {
106             mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
107     }
108 
109     /*
110      * Optional, not supported header fields:
111      *
112      *    public byte[] getContentLocation() {return null;}
113      *    public void setContentLocation(byte[] value) {}
114      *
115      *    public EncodedStringValue getResponseText() {return null;}
116      *    public void setResponseText(EncodedStringValue value) {}
117      *
118      *    public byte getStoreStatus() {return 0x00;}
119      *    public void setStoreStatus(byte value) {}
120      *
121      *    public byte[] getStoreStatusText() {return null;}
122      *    public void setStoreStatusText(byte[] value) {}
123      */
124 }
125