• 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_SMS_PARCEL_H
17 #define OHOS_RIL_SMS_PARCEL_H
18 
19 #include "hril_base_parcel.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 struct GsmSmsMessageInfo : public HrilBaseParcel {
24     int32_t serial;
25     std::string smscPdu; /* Short Message Service Center Protocol Data Unit see GSM 03.40 */
26     std::string pdu; /* Protocol Data Unit */
27     int32_t state;
28     bool ReadFromParcel(Parcel &parcel);
29     virtual bool Marshalling(Parcel &parcel) const override;
30     std::shared_ptr<GsmSmsMessageInfo> UnMarshalling(Parcel &parcel);
31     void Dump(std::string, int32_t);
32 };
33 
34 struct SendCdmaSmsMessageInfo : public HrilBaseParcel {
35     int32_t serial;
36     std::string smscPdu; /* Short Message Service Center Protocol Data Unit see GSM 03.40 */
37     int32_t state;
38     bool ReadFromParcel(Parcel &parcel);
39     virtual bool Marshalling(Parcel &parcel) const override;
40     std::shared_ptr<SendCdmaSmsMessageInfo> UnMarshalling(Parcel &parcel);
41     void Dump(std::string, int32_t);
42 };
43 
44 struct SmsMessageIOInfo : public HrilBaseParcel {
45     int32_t serial;
46     std::string smscPdu; /* Short Message Service Center Protocol Data Unit see GSM 03.40 */
47     std::string pdu; /* Protocol Data Unit */
48     int32_t state;
49     int32_t index;
50     bool ReadFromParcel(Parcel &parcel);
51     virtual bool Marshalling(Parcel &parcel) const override;
52     std::shared_ptr<SmsMessageIOInfo> UnMarshalling(Parcel &parcel);
53     void Dump(std::string, int32_t);
54 };
55 
56 struct ServiceCenterAddress : public HrilBaseParcel {
57     int32_t serial;
58     int32_t tosca;
59     std::string address; /* Protocol Data Unit */
60     bool ReadFromParcel(Parcel &parcel);
61     virtual bool Marshalling(Parcel &parcel) const override;
62     std::shared_ptr<ServiceCenterAddress> UnMarshalling(Parcel &parcel);
63     void Dump(std::string, int32_t);
64 };
65 
66 /* From 3GPP TS 27.005  AT+CSCB = [<mode>[,<mids>[,<dcss>]]] */
67 struct CBConfigInfo : public HrilBaseParcel {
68     int32_t serial;
69     int32_t mode;
70     int32_t indicationType;
71     std::string mids;
72     std::string dcss;
73     bool ReadFromParcel(Parcel &parcel);
74     virtual bool Marshalling(Parcel &parcel) const override;
75     std::shared_ptr<CBConfigInfo> UnMarshalling(Parcel &parcel);
76 };
77 
78 struct CdmaCBConfigInfo : public HrilBaseParcel {
79     int32_t service;
80     int32_t language;
81     int32_t checked;
82     bool ReadFromParcel(Parcel &parcel);
83     virtual bool Marshalling(Parcel &parcel) const override;
84     std::shared_ptr<CdmaCBConfigInfo> UnMarshalling(Parcel &parcel);
85 };
86 
87 struct CdmaCBConfigInfoList : public HrilBaseParcel {
88     int32_t serial;
89     int32_t size;
90     std::vector<CdmaCBConfigInfo> list;
91     bool ReadFromParcel(Parcel &parcel);
92     virtual bool Marshalling(Parcel &parcel) const override;
93     std::shared_ptr<CdmaCBConfigInfoList> UnMarshalling(Parcel &parcel);
94 };
95 
96 /* From 3GPP TS 27.005   if text mode (+CMGF=1):
97     <CR><LF>+CBM:
98     <sn>,<mid>,<dcs>,<page>,<pages><CR><LF><data><CR>
99     <LF> if PDU mode
100     (+CMGF=0):
101     <CR><LF>+CBM: <length><CR><LF><pdu><CR><LF>
102 */
103 struct CBConfigReportInfo : public HrilBaseParcel {
104     int32_t indicationType;
105     int32_t sn;
106     int32_t mid;
107     int32_t page;
108     int32_t pages;
109     std::string dcs;
110     std::string data;
111     int32_t length;
112     std::string pdu;
113     bool ReadFromParcel(Parcel &parcel);
114     virtual bool Marshalling(Parcel &parcel) const override;
115     std::shared_ptr<CBConfigReportInfo> UnMarshalling(Parcel &parcel);
116 };
117 
118 struct ImsSmsMessageInfo : public HrilBaseParcel {
119     int32_t serial;
120     int32_t technology;
121     bool retry; /* if errorCode != 0, suggested retry time */
122     int32_t msgRef; /* TP-Message-Reference for GSM, and BearerData MessageId for CDMA
123                      * from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
124     int32_t gsmMessageSize;
125     std::vector<GsmSmsMessageInfo> gsmMessage;
126     bool ReadFromParcel(Parcel &parcel);
127     virtual bool Marshalling(Parcel &parcel) const override;
128     std::shared_ptr<ImsSmsMessageInfo> UnMarshalling(Parcel &parcel);
129     void Dump(std::string, int32_t);
130 };
131 
132 struct SmsMessageInfo : public HrilBaseParcel {
133     int32_t indicationType;
134     int32_t size;
135     std::vector<uint8_t> pdu; /* Protocol Data Unit */
136     bool ReadFromParcel(Parcel &parcel);
137     virtual bool Marshalling(Parcel &parcel) const override;
138     std::shared_ptr<SmsMessageInfo> UnMarshalling(Parcel &parcel);
139     void Dump(std::string, int32_t);
140 };
141 
142 struct ModeData : public HrilBaseParcel {
143     int32_t serial;
144     bool result;
145     int32_t mode;
146     std::string pdu; /* Protocol Data Unit */
147     bool ReadFromParcel(Parcel &parcel);
148     virtual bool Marshalling(Parcel &parcel) const override;
149     std::shared_ptr<ModeData> UnMarshalling(Parcel &parcel);
150     void Dump(std::string, int32_t);
151 };
152 
153 struct SendSmsResultInfo : public HrilBaseParcel {
154     int32_t msgRef; /* TP-Message-Reference for GSM, and BearerData MessageId for CDMA
155                      * from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
156     std::string pdu; /* Protocol Data Unit */
157     int32_t errCode;
158     int64_t flag;
159     bool ReadFromParcel(Parcel &parcel);
160     virtual bool Marshalling(Parcel &parcel) const override;
161     std::shared_ptr<SendSmsResultInfo> UnMarshalling(Parcel &parcel);
162     void Dump(std::string, int32_t);
163 };
164 
165 struct CdmaSmsAddress {
166     int32_t digitMode;
167     int32_t mode;
168     int32_t type;
169     int32_t plan;
170     unsigned char number;
171     unsigned char bytes[36];
172 };
173 
174 struct CdmaSmsSubAddress {
175     int32_t type;
176     unsigned char odd;
177     unsigned char number;
178     unsigned char bytes[36];
179 };
180 
181 struct CdmaSmsMessageInfo {
182     int32_t serial;
183     int32_t serviceId;
184     unsigned char isExist;
185     int32_t type;
186     CdmaSmsAddress address;
187     CdmaSmsSubAddress subAddress;
188     int32_t size;
189     unsigned char bytes[255];
190 };
191 
192 struct CdmaSmsInfo : public HrilBaseParcel {
193     int32_t indicationType;
194     int32_t msgRef; /* TP-Message-Reference for GSM, and BearerData MessageId for CDMA
195                  * from 3GPP2 C.S0015-B, v2.0, 4.5-1 */
196     std::string pdu; /* Protocol Data Unit */
197     int32_t errCode; /* if unknown or not applicable, that is -1
198                   * from 3GPP 27.005, 3.2.5 for GSM/UMTS,
199                   * 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA */
200     bool ReadFromParcel(Parcel &parcel);
201     virtual bool Marshalling(Parcel &parcel) const override;
202     std::shared_ptr<CdmaSmsInfo> UnMarshalling(Parcel &parcel);
203     void Dump(std::string, int32_t);
204 };
205 } // namespace Telephony
206 } // namespace OHOS
207 #endif // OHOS_RIL_SMS_PARCEL_H
208