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 "hands_free_unit_calls.h"
17 #include "string"
18 #include <ctime>
19 
20 namespace OHOS {
21 namespace bluetooth {
HandsFreeUnitCalls(const std::string & device,int id,int state,const std::string & number,bool multiParty,bool outgoing,bool inBandRing)22 HandsFreeUnitCalls::HandsFreeUnitCalls(const std::string &device, int id, int state, const std::string &number,
23     bool multiParty, bool outgoing, bool inBandRing)
24     : device_(device), id_(id), state_(state), number_(number), uuid_(Uuid::Random()),
25     multiParty_(multiParty), outgoing_(outgoing), inBandRing_(inBandRing)
26 {
27     creationTime_ = clock();
28 }
29 
HandsFreeUnitCalls(const std::string & device,int id,int state,const std::string & number,Uuid & uuid,bool multiParty,bool outgoing,bool inBandRing,long creationTime)30 HandsFreeUnitCalls::HandsFreeUnitCalls(const std::string &device, int id, int state, const std::string &number,
31     Uuid &uuid, bool multiParty, bool outgoing, bool inBandRing, long creationTime)
32     : device_(device), id_(id), state_(state), number_(number), uuid_(uuid),
33     multiParty_(multiParty), outgoing_(outgoing), inBandRing_(inBandRing),
34     creationTime_(creationTime)
35 {
36 }
37 
GetRemoteDevice() const38 const std::string &HandsFreeUnitCalls::GetRemoteDevice() const
39 {
40     return device_;
41 }
42 
GetId() const43 int HandsFreeUnitCalls::GetId() const
44 {
45     return id_;
46 }
47 
GetUuid() const48 Uuid HandsFreeUnitCalls::GetUuid() const
49 {
50     return uuid_;
51 }
52 
GetState() const53 int HandsFreeUnitCalls::GetState() const
54 {
55     return state_;
56 }
57 
GetNumber() const58 const std::string &HandsFreeUnitCalls::GetNumber() const
59 {
60     return number_;
61 }
62 
GetCreationTime() const63 long HandsFreeUnitCalls::GetCreationTime() const
64 {
65     return creationTime_;
66 }
67 
IsMultiParty() const68 bool HandsFreeUnitCalls::IsMultiParty() const
69 {
70     return multiParty_;
71 }
72 
IsOutgoing() const73 bool HandsFreeUnitCalls::IsOutgoing() const
74 {
75     return outgoing_;
76 }
77 
IsInBandRing() const78 bool HandsFreeUnitCalls::IsInBandRing() const
79 {
80     return inBandRing_;
81 }
82 
SetState(int state)83 void HandsFreeUnitCalls::SetState(int state)
84 {
85     state_ = state;
86 }
87 
SetNumber(const std::string & number)88 void HandsFreeUnitCalls::SetNumber(const std::string &number)
89 {
90     number_ = number;
91 }
92 
SetMultiParty(bool multiParty)93 void HandsFreeUnitCalls::SetMultiParty(bool multiParty)
94 {
95     multiParty_ = multiParty;
96 }
97 }  // namespace bluetooth
98 }  // namespace OHOS