• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 SMS_COMMON_UTILS_H
17 #define SMS_COMMON_UTILS_H
18 
19 #include <ctime>
20 
21 #include "sms_pdu_code_type.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class SmsCommonUtils {
26 public:
27     static uint16_t Pack7bitChar(
28         const uint8_t *userData, uint16_t dataLen, uint8_t fillBits, uint8_t *packData, uint16_t packLen);
29     static uint16_t Unpack7bitChar(
30         const uint8_t *tpdu, uint16_t dataLen, uint8_t fillBits, uint8_t *unpackData, uint16_t unpackDataLen);
31     static uint16_t Unpack7bitCharForCBPdu(
32         const uint8_t *tpdu, uint16_t dataLen, uint8_t fillBits, uint8_t *unpackData, uint16_t unpackDataLen);
33     static int64_t ConvertTime(const struct SmsTimeAbs &timeAbs);
34     static uint8_t DtmfCharToDigit(const uint8_t c);
35     static uint8_t DigitToDtmfChar(const uint8_t c);
36 
37 private:
38     static void GetDisplayTime(const time_t &rawtime);
39 };
40 } // namespace Telephony
41 } // namespace OHOS
42 #endif // SMS_COMMON_UTILS_H
43