1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.telephony.cdma.sms;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.telephony.cdma.CdmaSmsCbProgramData;
21 
22 public final class SmsEnvelope {
23     /**
24      * Message Types
25      * (See 3GPP2 C.S0015-B 3.4.1)
26      */
27     static public final int MESSAGE_TYPE_POINT_TO_POINT   = 0x00;
28     static public final int MESSAGE_TYPE_BROADCAST        = 0x01;
29     static public final int MESSAGE_TYPE_ACKNOWLEDGE      = 0x02;
30 
31     /**
32      * Supported Teleservices
33      * (See 3GPP2 N.S0005 and TIA-41)
34      */
35     static public final int TELESERVICE_NOT_SET           = 0x0000;
36     static public final int TELESERVICE_WMT               = 0x1002;
37     static public final int TELESERVICE_VMN               = 0x1003;
38     static public final int TELESERVICE_WAP               = 0x1004;
39     static public final int TELESERVICE_WEMT              = 0x1005;
40     static public final int TELESERVICE_SCPT              = 0x1006;
41 
42     /** Carriers specific Teleservice IDs. */
43     public static final int TELESERVICE_FDEA_WAP = 0xFDEA; // 65002
44 
45     /**
46      * The following are defined as extensions to the standard teleservices
47      */
48     // Voice mail notification through Message Waiting Indication in CDMA mode or Analog mode.
49     // Defined in 3GPP2 C.S-0005, 3.7.5.6, an Info Record containing an 8-bit number with the
50     // number of messages waiting, it's used by some CDMA carriers for a voice mail count.
51     static public final int TELESERVICE_MWI               = 0x40000;
52 
53     // Service Categories for Cell Broadcast, see 3GPP2 C.R1001 table 9.3.1-1
54     // static final int SERVICE_CATEGORY_EMERGENCY      = 0x0001;
55     //...
56 
57     // CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
58     public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT  =
59             CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT;  // = 4096
60     public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT            =
61             CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT;            // = 4097
62     public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT             =
63             CdmaSmsCbProgramData.CATEGORY_CMAS_SEVERE_THREAT;             // = 4098
64     public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY =
65             CdmaSmsCbProgramData.CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY; // = 4099
66     public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE              =
67             CdmaSmsCbProgramData.CATEGORY_CMAS_TEST_MESSAGE;              // = 4100
68     public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE       =
69             CdmaSmsCbProgramData.CATEGORY_CMAS_LAST_RESERVED_VALUE;       // = 4351
70 
71     /**
72      * Provides the type of a SMS message like point to point, broadcast or acknowledge
73      */
74     public int messageType;
75 
76     /**
77      * The 16-bit Teleservice parameter identifies which upper layer service access point is sending
78      * or receiving the message.
79      * (See 3GPP2 C.S0015-B, v2, 3.4.3.1)
80      */
81     @UnsupportedAppUsage
82     public int teleService = TELESERVICE_NOT_SET;
83 
84     /**
85      * The 16-bit service category parameter identifies the type of service provided
86      * by the SMS message.
87      * (See 3GPP2 C.S0015-B, v2, 3.4.3.2)
88      */
89     @UnsupportedAppUsage
90     public int serviceCategory;
91 
92     /**
93      * The origination address identifies the originator of the SMS message.
94      * (See 3GPP2 C.S0015-B, v2, 3.4.3.3)
95      */
96     public CdmaSmsAddress origAddress;
97 
98     /**
99      * The destination address identifies the target of the SMS message.
100      * (See 3GPP2 C.S0015-B, v2, 3.4.3.3)
101      */
102     public CdmaSmsAddress destAddress;
103 
104     /**
105      * The origination subaddress identifies the originator of the SMS message.
106      * (See 3GPP2 C.S0015-B, v2, 3.4.3.4)
107      */
108     public CdmaSmsSubaddress origSubaddress;
109 
110     /**
111      * The destination subaddress identifies the target of the SMS message.
112      * (See 3GPP2 C.S0015-B, v2, 3.4.3.4)
113      */
114     public CdmaSmsSubaddress destSubaddress;
115 
116     /**
117      * The 6-bit bearer reply parameter is used to request the return of a
118      * SMS Acknowledge Message.
119      * (See 3GPP2 C.S0015-B, v2, 3.4.3.5)
120      */
121     public int bearerReply;
122 
123     /**
124      * Cause Code values:
125      * The cause code parameters are an indication whether an SMS error has occurred and if so,
126      * whether the condition is considered temporary or permanent.
127      * ReplySeqNo 6-bit value,
128      * ErrorClass 2-bit value,
129      * CauseCode 0-bit or 8-bit value
130      * (See 3GPP2 C.S0015-B, v2, 3.4.3.6)
131      */
132     public byte replySeqNo;
133     public byte errorClass;
134     public byte causeCode;
135 
136     /**
137      * encoded bearer data
138      * (See 3GPP2 C.S0015-B, v2, 3.4.3.7)
139      */
140     @UnsupportedAppUsage
141     public byte[] bearerData;
142 
143     @UnsupportedAppUsage
SmsEnvelope()144     public SmsEnvelope() {
145         // nothing to see here
146     }
147 
148 }
149 
150