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_DECODE_H 17 #define GSM_SMS_PARAM_DECODE_H 18 19 #include "gsm_pdu_code_type.h" 20 #include "sms_pdu_buffer.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 class GsmSmsParamDecode { 25 public: 26 GsmSmsParamDecode() = default; 27 virtual ~GsmSmsParamDecode() = default; 28 bool DecodeAddressPdu(SmsReadBuffer &buffer, struct AddressNumber *resultNum); 29 void DecodeSmscPdu(uint8_t *srcAddr, uint8_t addrLen, enum TypeOfNum ton, std::string &desAddr); 30 uint8_t DecodeSmscPdu(const uint8_t *pTpdu, uint8_t pduLen, struct AddressNumber &desAddrObj); 31 bool DecodeDcsPdu(SmsReadBuffer &buffer, struct SmsDcs *pDCS); 32 33 enum SmsMessageClass GetMsgClass(uint8_t dcs); 34 enum DataCodingScheme GetMsgCodingScheme(uint8_t dcs); 35 enum SmsIndicatorType GetMsgIndicatorType(const uint8_t dcs); 36 void GetMwiType(const uint8_t dcs, struct SmsDcs &smsDcs); 37 bool DecodeTimePdu(SmsReadBuffer &buffer, struct SmsTimeStamp *timeStamp); 38 39 private: 40 bool DecodeAddressAlphaNum(SmsReadBuffer &buffer, struct AddressNumber *resultNum, uint8_t bcdLen, uint8_t addrLen); 41 bool DecodeAddressInternationalNum(SmsReadBuffer &buffer, struct AddressNumber *resultNum, uint8_t bcdLen); 42 bool DecodeAddressDefaultNum(SmsReadBuffer &buffer, struct AddressNumber *resultNum, uint8_t bcdLen); 43 void DecodeDcsGeneralGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 44 void DecodeDcsClassGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 45 void DecodeDcsDeleteGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 46 void DecodeDcsDiscardGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 47 void DecodeDcsStoreGsmGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 48 void DecodeDcsStoreUCS2GroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 49 void DecodeDcsUnknownGroupPdu(uint8_t dcs, struct SmsDcs *smsDcs); 50 bool DecodeTimePduPartData(SmsReadBuffer &buffer, struct SmsTimeStamp *pTimeStamp); 51 bool DecodeTimePduData(SmsReadBuffer &buffer, struct SmsTimeStamp *pTimeStamp); 52 }; 53 } // namespace Telephony 54 } // namespace OHOS 55 #endif