rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 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 | #ifndef SMSENVELOPE_H_ |
| 18 | #define SMSENVELOPE_H_ |
| 19 | |
| 20 | #include <cstdint> |
| 21 | #include <memory> |
| 22 | #include <vector> |
| 23 | #include "CdmaSmsAddress.h" |
| 24 | #include "CdmaSmsSubaddress.h" |
| 25 | |
| 26 | class SmsEnvelope { |
| 27 | public: |
| 28 | SmsEnvelope(); |
| 29 | virtual ~SmsEnvelope(); |
| 30 | /** |
| 31 | * Message Types |
| 32 | * (See 3GPP2 C.S0015-B 3.4.1) |
| 33 | */ |
| 34 | static constexpr int MESSAGE_TYPE_POINT_TO_POINT = 0x00; |
| 35 | static constexpr int MESSAGE_TYPE_BROADCAST = 0x01; |
| 36 | static constexpr int MESSAGE_TYPE_ACKNOWLEDGE = 0x02; |
| 37 | |
| 38 | /** |
| 39 | * Supported Teleservices |
| 40 | * (See 3GPP2 N.S0005 and TIA-41) |
| 41 | */ |
| 42 | static constexpr int TELESERVICE_NOT_SET = 0x0000; |
| 43 | static constexpr int TELESERVICE_WMT = 0x1002; |
| 44 | static constexpr int TELESERVICE_VMN = 0x1003; |
| 45 | static constexpr int TELESERVICE_WAP = 0x1004; |
| 46 | static constexpr int TELESERVICE_WEMT = 0x1005; |
| 47 | static constexpr int TELESERVICE_SCPT = 0x1006; |
| 48 | |
| 49 | /** |
| 50 | * The following are defined as extensions to the standard teleservices |
| 51 | */ |
| 52 | // Voice mail notification through Message Waiting Indication in CDMA mode or Analog mode. |
| 53 | // Defined in 3GPP2 C.S-0005, 3.7.5.6, an Info Record containing an 8-bit number with the |
| 54 | // number of messages waiting, it's used by some CDMA carriers for a voice mail count. |
| 55 | static constexpr int TELESERVICE_MWI = 0x40000; |
| 56 | |
| 57 | // Service Categories for Cell Broadcast, see 3GPP2 C.R1001 table 9.3.1-1 |
| 58 | // static final int SERVICE_CATEGORY_EMERGENCY = 0x0001; |
| 59 | //... |
| 60 | |
| 61 | // CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1 |
| 62 | static constexpr int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT = 0x1000; |
| 63 | static constexpr int SERVICE_CATEGORY_CMAS_EXTREME_THREAT = 0x1001; |
| 64 | static constexpr int SERVICE_CATEGORY_CMAS_SEVERE_THREAT = 0x1002; |
| 65 | static constexpr int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003; |
| 66 | static constexpr int SERVICE_CATEGORY_CMAS_TEST_MESSAGE = 0x1004; |
| 67 | static constexpr int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE = 0x10ff; |
| 68 | |
| 69 | /** |
| 70 | * Provides the type of a SMS message like point to point, broadcast or acknowledge |
| 71 | */ |
| 72 | int messageType; |
| 73 | |
| 74 | /** |
| 75 | * The 16-bit Teleservice parameter identifies which upper layer service access point is sending |
| 76 | * or receiving the message. |
| 77 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.1) |
| 78 | */ |
| 79 | int teleService = TELESERVICE_NOT_SET; |
| 80 | |
| 81 | /** |
| 82 | * The 16-bit service category parameter identifies the type of service provided |
| 83 | * by the SMS message. |
| 84 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.2) |
| 85 | */ |
| 86 | int serviceCategory; |
| 87 | |
| 88 | /** |
| 89 | * The origination address identifies the originator of the SMS message. |
| 90 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.3) |
| 91 | */ |
| 92 | std::shared_ptr<CdmaSmsAddress> origAddress = nullptr; |
| 93 | |
| 94 | /** |
| 95 | * The destination address identifies the target of the SMS message. |
| 96 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.3) |
| 97 | */ |
| 98 | std::shared_ptr<CdmaSmsAddress> destAddress = nullptr; |
| 99 | |
| 100 | /** |
| 101 | * The origination subaddress identifies the originator of the SMS message. |
| 102 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.4) |
| 103 | */ |
| 104 | std::shared_ptr<CdmaSmsSubaddress> origSubaddress = nullptr; |
| 105 | |
| 106 | /** |
| 107 | * The 6-bit bearer reply parameter is used to request the return of a |
| 108 | * SMS Acknowledge Message. |
| 109 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.5) |
| 110 | */ |
| 111 | int bearerReply; |
| 112 | |
| 113 | /** |
| 114 | * Cause Code values: |
| 115 | * The cause code parameters are an indication whether an SMS error has occurred and if so, |
| 116 | * whether the condition is considered temporary or permanent. |
| 117 | * ReplySeqNo 6-bit value, |
| 118 | * ErrorClass 2-bit value, |
| 119 | * CauseCode 0-bit or 8-bit value |
| 120 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.6) |
| 121 | */ |
| 122 | uint8_t replySeqNo; |
| 123 | uint8_t errorClass; |
| 124 | uint8_t causeCode; |
| 125 | |
| 126 | /** |
| 127 | * encoded bearer data |
| 128 | * (See 3GPP2 C.S0015-B, v2, 3.4.3.7) |
| 129 | */ |
| 130 | std::vector<uint8_t> bearerData; |
| 131 | // uint8_t* bearerData; |
| 132 | // uint32_t bearerData_length; |
| 133 | |
| 134 | }; |
| 135 | |
| 136 | #endif /* SMSENVELOPE_H_ */ |