1 /*
2  * Copyright (C) 2021-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 CALL_ABILITY_REPORT_PROXY_H
17 #define CALL_ABILITY_REPORT_PROXY_H
18 
19 #include <list>
20 
21 #include "singleton.h"
22 
23 #include "i_call_ability_callback.h"
24 
25 #include "call_state_listener_base.h"
26 #include "app_state_observer.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 class CallAbilityReportProxy : public CallStateListenerBase,
31                                public std::enable_shared_from_this<CallAbilityReportProxy> {
32     DECLARE_DELAYED_SINGLETON(CallAbilityReportProxy)
33 public:
34     int32_t RegisterCallBack(sptr<ICallAbilityCallback> callback, const std::string &bundleInfo);
35     int32_t UnRegisterCallBack(const std::string &bundleInfo);
36     int32_t UnRegisterCallBack(sptr<IRemoteObject> object);
37     void CallStateUpdated(sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState) override;
38     void CallEventUpdated(CallEventInfo &info) override;
39     void CallDestroyed(const DisconnectedDetails &details) override;
40     int32_t ReportAsyncResults(const CallResultReportId reportId, AppExecFwk::PacMap &resultInfo);
41     int32_t OttCallRequest(OttCallRequestId requestId, AppExecFwk::PacMap &info);
42     int32_t ReportMmiCodeResult(const MmiCodeInfo &info);
43     int32_t ReportAudioDeviceChange(const AudioDeviceInfo &info);
44     int32_t ReportCallStateInfo(const CallAttributeInfo &info);
45     int32_t ReportCallStateInfo(const CallAttributeInfo &info, std::string bundleInfo);
46     int32_t ReportPostDialDelay(const std::string &str);
47     int32_t ReportImsCallModeChange(const CallMediaModeInfo &imsCallModeInfo);
48     int32_t ReportCallSessionEventChange(const CallSessionEvent &callSessionEventOptions);
49     int32_t ReportPeerDimensionsChange(const PeerDimensionsDetail &peerDimensionsDetail);
50     int32_t ReportCallDataUsageChange(const int64_t dataUsage);
51     int32_t ReportCameraCapabilities(const CameraCapabilities &cameraCapabilities);
52 
53 private:
54     int32_t ReportCallEvent(const CallEventInfo &info);
55 
56 private:
57     std::list<sptr<ICallAbilityCallback>> callbackPtrList_;
58     sptr<ICallAbilityCallback> callAbilityCallbackPtr_;
59     sptr<ApplicationStateObserver> appStateObserver;
60     sptr<AppExecFwk::IAppMgr> appMgrProxy = nullptr;
61     std::mutex mutex_;
62 };
63 } // namespace Telephony
64 } // namespace OHOS
65 
66 #endif // CALL_ABILITY_REPORT_IPC_PROXY_H
67