• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     int32_t TextBasedSmsDelivery(const std::string &desAddr, const std::string &scAddr, const std::string &text,
38         const sptr<ISendShortMessageCallback> &sendCallback,
39         const sptr<IDeliveryShortMessageCallback> &deliveryCallback);
40     int32_t 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     int32_t AddSimMessage(
44         const std::string &smsc, const std::string &pdu, ISmsServiceInterface::SimMessageStatus status);
45     int32_t DelSimMessage(uint32_t msgIndex);
46     int32_t UpdateSimMessage(uint32_t msgIndex, ISmsServiceInterface::SimMessageStatus newStatus,
47         const std::string &pdu, const std::string &smsc);
48     int32_t GetAllSimMessages(std::vector<ShortMessage> &message);
49     int32_t SetSmscAddr(const std::string &scAddr);
50     int32_t GetSmscAddr(std::u16string &smscAddress);
51     int32_t SetCBConfig(bool enable, uint32_t fromMsgId, uint32_t toMsgId, uint8_t netType);
52     bool SetImsSmsConfig(int32_t slotId, int32_t enable);
53     int32_t SetDefaultSmsSlotId(int32_t slotId);
54     int32_t GetDefaultSmsSlotId();
55     int32_t SplitMessage(const std::string &message, std::vector<std::u16string> &splitMessage);
56     int32_t GetSmsSegmentsInfo(const std::string &message, bool force7BitCode, LengthInfo &outInfo);
57     int32_t IsImsSmsSupported(int32_t slotId, bool &isSupported);
58     int32_t GetImsShortMessageFormat(std::u16string &format);
59     bool HasSmsCapability();
60 
61 private:
62     int32_t slotId_;
63     std::unique_ptr<SmsSendManager> smsSendManager_;
64     std::unique_ptr<SmsReceiveManager> smsReceiveManager_;
65     std::shared_ptr<SmsMiscManager> smsMiscManager_;
66 };
67 } // namespace Telephony
68 } // namespace OHOS
69 #endif