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