1 /* 2 * Copyright (C) 2021-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_SEND_INDEXER_H 17 #define SMS_SEND_INDEXER_H 18 19 #include <vector> 20 21 #include "i_sms_service_interface.h" 22 #include "gsm_pdu_code_type.h" 23 #include "sms_base_message.h" 24 #include "sms_common.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 class SmsSendIndexer { 29 public: 30 SmsSendIndexer(const std::string &desAddr, const std::string &scAddr, const std::string &text, 31 const sptr<ISendShortMessageCallback> &sendCallback, 32 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 33 SmsSendIndexer(const std::string &desAddr, const std::string &scAddr, int32_t port, const uint8_t *data, 34 uint32_t dataLen, const sptr<ISendShortMessageCallback> &sendCallback, 35 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 36 ~SmsSendIndexer(); 37 uint8_t GetPsResendCount() const; 38 void SetPsResendCount(uint8_t resendCount); 39 uint8_t GetCsResendCount() const; 40 void SetCsResendCount(uint8_t resendCount); 41 uint8_t GetMsgRefId() const; 42 void SetMsgRefId(uint8_t msgRefId); 43 int64_t GetMsgRefId64Bit() const; 44 void SetMsgRefId64Bit(int64_t msgRefId64Bit); 45 const std::vector<uint8_t>& GetAckPdu() const; 46 void SetAckPdu(const std::vector<uint8_t> &ackPdu); 47 const std::vector<uint8_t>& GetData() const; 48 void SetData(const std::vector<uint8_t> &data); 49 uint8_t GetErrorCode() const; 50 void SetErrorCode(uint8_t errorCode); 51 bool GetIsText() const; 52 std::string GetSmcaAddr() const; 53 void SetSmcaAddr(const std::string &scAddr); 54 std::string GetDestAddr() const; 55 void SetDestAddr(const std::string &destAddr); 56 int32_t GetDestPort() const; 57 void SetDestPort(int32_t destPort); 58 sptr<ISendShortMessageCallback> GetSendCallback() const; 59 void SetSendCallback(const sptr<ISendShortMessageCallback> &sendCallback); 60 sptr<IDeliveryShortMessageCallback> GetDeliveryCallback() const; 61 void SetDeliveryCallback(const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 62 std::string GetText() const; 63 void SetText(const std::string &text); 64 uint8_t GetUnSentCellCount() const; 65 void SetUnSentCellCount(const uint8_t unSentCellCount); 66 std::shared_ptr<bool> GetHasCellFailed() const; 67 void SetHasCellFailed(const std::shared_ptr<bool> &hasCellFailed); 68 bool GetIsFailure() const; 69 void SetIsFailure(bool isFailure); 70 bool GetHasMore() const; 71 void SetHasMore(bool hasMore); 72 int64_t GetTimeStamp() const; 73 void SetTimeStamp(int64_t timeStamp); 74 void SetNetWorkType(NetWorkType netWorkType); 75 NetWorkType GetNetWorkType() const; 76 void SetEncodeSmca(const std::vector<uint8_t> &smca); 77 const std::vector<uint8_t>& GetEncodeSmca() const; 78 void SetEncodePdu(const std::vector<uint8_t> &pdu); 79 const std::vector<uint8_t>& GetEncodePdu() const; 80 void SetImsSmsForCdma(const bool isImsSms); 81 const bool &IsImsSmsForCdma() const; 82 void UpdatePduForResend(); 83 void SetEncodePdu(const std::vector<uint8_t> &&pdu); 84 void SetEncodeSmca(const std::vector<uint8_t> &&smca); 85 void SetAckPdu(const std::vector<uint8_t> &&ackPdu); 86 void SetData(const std::vector<uint8_t> &&data); 87 void SetDcs(enum DataCodingScheme dcs); 88 enum DataCodingScheme GetDcs() const; 89 bool GetIsConcat() const; 90 void SetIsConcat(bool concat); 91 void SetSmsConcat(const SmsConcat &smsConcat); 92 SmsConcat GetSmsConcat() const; 93 uint8_t GetLangId() const; 94 void SetLangId(uint8_t langId); 95 uint16_t GetMsgId() const; 96 void SetMsgId(uint16_t msgId); 97 98 private: 99 std::vector<uint8_t> pdu_; 100 std::vector<uint8_t> smca_; 101 std::vector<uint8_t> ackPdu_; 102 std::vector<uint8_t> data_; 103 uint8_t errorCode_ = 0; 104 std::string text_; 105 NetWorkType netWorkType_ = NetWorkType::NET_TYPE_UNKNOWN; 106 std::string scAddr_; 107 std::string destAddr_; 108 int32_t destPort_ = 0; 109 bool isCdmaIms_ = false; 110 bool hasMore_ = false; 111 long timeStamp_ = 0; 112 uint8_t csResendCount_ = 0; 113 uint8_t psResendCount_ = 0; 114 uint8_t msgRefId_ = 0; 115 int64_t msgRefId64Bit_ = 0; 116 uint8_t unSentCellCount_ = 0; 117 std::shared_ptr<bool> hasCellFailed_ = nullptr; 118 sptr<ISendShortMessageCallback> sendCallback_ = nullptr; 119 sptr<IDeliveryShortMessageCallback> deliveryCallback_ = nullptr; 120 bool isFailure_ = false; 121 enum DataCodingScheme dcs_ = DATA_CODING_7BIT; 122 bool isConcat_ = false; 123 SmsConcat smsConcat_ = {0, 0, 0, false}; 124 uint8_t langId_ = 0; 125 bool isText_ = false; 126 uint16_t msgId_ = 0; 127 }; 128 } // namespace Telephony 129 } // namespace OHOS 130 #endif