• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_RIL_SIM_PARCEL_H
17 #define OHOS_RIL_SIM_PARCEL_H
18 
19 #include "hril_base_parcel.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 struct CardStatusInfo : public HrilBaseParcel {
24     int32_t index;
25     int32_t simType;
26     int32_t simState;
27 
28     bool ReadFromParcel(Parcel &parcel);
29     virtual bool Marshalling(Parcel &parcel) const override;
30     std::shared_ptr<CardStatusInfo> UnMarshalling(Parcel &parcel);
31     void Dump(std::string, int32_t);
32 };
33 
34 /* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
35 struct SimIoRequestInfo : public HrilBaseParcel {
36     int32_t command; /* command passed on by the ME to the SIM; refer GSM 51.011 [28] */
37     int32_t fileId; /* this is the identifier of a elementary datafile on SIM.
38                      * Mandatory for every command except STATUS */
39     int32_t p1; /* parameters passed on by the MT to the SIM.
40                  * These parameters are mandatory for every command,
41                  * except GET RESPONSE and STATUS.
42                  * The values are described in 3GPP TS 51.011 [28] */
43     int32_t p2;
44     int32_t p3;
45     std::string data; /* information which shall be written to the SIM
46                        * (hexadecimal character format; refer +CSCS). */
47     std::string path; /* contains the path of an elementary file on the SIM/UICC
48                        * in hexadecimal format as defined in ETSI TS 102 221 [60]
49                        * (e.g. "7F205F70" in SIM and UICC case).
50                        * The <pathid> shall only be used in the mode
51                        * "select by path from MF" as defined in  ETSI TS 102 221 [60] */
52     int32_t serial;
53     std::string pin2;
54     std::string aid;
55     bool ReadFromParcel(Parcel &parcel);
56     virtual bool Marshalling(Parcel &parcel) const override;
57     std::shared_ptr<SimIoRequestInfo> UnMarshalling(Parcel &parcel);
58     void Dump(std::string, int32_t);
59 };
60 
61 /* Form 3GPP TS 27.007 V4.3.0 (2001-12) 8.18, + CRSM */
62 struct IccIoResultInfo : public HrilBaseParcel {
63     int32_t sw1; /* information from the SIM about the execution of the actual command.
64                   * These parameters are delivered to the TE in both cases,
65                   * on successful or failed execution of the command */
66     int32_t sw2;
67     std::string response;
68 
69     bool ReadFromParcel(Parcel &parcel);
70     virtual bool Marshalling(Parcel &parcel) const override;
71     std::shared_ptr<IccIoResultInfo> UnMarshalling(Parcel &parcel);
72     void Dump(std::string, int32_t);
73 };
74 
75 struct SimLockInfo : public HrilBaseParcel {
76     int32_t serial;
77     std::string fac; /* String type, which specifies the object operated by this command.
78                       * "SC": SIM PIN1;
79                       * "AO": prohibit all outgoing calls;
80                       * "OI": All international outgoing calls are prohibited;
81                       * "OX": All international outgoing calls are prohibited, except for the country of origin;
82                       * "AI": All incoming calls are prohibited;
83                       * "IR": When roaming outside the home area, all incoming calls are prohibited;
84                       * "AB": prohibit all services (applicable only when <mode>=0);
85                       * "AG": Outgoing call is prohibited (applicable only when <mode>=0);
86                       * "AC": Incoming calls are prohibited (applicable only when <mode>=0);
87                       * "FD": FDN;
88                       * "PN": lock the network;
89                       * "PU": lock subnet;
90                       * "PP": Lock SP. */
91     int32_t mode;
92     int32_t status;
93     std::string passwd;
94     int32_t classx;
95 
96     bool ReadFromParcel(Parcel &parcel);
97     virtual bool Marshalling(Parcel &parcel) const override;
98     std::shared_ptr<SimLockInfo> UnMarshalling(Parcel &parcel);
99     void Dump(std::string, int32_t);
100 };
101 
102 struct SimPasswordInfo : public HrilBaseParcel {
103     int32_t serial;
104     std::string fac; /* String type, which specifies the object operated by this command.
105                       * “SC”:SIM PIN1;
106                       * “P2”:SIM PIN2;
107                       * "OI": All international outgoing calls are prohibited;
108                       * "OX": All international outgoing calls are prohibited, except for the country of origin;
109                       * "AI": All incoming calls are prohibited;
110                       * "IR": When roaming outside the home area, all incoming calls are prohibited;
111                       * "AB": prohibit all services (applicable only when <mode>=0);
112                       * "AG": Outgoing call is prohibited (applicable only when <mode>=0);
113                       * "AC": Incoming call service is prohibited (applicable only when <mode>=0). */
114     std::string oldPassword;
115     std::string newPassword;
116     int32_t passwordLength; /* Max length of oldPassword or newPassword */
117 
118     bool ReadFromParcel(Parcel &parcel);
119     virtual bool Marshalling(Parcel &parcel) const override;
120     std::shared_ptr<SimPasswordInfo> UnMarshalling(Parcel &parcel);
121     void Dump(std::string, int32_t);
122 };
123 
124 struct SimPinInputTimes : public HrilBaseParcel {
125     int32_t serial;
126     std::string code; /* param of string.
127                        * SIM PIN2 is mean that SIM PIN2 request. SIM PUK2 is mean that SIM PUK2 request. */
128     int32_t times; /* The remaining number of entries, for PIN2, the maximum number of entries is 3 times;
129                     * for PUK2, the maximum number of entries is 10 times. */
130     int32_t pukTimes; /* The remaining number of PUK, the maximum number of entries is 10 times. */
131     int32_t pinTimes; /* The remaining number of PIN, the maximum number of entries is 3 times. */
132     int32_t puk2Times; /* The remaining number of PUK2, the maximum number of entries is 10 times. */
133     int32_t pin2Times; /* The remaining number of PIN2, the maximum number of entries is 3 times. */
134 
135     bool ReadFromParcel(Parcel &parcel);
136     virtual bool Marshalling(Parcel &parcel) const override;
137     std::shared_ptr<SimPinInputTimes> UnMarshalling(Parcel &parcel);
138     void Dump(std::string, int32_t);
139 };
140 
141 struct SimProtocolRequest : public HrilBaseParcel {
142     int32_t serial;
143     int32_t phase;
144     int32_t protocol;
145     int32_t slotId;
146     bool ReadFromParcel(Parcel &parcel);
147     virtual bool Marshalling(Parcel &parcel) const override;
148     std::shared_ptr<SimProtocolRequest> UnMarshalling(Parcel &parcel);
149     void Dump(std::string, int32_t);
150 };
151 
152 struct SimProtocolResponse : public HrilBaseParcel {
153     int32_t phase;
154     int32_t result;
155     int32_t slotId;
156     bool ReadFromParcel(Parcel &parcel);
157     virtual bool Marshalling(Parcel &parcel) const override;
158     std::shared_ptr<SimProtocolResponse> UnMarshalling(Parcel &parcel);
159     void Dump(std::string, int32_t);
160 };
161 
162 struct ApduSimIORequestInfo : public HrilBaseParcel {
163     int32_t serial;
164     int32_t channelId;
165     int32_t type;
166     int32_t instruction;
167     int32_t p1;
168     int32_t p2;
169     int32_t p3;
170     std::string data;
171     bool ReadFromParcel(Parcel &parcel);
172     virtual bool Marshalling(Parcel &parcel) const override;
173     std::shared_ptr<ApduSimIORequestInfo> UnMarshalling(Parcel &parcel);
174     void Dump(std::string, int32_t);
175 };
176 
177 struct LockStatusResp : public HrilBaseParcel {
178     int32_t result;
179     int32_t remain;
180     bool ReadFromParcel(Parcel &parcel);
181     virtual bool Marshalling(Parcel &parcel) const override;
182     std::shared_ptr<LockStatusResp> UnMarshalling(Parcel &parcel);
183     void Dump(std::string, int32_t);
184 };
185 } // namespace Telephony
186 } // namespace OHOS
187 #endif // OHOS_RIL_SIM_PARCEL_H