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 REPORT_CALL_STATE_CLIENT_H
17 #define REPORT_CALL_STATE_CLIENT_H
18 
19 #include "if_system_ability_manager.h"
20 #include "rwlock.h"
21 #include "singleton.h"
22 
23 #include "call_state_listener_base.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class CallStateReportProxy : public CallStateListenerBase,
28                              public std::enable_shared_from_this<CallStateReportProxy> {
29     DECLARE_DELAYED_SINGLETON(CallStateReportProxy)
30 public:
31     void CallStateUpdated(sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState);
32     void UpdateCallState(sptr<CallBase> &callObjectPtr, TelCallState nextState);
33     void UpdateCallStateForSlotId(sptr<CallBase> &callObjectPtr, TelCallState nextState);
34     int32_t ReportCallState(int32_t callState, std::u16string phoneNumber);
35     int32_t ReportCallStateForCallId(
36         int32_t slotId, int32_t callState, std::u16string incomingNumber);
37     void UpdateCallStateForVoIPOrRestart();
38 private:
39     TelCallState GetVoipCallState();
40 
41 private:
42     TelCallState currentCallState_ = TelCallState::CALL_STATUS_UNKNOWN;
43 };
44 } // namespace Telephony
45 } // namespace OHOS
46 
47 #endif // REPORT_CALL_STATE_CLIENT_H
48