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 GSM_SMS_PARAM_CODEC_H 17 #define GSM_SMS_PARAM_CODEC_H 18 19 #include "gsm_pdu_code_type.h" 20 #include "sms_pdu_buffer.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class GsmSmsParamCodec { 25 public: 26 GsmSmsParamCodec() = default; 27 virtual ~GsmSmsParamCodec() = default; 28 bool EncodeAddressPdu(const struct AddressNumber *num, std::string &resultNum); 29 void EncodeTimePdu(const struct SmsTimeStamp *timeStamp, std::string &resultValue); 30 void EncodeDCS(const struct SmsDcs *dcsData, std::string &returnValue); 31 uint8_t EncodeSmscPdu(const char *num, uint8_t *resultNum); 32 uint8_t EncodeSmscPdu(const struct AddressNumber *num, uint8_t *smscNum, uint8_t smscLen); 33 34 bool DecodeAddressPdu(SmsReadBuffer &buffer, struct AddressNumber *resultNum); 35 bool DecodeTimePdu(SmsReadBuffer &bufferr, struct SmsTimeStamp *timeStamp); 36 bool DecodeDcsPdu(SmsReadBuffer &buffer, struct SmsDcs *smsDcs); 37 38 void DecodeSmscPdu(uint8_t *pAddress, uint8_t addrLen, enum TypeOfNum ton, std::string &decodeAddr); 39 uint8_t DecodeSmscPdu(const uint8_t *pTpdu, uint8_t pduLen, struct AddressNumber &address); 40 bool CheckVoicemail(SmsReadBuffer &buffer, int32_t *setType, int32_t *indType); 41 }; 42 } // namespace Telephony 43 } // namespace OHOS 44 #endif