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_MANAGER_H 17 #define SMS_SEND_MANAGER_H 18 19 #include <list> 20 #include <memory> 21 #include <string> 22 23 #include "cdma_sms_sender.h" 24 #include "gsm_sms_sender.h" 25 #include "sms_send_indexer.h" 26 #include "sms_network_policy_manager.h" 27 28 namespace OHOS { 29 namespace Telephony { 30 class SmsSendManager { 31 public: 32 explicit SmsSendManager(int32_t slotId); 33 virtual ~SmsSendManager(); 34 void TextBasedSmsDelivery(const std::string &desAddr, const std::string &scAddr, const std::string &text, 35 const sptr<ISendShortMessageCallback> &sendCallback, 36 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 37 void DataBasedSmsDelivery(const std::string &desAddr, const std::string &scAddr, const uint16_t port, 38 const uint8_t *data, uint16_t dataLen, const sptr<ISendShortMessageCallback> &sendCallback, 39 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 40 void RetriedSmsDelivery(const std::shared_ptr<SmsSendIndexer> smsIndexer); 41 void Init(); 42 void InitNetworkHandle(); 43 std::shared_ptr<SmsSender> GetCdmaSmsSender() const; 44 int32_t SplitMessage(const std::string &message, std::vector<std::u16string> &splitMessage); 45 int32_t GetSmsSegmentsInfo(const std::string &message, bool force7BitCode, LengthInfo &lenInfo); 46 int32_t IsImsSmsSupported(int32_t slotId, bool &isSupported); 47 bool SetImsSmsConfig(int32_t slotId, int32_t enable); 48 int32_t GetImsShortMessageFormat(std::u16string &format); 49 50 private: 51 SmsSendManager &operator=(const SmsSendManager &) = delete; 52 SmsSendManager &operator=(const SmsSendManager &&) = delete; 53 SmsSendManager(const SmsSendManager &) = delete; 54 SmsSendManager(const SmsSendManager &&) = delete; 55 56 int32_t slotId_; 57 std::shared_ptr<SmsSender> gsmSmsSender_; 58 std::shared_ptr<SmsSender> cdmaSmsSender_; 59 std::shared_ptr<AppExecFwk::EventRunner> gsmSmsSendRunner_; 60 std::shared_ptr<AppExecFwk::EventRunner> cdmaSmsSendRunner_; 61 std::shared_ptr<SmsNetworkPolicyManager> networkManager_; 62 std::shared_ptr<AppExecFwk::EventRunner> networkRunner_; 63 }; 64 } // namespace Telephony 65 } // namespace OHOS 66 #endif