1 /*
2  * Copyright (C) 2022-2023 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 IMS_SMS_STUB_H
17 #define IMS_SMS_STUB_H
18 
19 #include <unordered_map>
20 
21 #include "ims_sms_interface.h"
22 #include "ims_sms_ipc_interface_code.h"
23 #include "iremote_stub.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class ImsSmsStub : public IRemoteStub<ImsSmsInterface> {
28 public:
29     /**
30      * ImsCoreServiceStub Constructor
31      */
32     ImsSmsStub();
33 
34     /**
35      * ImsCoreServiceStub Deconstructor
36      */
37     virtual ~ImsSmsStub();
38 
39     /**
40      * OnRemoteRequest
41      *
42      * @param code
43      * @param data
44      * @param reply
45      * @param option
46      * @return Returns TELEPHONY_SUCCESS on success, others on failure.
47      */
48     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
49 
50 private:
51     using ImsSmsFunc = std::function<int32_t(MessageParcel &data, MessageParcel &reply)>;
52     int32_t OnImsSendMessage(MessageParcel &data, MessageParcel &reply);
53     int32_t OnImsSetSmsConfig(MessageParcel &data, MessageParcel &reply);
54     int32_t OnImsGetSmsConfig(MessageParcel &data, MessageParcel &reply);
55     int32_t OnRegisterSmsCallCallback(MessageParcel &data, MessageParcel &reply);
56     void InitFuncMap();
57 
58 private:
59     std::unordered_map<uint32_t, ImsSmsFunc> memberFuncMap_;
60 };
61 } // namespace Telephony
62 } // namespace OHOS
63 #endif // IMS_SMS_STUB_H
64