blob: c2e2b26535e329887efa6cbe8d0e4ef41a9419f4 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
Tom Taylor5e342fa2010-01-28 15:54:15 -080018package com.android.mmscommon.mms.pdu;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019
Tom Taylor5e342fa2010-01-28 15:54:15 -080020import com.android.mmscommon.InvalidHeaderValueException;
21import com.android.mmscommon.PduHeaders;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
23/**
24 * M-NofifyResp.ind PDU.
25 */
26public class NotifyRespInd extends GenericPdu {
27 /**
28 * Constructor, used when composing a M-NotifyResp.ind pdu.
29 *
30 * @param mmsVersion current version of mms
31 * @param transactionId the transaction-id value
32 * @param status the status value
33 * @throws InvalidHeaderValueException if parameters are invalid.
34 * NullPointerException if transactionId is null.
35 * RuntimeException if an undeclared error occurs.
36 */
37 public NotifyRespInd(int mmsVersion,
38 byte[] transactionId,
39 int status) throws InvalidHeaderValueException {
40 super();
41 setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND);
42 setMmsVersion(mmsVersion);
43 setTransactionId(transactionId);
44 setStatus(status);
45 }
46
47 /**
48 * Constructor with given headers.
49 *
50 * @param headers Headers for this PDU.
51 */
52 NotifyRespInd(PduHeaders headers) {
53 super(headers);
54 }
55
56 /**
57 * Get X-Mms-Report-Allowed field value.
58 *
59 * @return the X-Mms-Report-Allowed value
60 */
61 public int getReportAllowed() {
62 return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
63 }
64
65 /**
66 * Set X-Mms-Report-Allowed field value.
67 *
68 * @param value the value
69 * @throws InvalidHeaderValueException if the value is invalid.
70 * RuntimeException if an undeclared error occurs.
71 */
72 public void setReportAllowed(int value) throws InvalidHeaderValueException {
73 mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
74 }
75
76 /**
77 * Set X-Mms-Status field value.
78 *
79 * @param value the value
80 * @throws InvalidHeaderValueException if the value is invalid.
81 * RuntimeException if an undeclared error occurs.
82 */
83 public void setStatus(int value) throws InvalidHeaderValueException {
84 mPduHeaders.setOctet(value, PduHeaders.STATUS);
85 }
86
87 /**
88 * GetX-Mms-Status field value.
89 *
90 * @return the X-Mms-Status value
91 */
92 public int getStatus() {
93 return mPduHeaders.getOctet(PduHeaders.STATUS);
94 }
95
96 /**
97 * Get X-Mms-Transaction-Id field value.
98 *
99 * @return the X-Mms-Report-Allowed value
100 */
101 public byte[] getTransactionId() {
102 return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
103 }
104
105 /**
106 * Set X-Mms-Transaction-Id field value.
107 *
108 * @param value the value
109 * @throws NullPointerException if the value is null.
110 * RuntimeException if an undeclared error occurs.
111 */
112 public void setTransactionId(byte[] value) {
113 mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
114 }
115}