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