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