1 /*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #ifndef TELEPHONY_TELEPHONY_TYPES_H
17 #define TELEPHONY_TELEPHONY_TYPES_H
18
19 #include <string>
20 #include <vector>
21
22 #include "parameter.h"
23
24 namespace OHOS {
25 namespace Telephony {
26 #define SIM_SLOT_COUNT GetMaxSlotCount<int32_t>()
27 inline const int32_t SYSPARA_SIZE = 128;
28 inline const int32_t DEFAULT_SIM_SLOT_ID = 0;
29 inline const std::string DEFAULT_SLOT_COUNT = "1";
30 inline const std::string TEL_SIM_SLOT_COUNT = "const.telephony.slotCount";
31
32 template<typename T>
GetMaxSlotCount()33 inline T GetMaxSlotCount()
34 {
35 char simSlotCount[SYSPARA_SIZE] = {0};
36 GetParameter(TEL_SIM_SLOT_COUNT.c_str(), DEFAULT_SLOT_COUNT.c_str(), simSlotCount, SYSPARA_SIZE);
37 T slotCount = std::atoi(simSlotCount);
38 return slotCount;
39 }
40
41 enum SimSlotId {
42 SIM_SLOT_0 = 0,
43 SIM_SLOT_1,
44 SIM_SLOT_2,
45 SIM_SLOT_3,
46 };
47
48 enum ModemPowerState {
49 CORE_SERVICE_POWER_NOT_AVAILABLE = -1,
50 CORE_SERVICE_POWER_OFF = 0,
51 CORE_SERVICE_POWER_ON = 1
52 };
53
54 template<typename T>
55 struct TelRilResponseInfo {
56 int32_t slotId;
57 int32_t flag;
58 int32_t errorNo;
59 T object;
60 };
61
62 struct LinkBandwidthRule {
63 int32_t rat;
64 int32_t delayMs;
65 int32_t delayUplinkKbps;
66 int32_t delayDownlinkKbps;
67 std::vector<int32_t> maximumUplinkKbps;
68 std::vector<int32_t> maximumDownlinkKbps;
69 };
70
71 struct DataProfile {
72 int profileId;
73 /** (Access Point Name) a string parameter which is a logical name that is used to select the
74 * GGSN or the external packet data network. from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
75 */
76 std::string apn;
77 /** (Packet Data Protocol type) a string parameter which specifies the type of packet
78 * data protocol from 3GPP TS 27.007 10.1 V4.3.0 (2001-12)
79 */
80 std::string protocol;
81 int32_t verType;
82 std::string userName;
83 std::string password;
84 std::string roamingProtocol;
85 };
86
87 struct ActivateDataParam {
88 int32_t param; // eg:AppExecFwk::InnerEvent::Get(eventId, activateData.param);
89 int32_t radioTechnology;
90 struct DataProfile dataProfile;
91 bool isRoaming;
92 bool allowRoaming;
93 };
94
95 struct DeactivateDataParam {
96 int32_t param; // eg:AppExecFwk::InnerEvent::Get(eventId, deactivateData.param);
97 int32_t cid;
98 int32_t reason;
99 };
100
101 struct CallTransferParam {
102 int32_t mode;
103 int32_t reason;
104 int32_t classx;
105 std::string number;
106 };
107
108 struct CallRestrictionParam {
109 int32_t mode;
110 std::string password;
111 std::string fac;
112 };
113
114 struct DtmfParam {
115 int32_t index;
116 int32_t switchOn;
117 int32_t switchOff;
118 std::string sDTMFCode;
119 };
120
121 struct CBConfigParam {
122 int32_t mode;
123 std::string idList;
124 std::string dcsList;
125 };
126
127 struct CdmaSimMessageParam {
128 int32_t cdmaIndex;
129 int32_t status;
130 std::string pdu;
131 };
132
133 struct GsmSimMessageParam {
134 int64_t refId;
135 std::string smscPdu;
136 std::string pdu;
137 };
138
139 struct SimMessageParam {
140 int32_t gsmIndex;
141 int32_t status;
142 std::string smscPdu;
143 std::string pdu;
144 };
145
146 struct SimLockParam {
147 std::string fac;
148 int32_t mode;
149 std::string passwd;
150 };
151
152 struct SimPasswordParam {
153 int32_t passwordLength;
154 std::string fac;
155 std::string oldPassword;
156 std::string newPassword;
157 };
158 } // namespace Telephony
159 } // namespace OHOS
160 #endif // TELEPHONY_TELEPHONY_TYPES_H