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