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_INTERFACE_MANAGER_H 17 #define SMS_INTERFACE_MANAGER_H 18 19 #include <list> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "i_sms_service_interface.h" 25 #include "sms_receive_manager.h" 26 #include "sms_send_manager.h" 27 #include "sms_misc_manager.h" 28 #include "sms_persist_helper.h" 29 30 namespace OHOS { 31 namespace Telephony { 32 class SmsInterfaceManager { 33 public: 34 explicit SmsInterfaceManager(int32_t slotId); 35 virtual ~SmsInterfaceManager(); 36 void InitInterfaceManager(); 37 void TextBasedSmsDelivery(const std::string &desAddr, const std::string &scAddr, const std::string &text, 38 const sptr<ISendShortMessageCallback> &sendCallback, 39 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 40 void DataBasedSmsDelivery(const std::string &desAddr, const std::string &scAddr, const uint16_t port, 41 const uint8_t *data, uint16_t dataLen, const sptr<ISendShortMessageCallback> &sendCallback, 42 const sptr<IDeliveryShortMessageCallback> &deliveryCallback); 43 bool AddSimMessage( 44 const std::string &smsc, const std::string &pdu, ISmsServiceInterface::SimMessageStatus status); 45 bool DelSimMessage(uint32_t msgIndex); 46 bool UpdateSimMessage(uint32_t msgIndex, ISmsServiceInterface::SimMessageStatus newStatus, 47 const std::string &pdu, const std::string &smsc); 48 std::vector<ShortMessage> GetAllSimMessages(); 49 bool SetSmscAddr(const std::string &scAddr); 50 std::string GetSmscAddr(); 51 bool SetCBConfig(bool enable, uint32_t fromMsgId, uint32_t toMsgId, uint8_t netType); 52 bool SetDefaultSmsSlotId(int32_t slotId); 53 int32_t GetDefaultSmsSlotId(); 54 std::vector<std::string> SplitMessage(const std::string &message); 55 bool GetSmsSegmentsInfo(const std::string &message, bool force7BitCode, LengthInfo &outInfo); 56 bool IsImsSmsSupported(); 57 std::string GetImsShortMessageFormat(); 58 bool HasSmsCapability(); 59 60 private: 61 int32_t slotId_; 62 std::unique_ptr<SmsSendManager> smsSendManager_; 63 std::unique_ptr<SmsReceiveManager> smsReceiveManager_; 64 std::shared_ptr<SmsMiscManager> smsMiscManager_; 65 }; 66 } // namespace Telephony 67 } // namespace OHOS 68 #endif