• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 TELEPHONY_BASE_CONNECTION_H
17 #define TELEPHONY_BASE_CONNECTION_H
18 
19 #include "telephony_errors.h"
20 #include "telephony_log_wrapper.h"
21 #include "core_manager_inner.h"
22 #include "call_manager_inner_type.h"
23 #include "cellular_call_data_struct.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 constexpr static const int64_t PAUSE_DELAY_TIME = 3 * 1000;
28 class BaseConnection {
29 public:
30     /**
31      * Constructor
32      */
33     BaseConnection();
34 
35     /**
36      * Destructor
37      */
38     virtual ~BaseConnection() = default;
39 
40     /**
41      * Set or Update CallReportInfo
42      *
43      * @param CallReportInfo
44      */
45     void SetOrUpdateCallReportInfo(CallReportInfo &callReportInfo);
46 
47     /**
48      * Get CallReportInfo
49      *
50      * @return CallReportInfo
51      */
52     CallReportInfo GetCallReportInfo();
53 
54     /**
55      * SetStatus
56      *
57      * @param state
58      */
59     void SetStatus(TelCallState state);
60 
61     /**
62      * Get connection Status
63      *
64      * @return TelCallState
65      */
66     TelCallState GetStatus() const;
67 
68     /**
69      * IsRingingState.
70      *
71      * @return bool
72      */
73     bool IsRingingState() const;
74 
75     /**
76      * Set Flag
77      *
78      * @param bool
79      */
80     void SetFlag(bool flag);
81 
82     /**
83      * Get Flag
84      *
85      * @return bool
86      */
87     bool GetFlag() const;
88 
89     /**
90      * Set Index
91      *
92      * @param int32_t
93      */
94     void SetIndex(int32_t index);
95 
96     /**
97      * Get Index
98      *
99      * @return int32_t
100      */
101     int32_t GetIndex() const;
102 
103     void SetNumber(const std::string &number);
104 
105     std::string GetNumber() const;
106 
107     PostDialCallState ProcessNextChar(int32_t slotId, char &c);
108 
109     void SetPostDialCallState(PostDialCallState s);
110 
111     void UpdateCallNumber(std::string phoneNum);
112 
113     std::string GetLeftPostDialCallString();
114 
115 private:
116     virtual int32_t ProcessPostDialCallChar(int32_t slotId, char c);
117 
118 protected:
119     std::string phoneNumber_;
120 
121 private:
122     bool flag_ = false;
123     int32_t index_ = 1;
124     std::string number_;
125     CallReportInfo callReportInfo_;
126     PostDialCallState postDialCalltate_ = PostDialCallState::POST_DIAL_CALL_NOT_STARTED;
127     int32_t nextPostDialCallCode_ = 0;
128     std::string postDialCallString_;
129 };
130 } // namespace Telephony
131 } // namespace OHOS
132 #endif // TELEPHONY_BASE_CONNECTION_H
133