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