1 /*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved
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 #include "gsm_sms_param_codec.h"
18
19 #include <cstdio>
20 #include <cstring>
21 #include <ctime>
22 #include <memory>
23
24 #include "gsm_sms_udata_codec.h"
25 #include "msg_text_convert.h"
26 #include "securec.h"
27 #include "sms_common_utils.h"
28 #include "telephony_log_wrapper.h"
29
30 namespace OHOS {
31 namespace Telephony {
EncodeAddress(const struct SmsAddress * pAddress,char ** ppParam)32 int GsmSmsParamCodec::EncodeAddress(const struct SmsAddress *pAddress, char **ppParam)
33 {
34 int offset = 0;
35 int length = 0;
36 if (pAddress == nullptr) {
37 TELEPHONY_LOGE("PortAddress is null!");
38 return offset;
39 }
40 const char *temp = static_cast<const char *>(pAddress->address);
41 unsigned char ton = 0;
42
43 char *tempParam = new (std::nothrow) char[MAX_ADD_PARAM_LEN];
44 if (tempParam == nullptr) {
45 TELEPHONY_LOGE("tempParam is null!");
46 return offset;
47 }
48
49 if (memset_s(tempParam, sizeof(char) * MAX_ADD_PARAM_LEN, 0x00, sizeof(char) * MAX_ADD_PARAM_LEN) != EOK) {
50 TELEPHONY_LOGE("textData memset_s error!");
51 delete[] tempParam;
52 return offset;
53 }
54 if (temp[0] == '+') {
55 tempParam[offset++] = strlen(temp) - 1;
56 temp++;
57 ton = SMS_TON_INTERNATIONAL;
58 } else {
59 tempParam[offset++] = strlen(temp);
60 ton = pAddress->ton;
61 }
62
63 /* Set TON, NPI */
64 tempParam[offset++] = 0x80 + (ton << 0x04) + pAddress->npi;
65 TELEPHONY_LOGI("Address length is %{public}d.", tempParam[0]);
66 length = SmsCommonUtils::DigitToBcd(temp, strlen(temp), (unsigned char *)&(tempParam[offset]));
67 if (length >= 0) {
68 offset += length;
69 }
70 *ppParam = tempParam;
71 return offset;
72 }
73
EncodeSMSC(const char * pAddress,unsigned char * pEncodeAddr)74 int GsmSmsParamCodec::EncodeSMSC(const char *pAddress, unsigned char *pEncodeAddr)
75 {
76 int ret = 0;
77 char newAddr[MAX_SMSC_LEN + 1];
78 if (pAddress == nullptr || pEncodeAddr == nullptr) {
79 TELEPHONY_LOGE("Address or EncodeAddr is null.");
80 return 0;
81 }
82 (void)memset_s(newAddr, sizeof(newAddr), 0x00, sizeof(newAddr));
83 if (pAddress[0] == '+') {
84 ret = strncpy_s(newAddr, sizeof(newAddr), pAddress + 1, MAX_SMSC_LEN);
85 } else {
86 ret = strncpy_s(newAddr, sizeof(newAddr), pAddress, MAX_SMSC_LEN);
87 }
88 if (ret != EOK) {
89 TELEPHONY_LOGE("EncodeSMSC error!");
90 return 0;
91 }
92 /* Set Address */
93 int encodeLen = SmsCommonUtils::DigitToBcd(newAddr, strlen(newAddr), pEncodeAddr);
94 if (encodeLen < 0) {
95 TELEPHONY_LOGE("No address!");
96 return 0;
97 }
98 pEncodeAddr[encodeLen] = '\0';
99 return encodeLen;
100 }
101
EncodeSMSC(const struct SmsAddress * pAddress,unsigned char * pSMSC,int smscLen)102 int GsmSmsParamCodec::EncodeSMSC(const struct SmsAddress *pAddress, unsigned char *pSMSC, int smscLen)
103 {
104 int ret = 0;
105 int dataSize = 0;
106 int addrLen = 0;
107 char newAddr[MAX_SMSC_LEN + 1];
108 (void)memset_s(newAddr, sizeof(newAddr), 0x00, sizeof(newAddr));
109 if (pAddress == nullptr || pSMSC == nullptr) {
110 TELEPHONY_LOGE("Address or SMSC is null!");
111 return dataSize;
112 }
113 if (pAddress->address[0] == '+') {
114 ret = memcpy_s(newAddr, sizeof(newAddr), pAddress->address + 1, strlen(pAddress->address) - 1);
115 } else {
116 ret = memcpy_s(newAddr, sizeof(newAddr), pAddress->address, strlen(pAddress->address));
117 }
118 if (ret != EOK) {
119 TELEPHONY_LOGE("EncodeSMSC memory copy error!");
120 return ret;
121 }
122 addrLen = strlen(newAddr);
123 if (addrLen % HEX_BYTE_STEP == 0) {
124 dataSize = HEX_BYTE_STEP + (addrLen / HEX_BYTE_STEP);
125 } else {
126 dataSize = HEX_BYTE_STEP + (addrLen / HEX_BYTE_STEP) + 1;
127 }
128 if (dataSize > MAX_SMSC_LEN || dataSize > smscLen) {
129 TELEPHONY_LOGE("AddrLen or DataSize is too long!");
130 return 0;
131 }
132 /* Set Address Length Check IPC 4.0 -> addrLen/2 */
133 pSMSC[0] = (char)(dataSize - 1);
134 /* Set TON, NPI */
135 pSMSC[1] = 0x80 + ((unsigned char)pAddress->ton << 0x04) + pAddress->npi;
136 /* Set Address */
137 SmsCommonUtils::DigitToBcd(newAddr, addrLen, &(pSMSC[0x02]));
138 pSMSC[dataSize] = '\0';
139 return dataSize;
140 }
141
EncodeTime(const struct SmsTimeStamp * pTimeStamp,char ** ppParam)142 int GsmSmsParamCodec::EncodeTime(const struct SmsTimeStamp *pTimeStamp, char **ppParam)
143 {
144 int offset = 0;
145 if (pTimeStamp == nullptr) {
146 TELEPHONY_LOGE("TimeStamp is null.");
147 return offset;
148 }
149 if (pTimeStamp->format == SMS_TIME_ABSOLUTE) {
150 int timeZone = pTimeStamp->time.absolute.timeZone;
151 *ppParam = new (std::nothrow) char[MAX_ABS_TIME_PARAM_LEN];
152 if (*ppParam == nullptr) {
153 TELEPHONY_LOGE("ppParam is null.");
154 return offset;
155 }
156 (*ppParam)[offset++] = ((pTimeStamp->time.absolute.year % NUMBER_TEN) << 0x04) +
157 (pTimeStamp->time.absolute.year / NUMBER_TEN);
158 (*ppParam)[offset++] = ((pTimeStamp->time.absolute.month % NUMBER_TEN) << 0x04) +
159 (pTimeStamp->time.absolute.month / NUMBER_TEN);
160 (*ppParam)[offset++] =
161 ((pTimeStamp->time.absolute.day % NUMBER_TEN) << 0x04) + (pTimeStamp->time.absolute.day / NUMBER_TEN);
162 (*ppParam)[offset++] = ((pTimeStamp->time.absolute.hour % NUMBER_TEN) << 0x04) +
163 (pTimeStamp->time.absolute.hour / NUMBER_TEN);
164 (*ppParam)[offset++] = ((pTimeStamp->time.absolute.minute % NUMBER_TEN) << 0x04) +
165 (pTimeStamp->time.absolute.minute / NUMBER_TEN);
166 (*ppParam)[offset++] = ((pTimeStamp->time.absolute.second % NUMBER_TEN) << 0x04) +
167 (pTimeStamp->time.absolute.second / NUMBER_TEN);
168
169 if (timeZone < 0) {
170 (*ppParam)[offset] = 0x08;
171 }
172 (*ppParam)[offset++] += ((unsigned int)(pTimeStamp->time.absolute.timeZone % NUMBER_TEN) << 0x04) +
173 (pTimeStamp->time.absolute.timeZone / NUMBER_TEN);
174
175 return offset;
176 } else if (pTimeStamp->format == SMS_TIME_RELATIVE) {
177 *ppParam = new (std::nothrow) char[MAX_REL_TIME_PARAM_LEN + 1];
178 if (*ppParam == nullptr) {
179 TELEPHONY_LOGE("ppParam is null.");
180 return offset;
181 }
182 int ret =
183 memcpy_s(*ppParam, MAX_REL_TIME_PARAM_LEN + 1, &(pTimeStamp->time.relative.time), MAX_REL_TIME_PARAM_LEN);
184 if (ret != EOK) {
185 TELEPHONY_LOGE("EncodeTime memcpy_s error!");
186 }
187 return MAX_REL_TIME_PARAM_LEN;
188 }
189
190 return offset;
191 }
192
EncodeDCS(const struct SmsDcs * pDCS,char ** ppParam)193 int GsmSmsParamCodec::EncodeDCS(const struct SmsDcs *pDCS, char **ppParam)
194 {
195 if (pDCS == nullptr) {
196 TELEPHONY_LOGE("pDCS is null.");
197 return 0;
198 }
199 *ppParam = new (std::nothrow) char[MAX_DCS_PARAM_LEN];
200 if (*ppParam == nullptr) {
201 TELEPHONY_LOGE("ppParam is null.");
202 return 0;
203 }
204 unsigned char *temp = (unsigned char *)*ppParam;
205 *temp = 0x00;
206 switch (pDCS->codingGroup) {
207 case SMS_DELETION_GROUP:
208 case SMS_DISCARD_GROUP:
209 case SMS_STORE_GROUP:
210 /* not supported */
211 break;
212 case SMS_GENERAL_GROUP:
213 if (pDCS->msgClass != SMS_CLASS_UNKNOWN) {
214 *temp = 0x10 + pDCS->msgClass;
215 }
216 if (pDCS->bCompressed) {
217 *temp |= 0x20;
218 }
219 break;
220 case SMS_CODING_CLASS_GROUP:
221 *temp = 0xF0 + pDCS->msgClass;
222 break;
223 default:
224 return 0;
225 }
226
227 switch (pDCS->codingScheme) {
228 case SMS_CODING_7BIT:
229 break;
230 case SMS_CODING_UCS2:
231 *temp |= 0x08;
232 break;
233 case SMS_CODING_8BIT:
234 *temp |= 0x04;
235 break;
236 default:
237 return 0;
238 }
239
240 return MAX_DCS_PARAM_LEN;
241 }
242
DecodeAddress(const unsigned char * pTpdu,struct SmsAddress * pAddress)243 int GsmSmsParamCodec::DecodeAddress(const unsigned char *pTpdu, struct SmsAddress *pAddress)
244 {
245 int offset = 0;
246 int addrLen = 0;
247 int bcdLen = 0;
248 if (pTpdu == nullptr || pAddress == nullptr) {
249 TELEPHONY_LOGE("Address or SMSC is null!");
250 return offset;
251 }
252 MsgTextConvert *textCvt = MsgTextConvert::Instance();
253 if (textCvt == nullptr) {
254 TELEPHONY_LOGE("MsgTextConvert Instance is nullptr");
255 return offset;
256 }
257 if (memset_s(pAddress->address, sizeof(pAddress->address), 0x00, sizeof(pAddress->address)) != EOK) {
258 TELEPHONY_LOGE("pAddress memset_s error!");
259 return offset;
260 }
261 addrLen = (int)pTpdu[offset++];
262 if (addrLen % HEX_BYTE_STEP == 0) {
263 bcdLen = addrLen / HEX_BYTE_STEP;
264 } else {
265 bcdLen = addrLen / HEX_BYTE_STEP + 1;
266 }
267 pAddress->ton = (pTpdu[offset] & 0x70) >> 0x04;
268 pAddress->npi = pTpdu[offset++] & 0x0F;
269 if (pAddress->ton == SMS_TON_ALPHA_NUMERIC) {
270 char *tmpAddress = new (std::nothrow) char[MAX_ADDRESS_LEN];
271 if (tmpAddress == nullptr) {
272 return offset;
273 }
274 if (memset_s(tmpAddress, MAX_ADDRESS_LEN, 0x00, MAX_ADDRESS_LEN) != EOK) {
275 TELEPHONY_LOGE("pAddress memset_s error!");
276 delete[] tmpAddress;
277 return offset;
278 }
279 int tmplength = 0;
280 tmplength = SmsCommonUtils::Unpack7bitChar(&(pTpdu[offset]), (addrLen * 0x04) / 0x07, 0x00,
281 reinterpret_cast<unsigned char *>(tmpAddress), MAX_ADDRESS_LEN);
282 MsgLangInfo langInfo = { 0 };
283 langInfo.bSingleShift = false;
284 langInfo.bLockingShift = false;
285 textCvt->ConvertGSM7bitToUTF8(reinterpret_cast<unsigned char *>(pAddress->address), MAX_ADDRESS_LEN,
286 reinterpret_cast<unsigned char *>(tmpAddress), tmplength, &langInfo);
287 if (tmpAddress) {
288 delete[] tmpAddress;
289 }
290 } else if (pAddress->ton == SMS_TON_INTERNATIONAL) {
291 SmsCommonUtils::BcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[1]));
292 if (pAddress->address[1] != '\0') {
293 pAddress->address[0] = '+';
294 }
295 } else {
296 SmsCommonUtils::BcdToDigit(&(pTpdu[offset]), bcdLen, &((pAddress->address)[0]));
297 }
298
299 offset += bcdLen;
300 return offset;
301 }
302
DecodeTime(const unsigned char * pTpdu,struct SmsTimeStamp * pTimeStamp)303 int GsmSmsParamCodec::DecodeTime(const unsigned char *pTpdu, struct SmsTimeStamp *pTimeStamp)
304 {
305 int offset = 0;
306 if (pTpdu == nullptr || pTimeStamp == nullptr) {
307 TELEPHONY_LOGE("Tpdu or TimeStamp is null.");
308 return offset;
309 }
310 /* decode in ABSOLUTE time type. */
311 pTimeStamp->format = SMS_TIME_ABSOLUTE;
312
313 pTimeStamp->time.absolute.year = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
314 offset++;
315
316 pTimeStamp->time.absolute.month = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
317 offset++;
318
319 pTimeStamp->time.absolute.day = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
320 offset++;
321
322 pTimeStamp->time.absolute.hour = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
323 offset++;
324
325 pTimeStamp->time.absolute.minute = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
326 offset++;
327
328 pTimeStamp->time.absolute.second = (pTpdu[offset] & 0x0F) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
329 offset++;
330
331 pTimeStamp->time.absolute.timeZone = (pTpdu[offset] & 0x07) * NUMBER_TEN + ((pTpdu[offset] & 0xF0) >> 0x04);
332
333 if (pTpdu[offset] & 0x08) {
334 pTimeStamp->time.absolute.timeZone *= (-1);
335 }
336 offset++;
337 return offset;
338 }
339
ParseMsgClass(unsigned char dcs)340 static enum SmsMessageClass ParseMsgClass(unsigned char dcs)
341 {
342 switch (dcs & 0x03) {
343 case SMS_INSTANT_MESSAGE:
344 return SMS_INSTANT_MESSAGE;
345 case SMS_OPTIONAL_MESSAGE:
346 return SMS_OPTIONAL_MESSAGE;
347 case SMS_SIM_MESSAGE:
348 return SMS_SIM_MESSAGE;
349 case SMS_FORWARD_MESSAGE:
350 return SMS_FORWARD_MESSAGE;
351 default:
352 return SMS_CLASS_UNKNOWN;
353 }
354 }
355
ParseMsgCodingScheme(unsigned char dcs)356 static SmsCodingScheme ParseMsgCodingScheme(unsigned char dcs)
357 {
358 switch (dcs & 0x03) {
359 case SMS_CODING_7BIT:
360 return SMS_CODING_7BIT;
361 case SMS_CODING_8BIT:
362 return SMS_CODING_8BIT;
363 case SMS_CODING_UCS2:
364 return SMS_CODING_UCS2;
365 case SMS_CODING_AUTO:
366 return SMS_CODING_AUTO;
367 default:
368 return SMS_CODING_AUTO;
369 }
370 }
371
ParseMsgIndicatorType(const unsigned char dcs)372 static SmsIndicatorType ParseMsgIndicatorType(const unsigned char dcs)
373 {
374 switch (dcs & 0x03) {
375 case SMS_VOICE_INDICATOR:
376 return SMS_VOICE_INDICATOR;
377 case SMS_VOICE2_INDICATOR:
378 return SMS_VOICE2_INDICATOR;
379 case SMS_FAX_INDICATOR:
380 return SMS_FAX_INDICATOR;
381 case SMS_EMAIL_INDICATOR:
382 return SMS_EMAIL_INDICATOR;
383 default:
384 return SMS_EMAIL_INDICATOR;
385 }
386 }
387
DecodeMWIType(const unsigned char dcs,struct SmsDcs & pDCS)388 static void DecodeMWIType(const unsigned char dcs, struct SmsDcs &pDCS)
389 {
390 pDCS.bCompressed = false;
391 pDCS.msgClass = SMS_CLASS_UNKNOWN;
392 pDCS.bMWI = true;
393 pDCS.bIndActive = (((dcs & 0x08) >> 0x03) == 0x01) ? true : false;
394 pDCS.indType = ParseMsgIndicatorType(dcs & 0x03);
395 }
396
DecodeDCS(const unsigned char * pTpdu,struct SmsDcs * pDCS)397 int GsmSmsParamCodec::DecodeDCS(const unsigned char *pTpdu, struct SmsDcs *pDCS)
398 {
399 int offset = 0;
400 if (pTpdu == nullptr || pDCS == nullptr) {
401 TELEPHONY_LOGE("Tpdu or pDCS is null.");
402 return offset;
403 }
404 unsigned char dcs = pTpdu[offset++];
405 pDCS->bMWI = false;
406 pDCS->bIndActive = false;
407 pDCS->indType = SMS_OTHER_INDICATOR;
408 if (((dcs & 0xC0) >> 0x06) == 0) {
409 pDCS->codingGroup = SMS_GENERAL_GROUP;
410 pDCS->bCompressed = (dcs & 0x20) >> 0x05;
411 pDCS->codingScheme = ParseMsgCodingScheme((dcs & 0x0C) >> 0x02);
412
413 if (((dcs & 0x10) >> 0x04) == 0) {
414 pDCS->msgClass = SMS_CLASS_UNKNOWN;
415 } else {
416 pDCS->msgClass = ParseMsgClass(dcs & 0x03);
417 }
418 } else if (((dcs & 0xF0) >> 0x04) == 0x0F) {
419 pDCS->codingGroup = SMS_CODING_CLASS_GROUP;
420 pDCS->bCompressed = false;
421 pDCS->codingScheme = ParseMsgCodingScheme((dcs & 0x0C) >> 0x02);
422 pDCS->msgClass = ParseMsgClass(dcs & 0x03);
423 } else if (((dcs & 0xC0) >> 0x06) == 1) {
424 pDCS->codingGroup = SMS_DELETION_GROUP;
425 pDCS->bCompressed = false;
426 pDCS->msgClass = SMS_CLASS_UNKNOWN;
427 } else if (((dcs & 0xF0) >> 0x04) == 0x0C) {
428 pDCS->codingGroup = SMS_DISCARD_GROUP;
429 DecodeMWIType(dcs, *pDCS);
430 } else if (((dcs & 0xF0) >> 0x04) == 0x0D) {
431 pDCS->codingGroup = SMS_STORE_GROUP;
432 pDCS->codingScheme = SMS_CODING_7BIT;
433 DecodeMWIType(dcs, *pDCS);
434 } else if (((dcs & 0xF0) >> 0x04) == 0x0E) {
435 pDCS->codingGroup = SMS_STORE_GROUP;
436 pDCS->codingScheme = SMS_CODING_UCS2;
437 DecodeMWIType(dcs, *pDCS);
438 } else {
439 pDCS->codingGroup = SMS_UNKNOWN_GROUP;
440 pDCS->bCompressed = (dcs & 0x20) >> 0x05;
441 pDCS->codingScheme = ParseMsgCodingScheme((dcs & 0x0C) >> 0x02);
442 pDCS->msgClass = SMS_CLASS_UNKNOWN;
443 }
444
445 return offset;
446 }
447
DecodeSMSC(unsigned char * pAddress,int AddrLen,enum SmsTon ton,char * pDecodeAddr)448 void GsmSmsParamCodec::DecodeSMSC(unsigned char *pAddress, int AddrLen, enum SmsTon ton, char *pDecodeAddr)
449 {
450 if (pAddress == nullptr || AddrLen == 0) {
451 TELEPHONY_LOGE("Address is null.");
452 return;
453 }
454 if (pDecodeAddr == nullptr) {
455 TELEPHONY_LOGE("DecodeAddress is null.");
456 return;
457 }
458 if (ton == SMS_TON_INTERNATIONAL) {
459 pDecodeAddr[0] = '+';
460 SmsCommonUtils::BcdToDigit(pAddress, AddrLen, &(pDecodeAddr[1]));
461 } else {
462 SmsCommonUtils::BcdToDigit(pAddress, AddrLen, pDecodeAddr);
463 }
464 }
465
DecodeSMSC(const unsigned char * pTpdu,int pduLen,struct SmsAddress & pAddress)466 int GsmSmsParamCodec::DecodeSMSC(const unsigned char *pTpdu, int pduLen, struct SmsAddress &pAddress)
467 {
468 int offset = 0;
469 int addrLen = 0;
470 if (pTpdu == nullptr) {
471 TELEPHONY_LOGE("Tpdu is null.");
472 return offset;
473 }
474 if (memset_s(pAddress.address, sizeof(pAddress.address), 0x00, sizeof(pAddress.address)) != EOK) {
475 TELEPHONY_LOGE("textData memset_s error!");
476 }
477 addrLen = (int)pTpdu[offset++];
478 if ((addrLen == 0) || (addrLen >= pduLen)) {
479 TELEPHONY_LOGE("AddrLen is invilid.");
480 return offset;
481 }
482
483 pAddress.ton = (pTpdu[offset] & 0x70) >> 0x04;
484 pAddress.npi = pTpdu[offset++] & 0x0F;
485
486 if (pAddress.ton == SMS_TON_INTERNATIONAL) {
487 if (addrLen > (SMS_MAX_ADDRESS_LEN - 1)) {
488 TELEPHONY_LOGE("AddrLen is invilid.");
489 return 0;
490 }
491 SmsCommonUtils::BcdToDigit(&(pTpdu[offset]), addrLen, &((pAddress.address)[1]));
492 if (pAddress.address[1] != '\0') {
493 pAddress.address[0] = '+';
494 }
495 } else {
496 if (addrLen > SMS_MAX_ADDRESS_LEN) {
497 TELEPHONY_LOGE("AddrLen is invilid.");
498 return 0;
499 }
500 SmsCommonUtils::BcdToDigit(&(pTpdu[offset]), addrLen, &((pAddress.address)[0]));
501 }
502
503 offset += (addrLen - 1);
504 return offset;
505 }
506
CheckCphsVmiMsg(const unsigned char * pTpdu,int * setType,int * indType)507 bool GsmSmsParamCodec::CheckCphsVmiMsg(const unsigned char *pTpdu, int *setType, int *indType)
508 {
509 bool ret = false;
510 int offset = 0;
511 int addrLen = 0;
512 if (pTpdu == nullptr) {
513 TELEPHONY_LOGE("Tpdu is null.");
514 return ret;
515 }
516 addrLen = (int)pTpdu[offset++];
517 if (addrLen == 0x04) {
518 if (pTpdu[offset++] == 0xD0) {
519 if (pTpdu[offset] == 0x11 || pTpdu[offset] == 0x10) {
520 TELEPHONY_LOGI("####### VMI msg ######");
521 *setType = (int)(pTpdu[offset] & 0x01); /* 0 : clear, 1 : set */
522 *indType = (int)(pTpdu[offset + 1] & 0x01); /* 0 : indicator 1, 1 : indicator 2 */
523 ret = true;
524 }
525 }
526 }
527 return ret;
528 }
529 } // namespace Telephony
530 } // namespace OHOS
531