1526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen/*
2526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Copyright (C) 2007 Esmertec AG.
3526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Copyright (C) 2007 The Android Open Source Project
4526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
5526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Licensed under the Apache License, Version 2.0 (the "License");
6526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * you may not use this file except in compliance with the License.
7526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * You may obtain a copy of the License at
8526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
9526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *      http://www.apache.org/licenses/LICENSE-2.0
10526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen *
11526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * Unless required by applicable law or agreed to in writing, software
12526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * distributed under the License is distributed on an "AS IS" BASIS,
13526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * See the License for the specific language governing permissions and
15526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen * limitations under the License.
16526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen */
17526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
18526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenpackage com.google.android.mms.pdu;
19526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
20526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenimport com.google.android.mms.InvalidHeaderValueException;
21526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
22526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wenpublic class SendConf extends GenericPdu {
23526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
24526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Empty constructor.
25526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Since the Pdu corresponding to this class is constructed
26526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * by the Proxy-Relay server, this class is only instantiated
27526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * by the Pdu Parser.
28526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
29526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @throws InvalidHeaderValueException if error occurs.
30526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
31526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public SendConf() throws InvalidHeaderValueException {
32526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        super();
33526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF);
34526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
35526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
36526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
37526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Constructor with given headers.
38526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
39526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @param headers Headers for this PDU.
40526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
41526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    SendConf(PduHeaders headers) {
42526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        super(headers);
43526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
44526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
45526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
46526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Get Message-ID value.
47526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
48526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @return the value
49526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
50526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public byte[] getMessageId() {
51526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
52526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
53526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
54526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
55526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Set Message-ID value.
56526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
57526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @param value the value
58526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @throws NullPointerException if the value is null.
59526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
60526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public void setMessageId(byte[] value) {
61526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
62526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
63526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
64526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
65526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Get X-Mms-Response-Status.
66526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
67526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @return the value
68526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
69526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public int getResponseStatus() {
70526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS);
71526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
72526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
73526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
74526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Set X-Mms-Response-Status.
75526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
76526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @param value the values
77526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @throws InvalidHeaderValueException if the value is invalid.
78526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
79526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public void setResponseStatus(int value) throws InvalidHeaderValueException {
80526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS);
81526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
82526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
83526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
84526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Get X-Mms-Transaction-Id field value.
85526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
86526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @return the X-Mms-Report-Allowed value
87526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
88526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public byte[] getTransactionId() {
89526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen        return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
90526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
91526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
92526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /**
93526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Set X-Mms-Transaction-Id field value.
94526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
95526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @param value the value
96526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * @throws NullPointerException if the value is null.
97526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
98526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    public void setTransactionId(byte[] value) {
99526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen            mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
100526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    }
101526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen
102526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen    /*
103526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     * Optional, not supported header fields:
104526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
105526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public byte[] getContentLocation() {return null;}
106526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public void setContentLocation(byte[] value) {}
107526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
108526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public EncodedStringValue getResponseText() {return null;}
109526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public void setResponseText(EncodedStringValue value) {}
110526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
111526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public byte getStoreStatus() {return 0x00;}
112526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public void setStoreStatus(byte value) {}
113526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *
114526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public byte[] getStoreStatusText() {return null;}
115526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     *    public void setStoreStatusText(byte[] value) {}
116526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen     */
117526ecd1799a2fc467cfce114eae3578b42ccb786Ye Wen}
118