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