• 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_STUB_H
17 #define SMS_INTERFACE_STUB_H
18 
19 #include <list>
20 #include <memory>
21 #include <mutex>
22 #include <string>
23 
24 #include "iremote_stub.h"
25 
26 #include "i_sms_service_interface.h"
27 #include "sms_interface_manager.h"
28 #include "sms_receive_manager.h"
29 #include "sms_send_manager.h"
30 
31 namespace OHOS {
32 namespace Telephony {
33 class SmsInterfaceStub : public IRemoteStub<ISmsServiceInterface> {
34 public:
35     SmsInterfaceStub();
36     ~SmsInterfaceStub();
37     virtual int OnRemoteRequest(
38         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
39     std::shared_ptr<SmsInterfaceManager> GetSmsInterfaceManager(int32_t slotId);
40     std::shared_ptr<SmsInterfaceManager> GetSmsInterfaceManager();
41 
42 protected:
43     void InitModule();
44 
45 private:
46     void OnSendSmsTextRequest(MessageParcel &data, MessageParcel &reply, MessageOption &option);
47     void OnSendSmsDataRequest(MessageParcel &data, MessageParcel &reply, MessageOption &option);
48     void OnSetSmscAddr(MessageParcel &data, MessageParcel &reply, MessageOption &option);
49     void OnGetSmscAddr(MessageParcel &data, MessageParcel &reply, MessageOption &option);
50     void OnAddSimMessage(MessageParcel &data, MessageParcel &reply, MessageOption &option);
51     void OnDelSimMessage(MessageParcel &data, MessageParcel &reply, MessageOption &option);
52     void OnUpdateSimMessage(MessageParcel &data, MessageParcel &reply, MessageOption &option);
53     void OnGetAllSimMessages(MessageParcel &data, MessageParcel &reply, MessageOption &option);
54     void OnSetCBRangeConfig(MessageParcel &data, MessageParcel &reply, MessageOption &option);
55     void OnSetCBConfig(MessageParcel &data, MessageParcel &reply, MessageOption &option);
56     void OnSetImsSmsConfig(MessageParcel &data, MessageParcel &reply, MessageOption &option);
57     void OnSetDefaultSmsSlotId(MessageParcel &data, MessageParcel &reply, MessageOption &option);
58     void OnGetDefaultSmsSlotId(MessageParcel &data, MessageParcel &reply, MessageOption &option);
59     void OnSplitMessage(MessageParcel &data, MessageParcel &reply, MessageOption &option);
60     void OnGetSmsSegmentsInfo(MessageParcel &data, MessageParcel &reply, MessageOption &option);
61     void OnIsImsSmsSupported(MessageParcel &data, MessageParcel &reply, MessageOption &option);
62     void OnGetImsShortMessageFormat(MessageParcel &data, MessageParcel &reply, MessageOption &option);
63     void OnHasSmsCapability(MessageParcel &data, MessageParcel &reply, MessageOption &option);
64     void OnCreateMessage(MessageParcel &data, MessageParcel &reply, MessageOption &option);
65     void OnGetBase64Encode(MessageParcel &data, MessageParcel &reply, MessageOption &option);
66     void OnGetBase64Decode(MessageParcel &data, MessageParcel &reply, MessageOption &option);
67     void OnGetEncodeStringFunc(MessageParcel &data, MessageParcel &reply, MessageOption &option);
68     void RemoveSpacesInDesAddr(std::u16string &desAddr);
69 
70     std::map<uint32_t, std::shared_ptr<SmsInterfaceManager>> slotSmsInterfaceManagerMap_;
71     using SmsServiceFunc = void (SmsInterfaceStub::*)(MessageParcel &data, MessageParcel &reply, MessageOption &option);
72     std::map<uint32_t, SmsServiceFunc> memberFuncMap_;
73     std::mutex mutex_;
74 };
75 } // namespace Telephony
76 } // namespace OHOS
77 #endif