1 /*
2  * Copyright (C) 2024 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 SATELLITE_CALL_CONTROL_H
17 #define SATELLITE_CALL_CONTROL_H
18 
19 #include <cstring>
20 #include <memory>
21 
22 #include "call_manager_inner_type.h"
23 #include "satellite_call.h"
24 #include "settings_datashare_helper.h"
25 #include "singleton.h"
26 
27 namespace OHOS {
28 namespace Telephony {
29 class SatelliteCallControl {
30     DECLARE_DELAYED_SINGLETON(SatelliteCallControl);
31 public:
32     void SetSatcommTempLevel(int32_t level);
33     int32_t IsAllowedSatelliteDialCall();
34     int32_t IsSatelliteSwitchEnable();
35     SatCommTempLevel GetSatcommTempLevel();
36     void HandleSatelliteCallStateUpdate(sptr<CallBase> &call, TelCallState priorState, TelCallState nextState);
37     bool IsShowDialog();
38     void SetShowDialog(bool isShowDialog);
39 private:
40     void PublishSatelliteConnectEvent();
41     int32_t SetSatelliteCallDurationProcessing();
42     int32_t SetSatelliteCallCountDownProcessing();
43     void RemoveCallDurationEventHandlerTask();
44     void RemoveCallCountDownEventHandlerTask();
45     void SetUsedModem();
46 
47 private:
48     SatCommTempLevel SatCommTempLevel_ = SatCommTempLevel::TEMP_LEVEL_LOW;
49     bool isShowingDialog_ = false;
50     std::shared_ptr<AppExecFwk::EventHandler> CallDurationLimitHandler_;
51     std::shared_ptr<AppExecFwk::EventHandler> CallCountDownHandler_;
52 };
53 } // namespace Telephony
54 } // namespace OHOS
55 
56 #endif //SATELLITE_CALL_CONTROL_H