• 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.android.messaging.mmslib.pdu;
19 
20 import com.android.messaging.mmslib.InvalidHeaderValueException;
21 
22 public class ReadRecInd extends GenericPdu {
23     /**
24      * Constructor, used when composing a M-ReadRec.ind pdu.
25      *
26      * @param from       the from value
27      * @param messageId  the message ID value
28      * @param mmsVersion current viersion of mms
29      * @param readStatus the read status value
30      * @param to         the to value
31      * @throws InvalidHeaderValueException if parameters are invalid.
32      * @throws NullPointerException if messageId or to is null.
33      */
ReadRecInd(EncodedStringValue from, byte[] messageId, int mmsVersion, int readStatus, EncodedStringValue[] to)34     public ReadRecInd(EncodedStringValue from,
35             byte[] messageId,
36             int mmsVersion,
37             int readStatus,
38             EncodedStringValue[] to) throws InvalidHeaderValueException {
39         super();
40         setMessageType(PduHeaders.MESSAGE_TYPE_READ_REC_IND);
41         setFrom(from);
42         setMessageId(messageId);
43         setMmsVersion(mmsVersion);
44         setTo(to);
45         setReadStatus(readStatus);
46     }
47 
48     /**
49      * Constructor with given headers.
50      *
51      * @param headers Headers for this PDU.
52      */
ReadRecInd(PduHeaders headers)53     ReadRecInd(PduHeaders headers) {
54         super(headers);
55     }
56 
57     /**
58      * Get Date value.
59      *
60      * @return the value
61      */
getDate()62     public long getDate() {
63         return mPduHeaders.getLongInteger(PduHeaders.DATE);
64     }
65 
66     /**
67      * Set Date value.
68      *
69      * @param value the value
70      */
setDate(long value)71     public void setDate(long value) {
72         mPduHeaders.setLongInteger(value, PduHeaders.DATE);
73     }
74 
75     /**
76      * Get Message-ID value.
77      *
78      * @return the value
79      */
getMessageId()80     public byte[] getMessageId() {
81         return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
82     }
83 
84     /**
85      * Set Message-ID value.
86      *
87      * @param value the value
88      * @throws NullPointerException if the value is null.
89      */
setMessageId(byte[] value)90     public void setMessageId(byte[] value) {
91         mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
92     }
93 
94     /**
95      * Get To value.
96      *
97      * @return the value
98      */
getTo()99     public EncodedStringValue[] getTo() {
100         return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
101     }
102 
103     /**
104      * Set To value.
105      *
106      * @param value the value
107      * @throws NullPointerException if the value is null.
108      */
setTo(EncodedStringValue[] value)109     public void setTo(EncodedStringValue[] value) {
110         mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
111     }
112 
113     /**
114      * Get X-MMS-Read-status value.
115      *
116      * @return the value
117      */
getReadStatus()118     public int getReadStatus() {
119         return mPduHeaders.getOctet(PduHeaders.READ_STATUS);
120     }
121 
122     /**
123      * Set X-MMS-Read-status value.
124      *
125      * @param value the value
126      * @throws InvalidHeaderValueException if the value is invalid.
127      */
setReadStatus(int value)128     public void setReadStatus(int value) throws InvalidHeaderValueException {
129         mPduHeaders.setOctet(value, PduHeaders.READ_STATUS);
130     }
131 
132     /*
133      * Optional, not supported header fields:
134      *
135      *     public byte[] getApplicId() {return null;}
136      *     public void setApplicId(byte[] value) {}
137      *
138      *     public byte[] getAuxApplicId() {return null;}
139      *     public void getAuxApplicId(byte[] value) {}
140      *
141      *     public byte[] getReplyApplicId() {return 0x00;}
142      *     public void setReplyApplicId(byte[] value) {}
143      */
144 }
145