• 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 #include "base_connection.h"
17 
18 #include "securec.h"
19 
20 namespace OHOS {
21 namespace Telephony {
BaseConnection()22 BaseConnection::BaseConnection()
23 {
24     (void)memset_s(&callReportInfo_, sizeof(CallReportInfo), 0, sizeof(callReportInfo_));
25 }
26 
SetOrUpdateCallReportInfo(CallReportInfo & callReportInfo)27 void BaseConnection::SetOrUpdateCallReportInfo(CallReportInfo &callReportInfo)
28 {
29     callReportInfo_ = callReportInfo;
30 }
31 
GetCallReportInfo()32 CallReportInfo BaseConnection::GetCallReportInfo()
33 {
34     return callReportInfo_;
35 }
36 
SetStatus(TelCallState state)37 void BaseConnection::SetStatus(TelCallState state)
38 {
39     callReportInfo_.state = state;
40 }
41 
GetStatus() const42 TelCallState BaseConnection::GetStatus() const
43 {
44     return callReportInfo_.state;
45 }
46 
IsRingingState() const47 bool BaseConnection::IsRingingState() const
48 {
49     return this->GetStatus() == TelCallState::CALL_STATUS_INCOMING ||
50         this->GetStatus() == TelCallState::CALL_STATUS_WAITING ||
51         this->GetStatus() == TelCallState::CALL_STATUS_ALERTING;
52 }
53 
SetFlag(bool flag)54 void BaseConnection::SetFlag(bool flag)
55 {
56     flag_ = flag;
57 }
58 
GetFlag() const59 bool BaseConnection::GetFlag() const
60 {
61     return flag_;
62 }
63 
SetIndex(int32_t index)64 void BaseConnection::SetIndex(int32_t index)
65 {
66     index_ = index;
67 }
68 
GetIndex() const69 int32_t BaseConnection::GetIndex() const
70 {
71     return index_;
72 }
73 } // namespace Telephony
74 } // namespace OHOS